Developing a Graphical User Interface for a Distributed Sensor Network

A Thesis in STS 402 Presented to The Faculty of the School of Engineering and Applied Science University of Virginia In Partial Fulfillment of the Requirements for the Bachelor of Science in Computer Engineering By Adam Lee Monday, March 28, 2005

On my honor as a University student, on this assignment I have neither given nor received unauthorized aid as defined by the Honor Guidelines for Papers in Science, Technology, and Society Courses.

_________________________________________ (Full signature)

Approved

Date Technical Advisor – Tarek Abdelzaher

Approved

Date STS 402 Advisor – Ingrid Townsend

Preface I would first like to thank my grandmother for funding my education here at The University of Virginia. I would also like to thank my parents for their support and for tolerating my seemingly endless trips home and back to school over the past four years. I want to thank Tarek Abdelzaher for serving as my technical advisor and for keeping me on task over the past seven months with weekly meetings. I would like to thank my STS advisors Bryan Pfaffenberger and Ingrid Townsend for helping me better understand the social and ethical impacts engineering projects have on society. Finally, I want to thank the EnviroTrack team, Liqian Luo and Ajay Kulhari, for their advice and suggestions on my project.

i

Table of Contents LIST OF FIGURES ...................................................................................................................................IV GLOSSARY OF TERMS ........................................................................................................................... V ABSTRACT ................................................................................................................................................VI CHAPTER 1. INTRODUCTION................................................................................................................ 1

1.1 Problem Definition........................................................................................ 1 1.2 Rationale and Scope...................................................................................... 2 1.3 Analysis of Social and Ethical Contexts....................................................... 3 1.4 Report Overview........................................................................................... 5 CHAPTER 2. REVIEW OF TECHNICAL LITERATURE .................................................................... 6

2.1 Query............................................................................................................. 6 2.2 Event ............................................................................................................. 9 2.3 Node............................................................................................................ 10 2.4 Biological.................................................................................................... 11 CHAPTER 3. METHODOLOGY ............................................................................................................ 13

3.1 Levels of Abstraction.................................................................................. 14 3.2 Condition..................................................................................................... 14 3.3 Attribute ...................................................................................................... 16 3.4 Collections .................................................................................................. 17 3.5 Method ........................................................................................................ 17 3.6 Object.......................................................................................................... 18 3.7 Project ......................................................................................................... 19 3.8 File Directory Structure .............................................................................. 19 CHAPTER 4. DESIGN DECISIONS ....................................................................................................... 22

4.1 Tabbed Interface ......................................................................................... 22 4.2 Minimizing Screen Clutter.......................................................................... 22 4.3 GUI Components ........................................................................................ 23 4.4 Edit Condition Library Window ................................................................. 25 CHAPTER 5. CONCLUSION AND EVALUATION............................................................................. 26

5.1 Detection Conditions Tab ........................................................................... 26

ii

5.2 Measurement Attribute Tab ........................................................................ 27 5.3 Method Tab................................................................................................. 27 5.4 Error Checking and Testing ........................................................................ 28 5.5 Section 508 Standards................................................................................. 29 5.6 Evaluation of Project Goals ........................................................................ 30 CHAPTER 6. RECOMMENDATIONS................................................................................................... 31

6.1 Appearance ................................................................................................. 31 6.2 Additional Features..................................................................................... 31 6.3 Code Enhancements.................................................................................... 33 6.4 Future Work ................................................................................................ 34 BIBLIOGRAPHY ...................................................................................................................................... 35 APPENDIX ................................................................................................................................................. 37

A. GUI Screen Shots......................................................................................... 37 A.1 Introduction Main Screen....................................................................... 37 A.2 Detection Conditions Tab ...................................................................... 38 A.3 Measurement Attributes Tab.................................................................. 38 A.4 Attached Methods Tab ........................................................................... 39 A.5 Edit Condition Library Window ............................................................ 39 B. Sample GUI Output Files............................................................................. 40 B.1 Project File ............................................................................................. 40 B.2 Condition File......................................................................................... 41 B.3 Aggregation Method File ....................................................................... 41

iii

List of Figures Figure 1: Example Tank Conditions ................................................................................. 13 Figure 2: Example Tank Attributes................................................................................... 14 Figure 3: Tank Conditions Defined .................................................................................. 16 Figure 4: Tank Attributes Defined.................................................................................... 17 Figure 5: Tank Method Definitions .................................................................................. 18 Figure 6: Tank Definition ................................................................................................. 19 Figure 7: Project................................................................................................................ 19 Figure 8: EnviroTrack File Directory Structure................................................................ 21

iv

Glossary of Terms Aggregate Function

Attribute

Balloon Tooltip

Base station Collection Condition Data type

Description Distributed Sensor Network (DSN)

Graphical User Interface (GUI)

Limit

Method nesC Object Project Sensor Node

Unit

Currently defined as one of the following six operations: minimum, maximum, mean, median, mode, and sum. Instructs the DSN how to collect and group sensor data from the object. Composed of a combination of a condition and aggregate function that describes what and how the user wishes to observe an object. A small text note that appears when the mouse cursor hovers over certain buttons, list boxes, and text inputs of the GUI that explain functionality. A remote computer that receives and processes the wireless information sent from a DSN. Represents a group of like structures. Examples include object and condition collections. A state of the environment that a sensor node can detect and measure. Describes how a condition’s limits will be measured. Currently defined as one of the following three terms: Boolean, integer, float. A textual explanation of a condition. A collection of sensor nodes that wirelessly communicate with one another and a remote base station. A representation of a program by which a user interacts through a series of mouse clicks and keyboard inputs. Can be an upper or lower limit. States the upper and lower bounds for measuring a condition’s occurrence. Composed of a name and file path that points to a file that implements a condition or object in nesC. Sensor node code that is downloaded onto the sensor nodes to enable functionality. An entity that can be identified and monitored by a DSN. The highest level of abstraction in the GUI code. Contains a collection of objects and conditions. A device that is capable of detecting and measuring external phenomenon such as light, noise, temperature, and magnetic field of an environment. A condition’s unit of measure.

v

Abstract Distributed sensor networks (DSNs) provide an innovative method of remotely monitoring physical objects and events within an environment. DSNs are composed of a large number of wireless sensor nodes and a remote base station. Each sensor node has the capability of detecting environmental conditions such as light, temperature, motion, sound, and magnetic field. The goal of a DSN is for the sensors to detect and measure the conditions of an environment and relay that information to a remote base station to be monitored. However, there currently is a lack of definitive programming support for user interaction with DSNs. In order to program a DSN before it is deployed, users must be knowledgeable of network architecture and the programming language used by sensor nodes for communication. These low-level details might be easily understood by individuals familiar with DSNs and their implementations, but are unintelligible and confusing to the common user. Thus, new approaches are needed to abstract these complicated details into a user-friendly programming environment. Using the Microsoft Visual Studio .NET software, this project uses the C# programming language and an object-oriented programming approach to develop a graphical user interface (GUI). The GUI allows users to think of an environment as a collection of abstract objects that represent real physical entities, while eliminating their need to know about the specific details of programming DSNs.

vi

Chapter 1. Introduction

1.1 Problem Definition Distributed sensor networks (DSNs) are rapidly evolving into a viable solution for replacing current techniques for monitoring environments that involve cumbersome and expensive audio and video equipment (Culler). Composed of a remote base station and a large number of sensor nodes, DSNs provide an innovative approach to monitoring various environmental conditions including light, temperature, sound, motion, and magnetic field. The base station wirelessly communicates with the network and collects the desired information relayed from it. The basic goals of DSNs are to detect the occurrence of events of interest and then classify, track, and monitor them. Possible uses for DSNs include military applications, building surveillance, habitat monitoring, and traffic reporting. Typical DSNs contain hundreds or thousands of irregularly placed sensor nodes because they are often deployed via an airborne drop over the targeted environment. Once deployed, DSNs receive little to no maintenance because they might be monitoring remote or hostile environments. Therefore, they must be extremely robust; automatic initial configuration and setup is a necessity. They must also have the ability to grow and shrink dynamically as large numbers of random nodes might fail, and new nodes might be added to grow the network or replace broken nodes. Maintaining DSNs after a successful deployment presents numerous other challenges. The greatest hindrance to maintaining DSNs is resource management. Current network implementations utilize batteries to power sensor nodes. Thus, constant node

1

communication would greatly reduce the lifetime of an already limited power supply. Therefore, networks must manage communication internally and with the base station. They also face the challenge of balancing communication latency with real-time processing requirements. In many cases, DSNs will be subject to harsh environments. Therefore, they must be resistant to extreme weather conditions. However, they must also resist intentional tampering and destruction from other outside forces. To combat tampering, it is vital that DSNs exhibit properties that include data privacy and protection. As a result of the aforementioned problems, interacting with DSNs is extremely difficult; users must be familiar with low-level details such as network communication and complicated programming languages.

1.2 Rationale and Scope This project uses an object-driven approach to abstract the low-level details of DSNs. This approach enables users to think of an environment as an abstract collection of objects that represent physical entities within the environment, and reduces the amount of detailed knowledge needed to program DSNs. A graphical user interface (GUI) was created that allows for the creation of such high-level representations. A GUI is a representation of a computer program containing pictures and icons that allow for user interaction via a series of mouse clicks and keyboard inputs. The current design replaces a text based interface that requires user knowledge of sensor node code. In the EnviroTrack paradigm, an environment is composed of a collection of objects that represent physical entities. Examples of objects include vehicles, people, and animals. Using the GUI, users define an object of interest by instructing the DSN how to

2

detect its presence within the environment, as well as the object’s attributes to monitor. This is accomplished through the delineation of environmental conditions that help identify a unique object, and measurement attributes that are monitored after successful detection. The GUI also enables users to define and write their own libraries of environmental conditions that can be used to detect objects. Once the description of the environment is complete, the user is able to save that description in the form of a text file. These files are then interpreted by another application that translates the GUI files into sensor node code to be downloaded onto the network. This additional application is not part of this project.

1.3 Analysis of Social and Ethical Contexts As sensor nodes become increasingly minute, a distributed sensor network of the future may be invisible to the untrained eye. Therefore, one might unknowingly be under constant surveillance. Lederer, Dey, and Makoff present the idea of ubiquitous computing, or ubicomp. Ubicomp affects one’s ability to control his or her everyday privacy as a result of the constant collection of personal information. Users vary their behavior depending on the situation that they face. However, ubicomp affects a user’s ability to know what situation he or she is in. DSNs are a form of ubicomp and successful deployment of such networks pose serious issues of privacy invasion. Lederer et al. assert that ubicomp systems, or personal information collectors, should require user consent and prior knowledge of observation. People being monitored must be given control over the collection of their personal information. One solution proposed by Lederer et al. includes assigning users a face. A face is an abstraction of a

3

user’s privacy preferences in a given situation; it would represent a user’s consent to disclose certain personal information. This might be based on the sensitivity of the information disclosed, the usage of the obtained information, and the context in which the information is gathered. However, this solution has foreseeable problems. DSNs might be deployed in covert operations in which it is detrimental to inform targeted individuals of the monitoring system. It might also be difficult for one to assign a certain face to address all situations that he or she might face. Additionally, one might have to constantly wear a device that identifies him or her to the network. Ownership and use of data collected from sensor networks is an important issue. If DSNs become commonplace in the United States, then the legal system will have to address the legality of information obtained by them. Surveillance of any nature includes the issues of security and privacy. The designer of a sensor network will have to determine how easy it is for an outsider to disrupt the network, create a Denial of Service (DoS) attack, or add bogus sensors to the network. The network may also be susceptible to outside interference and signal jamming, which prevents nodes from exchanging data. Lastly, methods such as cryptography must be used to ensure that sensitive information obtained by DSNs is meaningless to outside users. There are also environmental concerns involved with deploying DSNs. Since network nodes will not often be recovered, they will remain within the environment indefinitely. Batteries used by the nodes will deteriorate over time and could leak harmful substances into the environment. If networks are deployed in habitats of endangered species they could cause serious harm to the species’ environment and thus

4

endanger them even further. Ferro Solutions has recently developed an energy harvester that can power a sensor with vibrations from its environment (Treese, 2004). Other solutions such as solar energy might also be used to make DSNs more environmentfriendly.

1.4 Report Overview The rest of this paper is organized as follows. Chapter 2 details the four major paradigm approaches to programming DSNs. Chapter 3 discusses this project’s software layout, and addresses the specific programming structures used. Chapter 4 specifies the various design decisions made in constructing the layout of the GUI. Chapter 5 includes an evaluation of the current design, and the report concludes with Chapter 6, which offers recommendations for future work.

5

Chapter 2. Review of Technical Literature Chapter 2 examines the current literature on DSNs, and discusses the four major existing programming approaches.

There currently exist four major approaches to programming DSNs. They are query, event, node, and biological. Cornell, The University of California at Berkeley (UC Berkeley), and The University of Pittsburgh are three major universities that have taken a query-based approach towards DSNs. This approach treats the network as a traditional database, allowing the user to query requests within the network. The University of Virginia (UVA), UC Berkeley, and UCLA all view DSNs through an event-based method. This method allows for multiple, concurrent events to control the network. Events within the network are triggered by external events occurring within the environment. UC Berkeley and The University of Colorado have developed a nodebased system for DSNs. This approach allows programmers to think of events and objects in abstract terms rather than individual sensor nodes. The fourth major programming approach, used by The Massachusetts Institute of Technology (MIT) and UVA, is biological-based. This paradigm mirrors the behavior of biological phenomenon such as ant colonies in which a large task is completed based on the cooperation of many individuals.

2.1 Query Cornell’s Cougar project uses a database approach to address network flexibility and scalability (Demers et al., 2003). There are several main goals of the Cougar project. First, it addresses the impact of storing data on the network for later retrieval. Secondly, 6

it deals with the issue of how and when data is routed within the network. In the Cougar model, sensors generate structured data that can be queried, and the data distributed within the network can then be viewed as a database. Its design builds a distributed management layer into individual network nodes. This cross-layer optimization, or a query specific layer, is not intended for point to point communication. Rather, this model assumes that each node is aware of its own location. Cougar also examines the relationship between the energy consumed and how data is aggregated on view nodes. Individual sensor nodes send data to various view nodes. These nodes are then queried, and energy is saved because the network determines what data is stored on each view node and how that data is collected. TinyDB is a query processing system that runs on the Berkeley Mica Mote platform on top of the TinyOS (TinyDB 2005). Like Cornell’s Cougar system, TinyDB extracts information from a sensor network with the main goal of conserving energy by controlling when and where data is collected (Franklin 2003). It views sensor data as a single table with a single column per data type. Each node in TinyDB contains information about itself, or metadata, such as the power, cost, and time to sample it. TinyDB uses this metadata to determine the ordering of sampling and is able to perform power-based queries and lifetime estimations for long queries. TinyDB simplifies a programmer’s task by providing an SQL-like interface that eliminates the need for written embedded C code for sensors (TinyDB 2005). High level queries allow a user to describe the data that he wants to obtain from the network. Queries in TinyDB consist of a SQL-like SELECT-FROM-WHERE statement that can be written to extract certain data for a specific amount of time (Franklin et al., 2003). The sensor nodes are organized

7

in a routing tree. A query request is placed at the root node which in turn forwards the request to its children nodes until all nodes have heard the request. The SELECT field lists the attributes to retrieve from the sensors, FROM specifies the table from which the data will be retrieved, and WHERE filters out readings that do not satisfy the specified Boolean constraints from the query. Given a query specifying a user’s data interests, TinyDB collects that data from the nodes in the environment, filters it, aggregates it, and routes it out to a computer. It does this via power-efficient in-network processing algorithms (Hellerstein 2003). The University of Pittsburgh developed the Temporal coherency-aware inNetwork Aggregation (TiNA) system to reduce the amount of information transmitted by individual nodes (Beaver et al., 2003). According to Beaver et al., “TiNA is independent of the synchronization protocol used for sending and receiving data between the sensor nodes” and “can reduce power consumption by up to 50% without any loss in the quality of data”. TiNA uses in-network processing which employs application-specific caching and aggregation as well as collaborative signal processing. It also utilizes directed diffusion which allows nodes transmitting a packet to perform processing on the packet and then forward that packet to another node. TiNA decides what data to forward up the routing tree and how to merge and aggregate the data. It adds a VALUE WITHIN query specification which allows for the “the degree to which the user is tolerant to changes in the value of sensor readings” (Beaver et al., 2003).

8

2.2 Event UVA’s Data Service Middleware (Dsware) “supports the specification and automated detection of compound events” (Römer). A compound event includes: event identification, a geographical area of interest, a time frame of interest, a set of sensor nodes, a confidence function, and a set of events (Römer). Dsware uses group management; nodes decide on whether to join the group by checking to see if it matches the event criterion. It also uses confidence factors to determine relationships between compound events. Data that describes a certain event can be mapped to its location in the network so that future queries for this event will not flood the network (Li et al., 2004). Globally asynchronous locally synchronous C (galsC) is a programming language intended for use in event-driven embedded systems using the UC Berkeley Mica Motes. Event-driven means that concurrent components are activated by external events within the environment. The goal of the sensor network is to detect moving events modeled as point sources. galsC is a structured language that handles concurrency to avoid deadlocks, race conditions, and interrupts (Cheong & Liu). Local software components are linked via synchronous method calls to form global actors. These actors then communicate asynchronously via message passing. The main advantage galsC gives to users is that they have control over system concurrency and do not have to worry about multiple threads when creating software. More specifically, galsC allows developers to use high level constructs to create thread-safe and multitasking programs. It also features automatic code generation, which helps to reduce code implementation and debugging time, and can aid in helping programmers avoid errors while writing synchronization code (Cheong & Liu).

9

SensorWare was developed at UCLA in order to create sensor networks that are open to multiple users. It supports programming utilizing a high-level scripting language, and concurrent multitasking enabling multiple applications to concurrently execute within the network (Boulis & Srivastava, 2003). The goal of the SensorWare project is to design a framework that supports lightweight and mobile control scripts. Certain commands within the scripts abstract a specific task of a sensor node such as communication protocols. The scripts allow for the dynamic deployment of distributed algorithms within the network while abstracting the services for all of the node’s modules. A script can migrate and replicate its code to other nodes as events of interest move within the network. The moving scripts cooperate with each other to send useful information back to the base station.

2.3 Node Colorado’s multimodal system for networks of in-situ wireless sensors (MANTIS) project provides a user-friendly multithreaded operating system for a DSN (Abrach et al., 2003). The MANTIS operating system (MOS) incorporates the classical structure of operating systems by employing multithreading, I/O synchronization, and device drivers. The entire kernel and application programming interface are also written in the C programming language. Since many programmers are familiar with C, this characteristic of MOS encourages code reuse and makes prototyping computers utilizing the x-86 architecture easier (Abrach et al., 2003). This in turn helps testing, debugging, and modification. MOS also supports dynamic reprogramming and remote debugging of sensor nodes.

10

Maté, developed at UC Berkeley, is a communication-centric virtual machine designed for sensor networks. It allows high-level programs to be very short, thus reducing the energy cost of transmission among sensor nodes (Levis & Culler). Maté is a byte code interpreter that virtualizes real hardware. Instructions can fit into a packet of twenty four instructions and can forward themselves throughout the network. This allows for a wide range of programs to be quickly installed on a DSN, which results in minimized network traffic and subsequent energy conservation. UC Berkeley also developed the nesC programming language. nesC is an extension of the C programming language designed to run on TinyOS (Gay et al.). TinyOS is an operating system designed to run on sensor network nodes that have limited resources. It incorporates concurrency and component-oriented application design. nesC simplifies program development by performing whole program optimizations and data race detection at compile time. Optimizations reduce the amount of code by eliminating dead code. This reduces the potential for bugs and simplifies event flow, while data race detection aids concurrency on limited resources (Gay et al.).

2.4 Biological The goal of MIT’s amorphous computing initiative is “to organize amorphous processes by imitating gradient phenomena found in biology” (Abelson et al., 2000). It views a DSN as “a collection of irregularly placed, asynchronous, locally interacting computing elements” in which nodes do not have prior knowledge of their positions or orientations (Abelson et al., 2000). The goal of amorphous computing is not to have a system that evolves from a set of nodes based on an event; the self-organization of a DSN

11

is not the intent. Rather, the goal is to design a system that mirrors biological chemical diffusion. For example, cellular computing uses chemicals to control biological processes much like electrical devices are used to control electric processes. Living cells can then be controlled to mirror the behavior of digital logic gates (Abelson et al., 2000). UVA’s swarm computing idea is similar to MIT’s amorphous computing. A swarm can be likened to the idea of a colony of ants that can accomplish a large task together in large numbers (Evans 2000). The behavior of a swarm program depends on the total behavior of the individual nodes. The challenge of swarm computing deals with creating programs for individual nodes based on a desired behavior, and then predicting high level behavior based on the programs running on them. Swarm computing is different than MIT’s approach because it allows nodes to interact and move with the environment whereas MIT’s approach is concerned with particles scattered throughout an environment. All four of the major programming approaches treat DSNs in a unique manner. Each paradigm attempts to mitigate the resource restrictions inherent to DSNs through innovative designs and supportive architecture, while providing the user with an abstract view of the network. The UVA EnviroTrack project led by computer science professor Tarek Abdelzaher attempts to develop another unique approach to programming DSNs.

12

Chapter 3. Methodology Chapter 3 explains this project’s approach to programming a DSN.

The EnviroTrack project is an object-based approach to DSNs. This approach allows users to view a DSN as a composition of various objects. Some examples of objects include people, vehicles, animals, or natural phenomenon such as fires. Users interact with DSNs by specifying how various objects should be detected and monitored. Using the EnviroTrack paradigm, an object in a DSN is detected by a set of conditions. A condition is a particular state of the environment that a sensor node in a DSN can identify. Examples of conditions include light intensity, magnetic field, temperature, and motion. Once an object is detected by the DSN, a user can then measure and monitor its various attributes. An illustrative example follows that will be used to explain the EnviroTrack methodology throughout this chapter: Suppose a user wishes to track a tank within the environment. The initial step is for the user to enumerate how the DSN should detect the presence of a tank. This might be accomplished by the combination of the following hypothetical conditions listed in Figure 1. Condition 1: Sound of greater than 30 decibels Condition 2: Velocity between 20.3 and 40.7 miles per hour Condition 3: A magnetic field Condition 4: Temperature between 90° and 100° Fahrenheit Figure 1: Example Tank Conditions

Next, the user will specify the attributes of the tank that he wishes to monitor once the DSN detects it based on the above criteria. Figure 2 illustrates three possible tank attributes.

13

Attribute 1: Magnetic field Attribute 2: Light intensity Attribute 3: Noise level Figure 2: Example Tank Attributes

The author’s EnviroTrack GUI allows the user to specify the description of the tank in the manner explained above through a series of keyboard inputs and mouse clicks. Once the specification is complete, the user has the ability to save it as a file, open an existing file, or start a new file. These files contain the user’s inputs from the GUI, and are then read by another application that translates them into code that is downloaded onto the sensor nodes.

3.1 Levels of Abstraction The first step in the creation of the GUI was to transform the details of the objectbased approach into code. The C# programming language was chosen because of the author’s familiarity with it, and its ability to create graphical interfaces in a straightforward manner. From this point forward, all C# reserved words that appear in the text are denoted using this typeface. Five main structures were created using the C# class construct. Each of these structures represents an abstraction of an important entity

in the EnviroTrack paradigm. They are named: Condition, Attribute, Method, Object, and Project.

3.2 Condition A condition is a state of the environment that a sensor node can detect and measure. A user specifies one or more conditions to tell the DSN how he wishes to

14

detect the existence of the desired object within the environment. A condition is represented in the code using the class construct named Condition. A Condition is composed of the private String members called: name, upper_limit, lower_limit, unit, description, data type, and method. The name is the name of the condition, and the upper_limit and lower_limit fields specify the upper and lower bounds of the measured condition. The unit field describes the unit of measure for the condition, and the description field explains what the condition is. The data type field indicates how precisely the condition is measured. The three possible data types are: Boolean, integer, and float. Boolean instructs the DSN to detect the lowest possible reading of the condition that a sensor node can measure. Integer means that the upper_limit and lower_limit fields must be specified as integers, while float means that the limit fields must be specified using floating point numbers. Finally, the method field names the method implementation file of the condition, and is further explained in section 3.5. The Condition class also contains various member functions that primarily get and set the various private String members. Figure 3 illustrates how the four conditions specified at the beginning of this chapter would be defined. (Note: in condition 1 and condition 3, a _ appears for the upper_limit field. This indicates no bound for the upper limit.)

15

Condition 2

Condition 1 name description unit upper_limit lower_limit datatype method

Sound Detects noise decibel _ 30 integer Sound method

Condition 3 name description unit upper_limit lower_limit datatype method

Magnometer Detects magnetic field Tesla _ 0 Boolean Magnometer method

Velocity Detects movement mph 40.1 20.3 float Velocity method

name description unit upper_limit lower_limit datatype method

Condition 4 name description unit upper_limit lower_limit datatype method

Temperature Detects temperature Fahrenheit 100 90 integer Temperature method

Figure 3: Tank Conditions Defined

3.3 Attribute An attribute represents what the user wishes to measure from an object. However, an attribute does not necessarily have to be a condition that identified the presence of the object. In the code, the Attribute class represents an attribute, and consists of a Condition, two private String members called name and aggregation function, and various member functions that modify the two members. An aggregation function instructs the DSN how to combine sensor readings from the various nodes detecting the object. The current list of aggregation functions includes: min, max, mode, mean, median, and sum. For the first attribute in Figure 4, the user wishes to measure the average magnetic field readings of the sensor nodes detecting the tank’s magnetic field. All three of the tank’s attributes are shown in Figure 4.

16

Attribute 1

Attribute 2

Magnetic Field name Magnometer Condition Aggregation Function Mean

Light Intensity name Light Condition Aggregation Function Max

Attribute 3 name Condition Aggregation Function

Noise Level Sound Mean

Figure 4: Tank Attributes Defined

3.4 Collections Of the five main class structures created, all but Project was abstracted further through the creation of separate collection classes. These classes simply group like structures together in a single collection entity and contain various member functions to modify the collection. For example, the ConditionCollection class uses the C# built in ArrayList data structure to hold a set of Condition structures. Hence, an object in the

EnviroTrack paradigm contains a single instance of a ConditionCollection rather than multiple instances of individual Condition structures. The collection abstraction was performed to minimize the amount of code that would need to be changed if a design decision changed. For example, if the decision to implement a collection were changed to use a linked list, this change would not affect the code outside of the collection constructs.

3.5 Method Every Condition and Object class contains a Method. In the EnviroTrack paradigm, a method is file that contains the nesC code that implements an object or condition. nesC is code specifically designed to run on sensor nodes. In the GUI code, a 17

method is abstracted via a Method class, which is the encapsulation of various member functions that modify two private String members called name and path. The path points to the file containing the nesC code implementation of the Object or Condition. Figure 5 illustrates the methods for the chapter example. Sound Method name sound_file path C:\Libraries\Method Library\config

Magnometer Method name mag_file path C:\Libraries\Method Library\config

Velocity Method name velocity_file path C:\Libraries\Method Library\config

Tank Method name tank_obj path C:\Libraries\Object Library\config

Figure 5: Tank Method Definitions

3.6 Object An object is an abstraction of an actual entity that the user wishes to monitor within the environment. The tank is an object in the chapter example. The Object class construct was created to represent an object. An Object consists of a ConditionCollection, AttributeCollection, Method, MethodCollection, and a private String member called name. ConditionCollection represents the group of conditions

that the user defined to detect the presence of the object, and AttributeCollection represents the object’s group of attributes that the user wishes to monitor. Method represents the file containing the nesC implementation of the object, and the MethodCollection is a group of optional methods that represent additional implementation files. The organization of the tank object is seen in Figure 6.

18

Name Tank

Condition Collection Condition 1 Condition 2 Condition 3 Condition 4

Attribute Collection Main Method Optional Methods Attribute 1 Tank Method None Attribute 2 Attribute 3 Figure 6: Tank Definition

3.7 Project The Project class is the highest level of abstraction of the code hierarchy. It is composed of a name, a ConditionCollection, and an ObjectCollection. The ConditionCollection serves as the library of conditions that the user selects from to create detection conditions and measurement attributes. This library of conditions is listed as the current condition library in the GUI. A user is able to create, delete, and edit objects within the current project by accessing the Project’s member functions to modify the ObjectCollection. The tank object in the chapter example might be part of a project that is intended for military applications. Figure 7 illustrates a hypothetical military application project. Name Object Collection Condition Collection Military Application Tank Light Human Noise Car Magnetic Field Fire Temperature Motion Figure 7: Project

3.8 File Directory Structure The EnviroTrack file directory structure is divided into two main branches. One branch contains information pertaining to projects named ‘Projects’, while the other is named ‘Libraries’, and holds library information. The ‘Projects’ folder contains folders

19

representing different projects created by the GUI. Within each of these folders are two folders named ‘config’ and ‘src’. All of the folders in the entire file directory structure labeled ‘config’ include the text files produced by the GUI, while all of the ‘src’ folders contain the nesC code implementation files of the corresponding GUI text files. A sample project file produced by the GUI can be found in Appendix B. The second main branch of the file structure contains the library files. This branch is split into two branches with one containing the condition library files and the other the attribute library files. The condition library branch holds folders representing different hardware platforms. The main hardware platform currently being used is the Mica Mote developed at UC Berkeley; each hardware platform folder contains ‘config’ and ‘src’ folders. Figure 8 is a graphical representation of the EnviroTrack file directory structure tree.

20

Figure 8: EnviroTrack File Directory Structure

21

Chapter 4. Design Decisions The design decisions made during the development of the GUI primarily consisted of visual layout decisions and appearance modifications. These decisions included implementing a tabbed interface, minimizing the amount of information appearing on the screen, and modifying the look of the GUI components.

4.1 Tabbed Interface The prominent feature of the GUI design is the tabbed interface. This interface gives the user the ability to easily change the information observed on the screen. The user accesses the tabbed interface while editing an object. Currently, there are three tabs in the GUI. Each tab represents the different parts of an object. Since an object is made up of detection conditions, measurement attributes, and method implementations, a tabbed interface is an intuitive way of separating each of these concerns while allowing the user to easily switch among them by bringing the current tab to the forefront of the screen. The current tab displays the part of the object that the user is editing and hides the other aspects, thus allowing the user to focus on one particular task. The tabbed interface also makes it easy for future developers to add more tabs to the design as necessary without interfering with the existing ones. Screen shots of the interface are included in Appendix A.

4.2 Minimizing Screen Clutter One of the earliest suggestions made by professor Abdelzaher was to minimize what was being shown on the interface. More specifically, there was an emphasis placed on only showing the necessary text boxes, buttons, and labels for the current action. This problem was resolved by utilizing the Visible member function for each of the

22

structures of the GUI. Prominent examples of this approach include hiding the left-most panel of information containing the current condition library list box, the unit, and description group box when the user clicks on the method implementation tab. This occurs because when utilizing this tab, the user should not be concerned with the current condition library. Minimizing screen clutter also aided in error checking. For example, whenever a user selects an item from any list box in the interface, the option to add another item to the collection disappears. In the early stages of development, this was a problem because the user could click on an item and attempt to add another at the same time. Now when the user selects an item, he is given the option to delete, edit, or cancel the selection. This minimizes the confusion that the user experiences.

4.3 GUI Components The sizes of the textboxes and labels were adjusted to maximize the space they used in the GUI to increase visibility. The Form Designer view in Visual Studio allows for easy resizing of any entity in the GUI, so adjusting this aspect should be easy for future generations of the current design. The font type for the textboxes and labels was left as the default Arial setting because it is a plain typeface and is easy to read. The shortcut toolbar was added to mirror the common interface used by many applications that run on the Windows operating system, because most users are familiar with using one. It also decreases the number of mouse clicks it takes to open, save, or create a new project file. Other than the standard gray, white, and black colors that are set as defaults by Visual Studio, two other colors were used to enhance the interface. All of the

23

backgrounds of the add buttons were colored green, and all of the delete buttons were similarly colored red. This was done because it was assumed that users associate the color green to confirm an action and red to cancel an action. However, for colorblind users the words ‘Add’ and ‘Delete’ still appear on the buttons. On the introduction startup screen the EnviroTrack logo appears to enhance the application’s appearance. The drop-down style of list box was chosen for when users are prompted to select a data type for a condition. The possible choices for a data type are integer, float, or Boolean. Since a condition must include a data type and the number of choices is small, the drop down list box was chosen because it forces a selection from the user, but does not require the user to type an input. Hence, this decision reduces the amount of user input error checking needed. The other type of list box used in the design was for collections. This style simply shows a list of the collection. A mouse click on any of these list boxes produces an action. For example, if a user clicks on one of the entries of the current object list box, four buttons appear that enable the user to delete, cancel, rename, or edit the current selection. All of the other list boxes in the design hide and make certain GUI components visible in a similar fashion. This type of list box also grows dynamically as new entries are added, which made it an appealing choice for this application. When the number of entries grows too large to fit the size of the list box, a slider bar on the right side of the list box automatically appears, allowing the user to scroll through the entire list. Balloon tooltips were added to the GUI to help explain the functionality of certain buttons, textboxes, and list boxes. A balloon tooltip is a text note that appears when the

24

user hovers the mouse cursor over certain buttons, list boxes, and text inputs within the GUI. For example, when the mouse cursor is placed over the leftmost icon in the main toolbar, a yellow balloon tooltip appears that reads: “New Project”. This informs the user that a new project will start if the icon is clicked. The Balloon Tooltips are intended for new users that are unsure of the action of a particular button or input for textboxes.

4.4 Edit Condition Library Window The edit condition library option opens a new, separate window inside the application when the ‘change path’ option is selected in the main window. This was done because editing a condition library is an action that is different from creating or editing a project. The window enables a user to open, save, and create condition libraries to use in projects. When creating new libraries, the user inputs all of the features of a condition, which include a name, unit, data type, and description. Once all of the inputs are checked for correct semantics, the user can then add it to the current condition library collection. If the user clicks on one of the entries of the list, he is able to edit or delete any one of the conditions. A default condition library is set for all new projects in the main GUI window, but the user can change this and use any condition library created using the ‘change path’ option.

25

Chapter 5. Conclusion and Evaluation This section details the operation of the GUI and evaluates the current design and functionality.

Upon inspection, some parts of the current design could have been simplified. One of the major problems encountered in the early development stages was ensuring that all of the correct text boxes, labels, and buttons were appearing at the right time. One of the appealing features of the current design is that it prompts the user to save the current project if it has been modified before continuing to another action such as closing, opening, or creating a project. This prevents the user from accidentally losing any unsaved changes.

5.1 Detection Conditions Tab There are several restrictions placed on what a user can define as the condition’s name. A name cannot consist of the null string, input containing all white spaces, an entry already contained in the current detection condition list, or any of the characters - , ~ | +. The last restriction is a result of how the GUI reads and writes files and is explained in more detail in Appendix B. All of the restrictions are enforced by the error checking performed by the GUI code. The three possible data types for a condition are integer, float, and Boolean. If the data type is set as Boolean, the upper and lower limits are set to the null value, and indicate that the DSN should detect the condition for all values greater than zero. An integer or float data type indicates the condition must have a specified upper or lower limit. For limit inputs, the current implementation checks for correct input by ensuring that the value for the upper limit is larger than the lower limit. 26

A condition cannot be added to the list of current conditions unless a condition has been selected from the current library and the limit inputs are semantically correct. On this particular tab there is some repetition of code. When the current condition list box is clicked on, the user’s attention is directed to the right of the list box in which the selected current condition’s upper and lower limits and data type are shown. The user is able to edit the selected condition, but this information could have been shown on the left side, which displays essentially the same information for new inputs.

5.2 Measurement Attribute Tab The measurement attribute tab requires three inputs from the user. The first is a name for the current attribute. The same restrictions are placed on this input as the name input for a condition in the previous section. The last two required user inputs are the selection of a condition from the current condition library and a function from the aggregation library. Once all of the aforementioned inputs are given, the user can then add the described attribute to the current attribute collection by clicking on the ‘Create’ button. If the user clicks on one of the entries in the current attribute list box, he is given the option to edit the name, condition, or aggregation function. He can then save these changes, cancel the selection, or delete the current selection.

5.3 Method Tab The method tab requests that the user input a main method name and path name. The GUI must contain these inputs in order for the user to proceed adding additional methods. This is because an object must contain a main method implementation, but

27

other method files are optional. The additional methods section appears when the ‘Include Other Methods’ checkbox is checked and disappears when it is unchecked. Once checked, two additional inputs for a name and data path appear as well as a list box containing the current list of additional methods. Again, the same restrictions are placed on these text inputs as in the rest of the GUI. A button also appears that allows the user to add the method with name and path specified by the text boxes to the current collection of methods. If the additional methods list box is clicked, the entry’s name and path appear in the textboxes, and the user is given the option to edit these entries, cancel the selection, or delete the current selection. Once all of the aspects of the current object are completely specified, the user can save or cancel the changes and continue editing the rest of the object collection within the project.

5.4 Error Checking and Testing The first type of error checking performed on the GUI was for incorrect input. This primarily consisted of checking for valid inputs for textboxes as explained in the above sections. The majority of the error checking completed was for correct event sequences. This entailed testing the various actions that a user could execute within the GUI. Due to the large number of possible test cases, the paths most likely taken, such as opening and editing existing projects, were tested more thoroughly than others. The four testers of the GUI are all part of the current EnviroTrack team, and the amount of testing performed on the application was limited due to time constraints. Since the EnviroTrack team is familiar with the purpose of the GUI and saw repeated demonstrations of its evolving functionality over the development period, it was unable

28

to test the most current version with a new perspective. Therefore, it would have been more useful to have other users besides the EnviroTrack team test the application and provide feedback. It would also have been helpful to observe users during their first time using the latest version of the application to see the difficulties that they were experiencing, so that changes could be made to decrease confusion.

5.5 Section 508 Standards The author’s EnviroTrack GUI project raises an important social issue pertaining to software use and accessibility, and an attempt was made to adhere to the 508 Law. The following is a summary of the 508 Law (Section 508 Standards):

“In 1998, Congress amended the Rehabilitation Act to require Federal agencies to make their electronic and information technology accessible to people with disabilities. Inaccessible technology interferes with an individual's ability to obtain and use information quickly and easily. Section 508 was enacted to eliminate barriers in information technology, to make available new opportunities for people with disabilities, and to encourage development of technologies that will help achieve these goals”.

Section 1194.21 discusses software applications. The current software has conformed to Part (b) which states that “the application shall not disrupt or disable accessibility features of the operating system”. Part (c) states that “the focus control of the application be well-defined enough to allow assistive technology to track the focus change”. The present design of a tabbed-interface that only shows a small amount of data on focus changes attempts to comply with this requirement. The software also obeys the requirement of part (k), which states that “flashing and blinking text will not be used”. Although it was not confirmed, the GUI attempts to meet the terms of Section 1194.31

29

part (b), which states that “operation of the software does not require eyesight greater than 20/70”. The author attempted to design the interface using large fonts and controls.

5.6 Evaluation of Project Goals The current GUI design successfully meets two of the three proposed goals outlined in the project proposal. It allows for the creation of files representing objects that will be monitored with an environment, and uses an object-oriented programming approach to abstract the details of an object. The third proposed goal deals with the formation of test cases to measure the correct functionality of the design. Formal test cases were not constructed. Instead, the GUI was tested by the EnviroTrack team through successive trial runs. Due to the scope of the project, it was not feasible to develop an exhaustive list of possible test cases that would evaluate all possible sequences of events. As an alternative, the majority of the trial runs were devoted to the most frequently used features of the software.

30

Chapter 6. Recommendations There are four main areas of recommendation for the current design. Three include improvements to the current design while the fourth deals with future generations of DSN GUI application designs.

6.1 Appearance One recommendation is to find a way to make the buttons represent the actions that they accomplish. For example, the add buttons might be replaced by the + symbol and delete buttons with the - symbol. It would also be useful to replace the text representation of conditions in the library with icons. These changes would add to the graphical look of the interface and minimize the amount of text that appears on the screen. For example, a condition representing light whose text reads ‘light’ might be replaced by a light bulb icon. For textboxes, it might be useful to highlight the one the user is currently typing in by coloring the background light yellow. This might help users with low visibility see which textbox they are currently working in and better track focus changes.

6.2 Additional Features Another recommendation is to add additional elements to the current design. One idea might be to add a help section that would list common problems and solutions. The help section would enable the user to search for certain key words, and read a description of key terms. The current application might also be bundled with an instructional video or a series of screen captures that would step the user through the process of using the

31

GUI. In addition, a project wizard application might be added that would guide the user through the creation of a simple project. In the current implementation, the Edit Condition Library Window save button functions as a ‘save as ‘rather than a ‘save’. A ‘save as’ function requires that the user choose a location to save the current file all of the time. An addition might be another save button that saves the file to its current location with no prompt. The same addition could be made in the main GUI window. Another feature that could be added is an auto recovery feature exhibited by many of the Microsoft Office applications. This feature would be enhanced by an auto-save feature that would periodically save a temporary file in the background of the current state of a project. If the application closes due to a power failure or error, the current project would not be entirely lost, and the user could return to the version that was last auto-saved by the system. A static icon window could be added to the current design that would summarize the content of the current project in a graphical manner. Each object, detection condition, and measurement attribute would have an icon associated with it. This window would allow a user to scroll through the current objects in the project and view each object represented by graphical icons. Lastly, a file parser could be implemented that would check the semantics of the file structure. The GUI currently operates correctly when reading and writing project and condition files. However, if a file is modified outside of the GUI, it does not possess sufficient error checking to reject a malformed file. The proposed parser might also have the ability to validate the correct format of a project file, and convert that file into text

32

easily interpreted by the compiler, thus enabling project files to be efficiently converted into nesC code and downloaded onto the DSN.

6.3 Code Enhancements To minimize the amount of code repetition, the group box structure in the Visual Studio Form Designer could have been used in more places. The group box allows the developer to group related textboxes, buttons, and labels together. So, instead of having to individually specify the Visible attribute for each component based on the user’s action, the Visible attribute for the group box containing related components could have been used. For example, when an item from the object list box is selected, four buttons appear. These four buttons exhibit the same appearance behavior when a subsequent action is taken, and could have been placed in a group box. This type of change could be made throughout the code to decrease the amount of redundant code written and increase code readability and understandability. Component design name formats in the GUI could have also been better standardized. In some cases, these names are too long and inconsistent. For example, some text box design names are spelled ‘textbox’ while others are spelled ‘textBox’. Although the Visual Studio Intellisense feature aids the programmer by listing a component’s members and functions once a period is typed after an instance, standardizing the component design name format would minimize the amount of time wasted switching between the design and code layout views to recheck design name formats while developing the application.

33

6.4 Future Work A new version of the GUI might be created. This version would allow users to drag and drop icons and files onto the interface to create a project. For example, to create the tank object described in chapter 3, a user employing the proposed new version of the GUI would see an interface containing groups of icons representing objects, conditions, and files. The user would not see a text listing of possible conditions; rather a group of icons would replace it. The ‘light’ condition might be replaced by an icon of a light bulb. Likewise, the ‘temperature’ condition might be replaced with a thermometer icon. If the user wanted to detect the tank based on these conditions, he would click and drag on the light bulb and thermometer icons and drop them onto the interface. The interface would reflect these changes and show a picture of the tank and the condition icons next to it. The current version of the GUI successfully meets the proposed goal of abstracting low level programming details because the user does not interact with the nesC code. However, it still contains some text that the user has to type in. A more abstract application would minimize the amount of text seen and inputted by the user while maximizing the graphics used. An interface utilizing more graphics would appeal to the common user because of the visual simplicity that graphics add to a design. The uses for distributed sensor networks continue to grow as the technology to support their deployment evolves. The supporting technology will have to continue to abstract the technical details of DSNs so as to allow the common user to easily make full use of their capabilities. However, as these networks become more widespread, serious social and ethical concerns such as information privacy will have to be addressed.

34

Bibliography Abelson, H., Allen, D., Coore, D., Hanson, C., Raugh, E., Sussman, G., Weiss, R. (2000). Amorphous. Communications of the ACM, Vol. 43, No. 5. Abrach, H., Bhatti, S., Carlson, J., Dai, H., Rose, J., Sheth, A., et al. (2003). MANTIS: System Support for MultimodAl NeTworks of In-situ Sensors. 2nd ACM International Workshop on Wireless Sensor Networks and Applications (WSNA). Beaver, J., Chrysanthis, P., Labrinidis, A., Sharaf, M. TiNA: A Scheme for Temporal Coherency-Aware in-Network Aggregation. MobiDE’03, San Diego, California, USA. Behren, R., Brewer, E., Culler, D., Gay, D., Levis, P., Welsh, M. (2003). The nesC Language: A Holistic Approach to Networked Embedded Systems. PLDI’03, San Diego, California, USA. Boulis, A., Han, C., Srivastava, M. (2003). Design and Implementation of a Framework for Programmable and Efficient Sensor Networks. MobiSys’03, San Francisco, California, USA. Cheong, E., Liu, J. (2004). galsC: A Language for Event-Driven Embedded Systems. Memorandum No. UCB/ERL M04/7, Electronics Research Laboratory, College of Engineering, University of California, Berkeley. Culler, D., & Levis, P. Maté: A Tiny Virtual Machine for Sensor Networks. Demers, A., Gehrke, J., Rajaraman, R., Trigoni, N., Yao, Y. (2003). The Cougar Project: A Work In Progress Report. SIGMOD Record, Vol. 32, No. 4. Evans, D. (2000). Programming the Swarm. University of Virginia, Department of Computer Science, Charlottesville, Virginia, USA. Franklin, M., Hellerstein, J., Hong, W., Madden, S. The Design of an Acquisitional Query Processor For Sensor Networks. Hellerstein, J., Hong W., Madden, S., Stanek K. Beyond Average: Toward Sophisticated Sensing with Queries. Intel Corporation. Intel Research Berkeley Collaborating to Change the World. (2004). Lederer, S., Dey, A., & Mankoff, J. (2002). Everyday Privacy in Ubiquitous Computing Environments. Privacy In Ubicomp'2002: Workshop on Socially-informed Design of Privacy-enhancing Solutions in Ubiquitous Computing, Sweden, 1-5.

35

Li, S., Lin, Y., Son, S., Stankovic, J., Wei, Y. (2004). Event Detection Services Using Data Service Middleware in Distributed Sensor Networks. Telecommunication Systems, No. 26, 2-4 & 351-368. Römer, K. Programming Paradigms and Middleware for Sensor Networks. Institute for Pervasive Computing, ETH Zurich. Section 508 Standards. Retrieved October 12, 2004, from http://www.section508.gov/index.cfm?FuseAction=Content&ID=12 TinyDB: A Declarative Database for Sensor Networks. http://telegraph.cs.berkeley.edu/tinydb/overview.html. Accessed 10 February 2005. Treese, W. (2004, June). Putting it Together, pp. 15-17.

36

Appendix A. GUI Screen Shots A.1 Introduction Main Screen

37

A.2 Detection Conditions Tab

A.3 Measurement Attributes Tab

38

A.4 Attached Methods Tab

A.5 Edit Condition Library Window

39

B. Sample GUI Output Files B.1 Project File *** Project File *** Car|Light-Lumens-_-_-Boolean,sound-decibel-22-33-Integer|brightness-MaxLight|Car method+C:Libraries\Method Library\method1.txt~ Person|sound-decibel-1-2-Integer,Velocity-m/s-_-_-Boolean|Noise level-Meansound|person file+C:Libraries\Method Library\method2.txt~French human method+C:Libraries\Method Library\method3.txt

All project files begin with the heading as seen above followed by a carriage return. This allows the GUI to determine if it is in fact reading the correct file type. Each object is listed one per line followed by a carriage return, but the margin limitations in the above text prevent this from appearing correctly above. Each object is broken up as follows: name|condition collection|attribute collection|main method name+main method path~additional method collection. (Note: the … enumeration below represents any entry between 1 and n and is not part of file’s semantics). Assuming that all collections can have from 1 up to n entries, the condition collection is broken up as follows: name1-unit1-upper limit1-lower limit1data type1,… namen-unitn-upper limitn-lower limitn-data typen If a condition’s data type is Boolean then it possesses no upper or lower limit. This is denoted using _ Assuming that all collections can have from 1 up to n entries, the attribute collection is broken up as follows: name1-aggregation function1-condition name1~… namen-aggregation functionn-condition namen Assuming that all collections can have from 1 up to n entries, the additional method collection is broken up as follows: name1+path1~ … namen+pathn

40

B.2 Condition File *** Condition Library *** Light-Lumens-Detect Light-C:\light file-I detect light-Boolean Velocity-m/s-Detect Velocity-C:\velocity file-I detect velocity-Boolean Magnometer-Teslas-Detect magnet-C:\magnet file-I detect a magnetic fieldInteger weight-pounds-weight file -weight path-i measure weight-Float sound-decibel-sound file-sound path-i detect noise-Integer

All condition files begin with the heading as seen above followed by a carriage return. This allows the GUI to determine if it is in fact reading the correct file type. Each condition is listed one per line followed by a carriage return, and is broken up as follows: name-unit-description-path-data type. Above is the default condition library file that the GUI uses. As seen in sections B.1 and B.2, each field is divided by a special character. These special characters are ~ , + | _ As such, no text inputs from the GUI may contain any of the special characters. This is because the GUI parses the files using the split function, which separates a text string based on a given character. Allowing any of the special characters as GUI inputs would render it unable to read the files correctly.

B.3 Aggregation Method File *** Aggregation Methods Library *** Max Mean Median Mode Min Sum

All aggregation method files begin with the heading as seen above followed by a carriage return. This allows the GUI to determine if it is in fact reading the correct file type. The aggregation method names follow this initial line, one per line, followed by a carriage return. Above is the default aggregation library file that the GUI uses.

41

UNDERGRADUATE THESIS PROJECT PROPOSAL School of Engineering and Applied Science University of Virginia

Developing A Graphical User Interface For A Distributed Sensor Network

Submitted by Adam Lee Computer Engineering

STS 401 Section 10 (3:30 p.m.) October 27, 2004

On my honor as a University student, on this assignment I have neither given nor received unauthorized aid as defined by the Honor Guidelines for Papers in Science, Technology, and Society Courses. Signed ___________________________________

Approved

Date Technical Advisor – Tarek Abdelzaher

Approved

Date Science, Technology, and Society Advisor – Brian Pfaffenberger

Table of Contents ABSTRACT.......................................................................................................................3 I. INTRODUCTION .........................................................................................................4 II. RATIONALE AND OBJECTIVES ...........................................................................6 A. Rationale ........................................................................................................ 6 B. Statement of Objectives ................................................................................. 7 III. ANALYSIS OF SOCIAL AND ETHICAL CONTEXTS.......................................8 IV. REVIEW OF TECHNICAL LITERATURE ........................................................11 A. Current State of Knowledge......................................................................... 11 B. Problems....................................................................................................... 14 C. Current and Future Applications .................................................................. 19 V. STATEMENT OF PROJECT ACTIVITIES..........................................................20 A. Activities ...................................................................................................... 20 B. Schedule ....................................................................................................... 22 C. Personnel ...................................................................................................... 23 D. Resources ..................................................................................................... 23 VI. EXPECTED OUTCOMES ...................................................................................... 23 VII. BIBLIOGRAPHY ...................................................................................................25 VIII. REQUIRED APPENDICES.................................................................................29 A. Budget and Equipment Checklist................................................................. 29 B. Biographical Sketch of Student.................................................................... 29 C. Preliminary Outline of Thesis ...................................................................... 29

2

Abstract From monitoring wildlife habitats and disaster areas to intrusion detection and surveillance, the need for acquiring data about a physical environment has never been greater. One method of tracking an environment that is gaining popularity is the distributed sensor network (Abdelzaher, Blum, & Cao et al., 2004). A distributed sensor network consists of numerous nodes that wirelessly communicate with one another and a remote basestation (Abdelzaher, Hou, & Lu et al., 2003). When applied to monitor an environment, the network will “(a) monitor space, (b) monitor things, and (c) monitor the interactions of things within each other and the encompassing space” (Culler, Estrin, & Srivastava, 2004). One of the greatest obstacles in deploying distributed sensor networks is that there exists a lack of distributed software and programming support for them (Abdelzaher & Blum et al., 2004). Led by Professor Tarek Abdelzaher, the EnviroSuite project attempts to create a framework for environmentally immersive programming. It addresses the need to advance software development for sensor networks. Presently, users interact with sensor networks via a text-based software interface, and must possess too much knowledge about the underlying details of node interaction within the network. The author’s contribution to the project will attempt to eliminate the text-based interface through the development of a Graphical User Interface (GUI). The GUI will enable a user to easily generate files that represent objects to be monitored within the environment. The project will take place in the University of Virginia computing labs using the Microsoft Visual Studio software. Production of the GUI began in midSeptember, 2004 and the projected completion date is March, 2005.

3

I. Introduction Many future applications will depend on distributed sensor networks. Some of these applications include: wildlife habitat monitoring, homeland security, surveillance in airports and public buildings, military systems and applications, urban terrain mapping, disaster management, chemical or biological detection, and traffic congestion control. A distributed sensor network consists of a collection of nodes dispersed throughout the environment. Once deployed, the network will collect various forms of data such as light intensity, noise, and magnetometer readings. Presently, there are numerous problems associated with distributed sensor networks that restrict their use and application. In many scenarios, nodes in a distributed sensor network will be deployed in the environment and will be left there indefinitely. Hence, network architects face the challenge of creating nodes that are disposable yet possess a life span long enough to accomplish the task. The physical constraints of a node add to this challenge. Some of the problems include: resource consumption, signal and information processing, physical durability and resistance to fluctuating environmental conditions, and real-time processing constraints. There are also issues of network security and privacy. As a result of the constraints imposed on the nodes, they are only equipped with the necessary hardware specific to the application. Hence, software applications reflect the application-specific nature of the systems. Existing frameworks are designed on a very low level and contain the details of node interaction and network management. Consequently, there is a need for a system that encapsulates the underlying details of the network and allows the user to only describe the overall network behavior. The proposed system would in turn convert that information into node-level behavior. The EnviroSuite project attempts to accomplish this goal through the introduction of an object-based

4

programming framework. Objects in EnviroSuite are representations of elements in the external environment. A user can specify the conditions that identity a particular object, and the object’s measurable attributes. In addition, the objects encapsulate the aggregate state of the nodes that they represent. The author’s role in the EnviroSuite project is to create a graphical user interface that enables the user to create files that represent the various objects being monitored within the environment. The files will then be used by other applications in the project and will eventually be compiled by the underlying library, which is implemented in nesC on the TinyOS.

5

II. Rationale and Objectives A. Rationale Monitoring an environment can be cumbersome and expensive (Abdelzaher et al., 2003). A distributed sensor network attempts to offer an inexpensive, low-power consuming way of dealing with this problem. A robust distributed sensor network will have several characteristics. They include: real-time communication and coordination, low energy use, and self-organization (Bass, 2000). A distributed sensor network has many applications. One use of this technology has serious military and defense implications. For example, during a wartime situation a commander may want to scout a presumed enemy territory before advancing. Before making a decision on whether to deploy troops to the area in question, an airplane could attempt to fly over the zone and deploy sensors. From a remote location the commander could monitor the environment, checking for the existence of enemy troops and equipment. He would also be able to establish safe and dangerous areas by maintaining previously established networks. Another application of this technology would be monitoring for safety reasons. There are two main categories. First, sensor networks could be deployed to monitor critical systems that include hazardous materials such as biological, chemical, or radiological systems (Abdelzaher et al., 2003). Secondly, they could be used to bolster the nation’s homeland security efforts. Bridges, airports, and public buildings could be equipped with sensor networks in attempt to detect suspicious activities (Abdelzaher et al., 2003).

6

A third application for sensor networks is using them in rescue situations. Networks could be deployed in areas hit by natural disasters in attempt to monitor the environment for possible survivors. Lastly, distributed sensor networks might be used by scientists to study sensitive natural habitats. Presently, interacting with sensor networks is low-level and is difficult to use and understand (Abdelzaher et al., 2004). The EnviroSuite project attempts to remedy this problem by creating an object-based middleware abstraction of a distributed sensor network (Abdelzaher et al., 2004). It will raise the level of abstraction by providing a user-friendly GUI that makes it easier for the user to track the physical environment. At the present time the user needs to know too much about the internal workings of the system, such as interactions among individual nodes. The creation of a GUI will enable the user to create and describe his own objects that will be monitored within the network. The software should provide a conceptual view of system for which the user can depend on the software to translate high-level commands into low-level communication activities on individual sensor nodes (Abdelzaher et al., 2003).

B. Statement of Objectives Overall this project attempts to accomplish the following: •

Develop a GUI that allows for the creation of objects to be monitored within an environment.



Ensure that the interface of the GUI is user-friendly and robust by developing test cases.

7



Ensure that the software correctly abstracts the details and complexity of the objects by utilizing an object oriented programming approach.

III. Analysis of Social and Ethical Contexts A distributed sensor network of the future may be invisible to the untrained eye. Therefore, one might unknowingly be under constant surveillance. Ownership and use of data collected from sensor networks is an important issue. If sensor networks become commonplace in the United States, it will be interesting to see how courts use and interpret data obtained as legal evidence in court cases. Surveillance of any nature includes the issues of security and privacy. The designer of a sensor network will have to determine how easy it is for an outsider to disrupt the network, create a Denial of Service (DoS) attack, or add bogus sensors to the network. When deciding on where to place the network, the designer will have to also take people’s privacy into consideration. Lederer, Dey, and Mankoff (2002) of the University of California, Berkeley’s User Interface Research Group are developing a method for handling sensor networks and privacy concerns. They introduce the idea of developing different faces, or privacy preferences for individuals based on situation. Therefore, an individual can restrict the type and amount of data collected by a sensor network on a situational basis. Sensor networks must be secure enough to resist DoS attacks and physical tampering. Figure 1 shows several DoS attacks and network defenses (Wood & Stankovic, 2002).

8

Figure 1. Sensor network layers and denial-of-service defenses (Wood & Stankovic, 2002)

One way of countering physical tampering is to encase nodes in tamper-proof materials (Iyengar & Brooks, 2004). However, this solution might be very costly to implement and may only protect the node to a certain extent. An outsider may also destroy nodes or add his own nodes to intercept data or disrupt network functionality. The bogus nodes might be designed to drop data packets arbitrarily or alter them. This form of intrusion detection is currently handled by comparing the behavior of network nodes to statistical-anomaly analyses and known pattern and behavior templates (Bass, 2002). Low probability of node detection will ensure greater security. Nodes might be packaged in camouflaged material enabling them to better blend into the environment being monitored. The network may also be susceptible to outside interference and signal jamming. Jamming prevents nodes from exchanging data. Currently, jamming is countered by using spread-spectrum communication (Iyengar & Brooks, 2004). Jamming of a

9

particular section of the network can also be avoided by routing data around the affected area. Data privacy and protection is also a key issue. One way that data is presently protected in sensor networks is the use of cryptographic keys (Zachary, 2003). One problem with using cryptographic keys is that an attacker can replace network nodes in an attempt to extract the keys. Currently, keys are encrypted using Elliptic Curve Cryptography (ECC), which is being implemented in the TinyOS simulator (Zachary, 2003). ECC uses smaller key sizes than the RSA system, so it works well with sensors on constrained resources (Zachary, 2003). Encrypting network data packets, however, increases packet length and the amount of hardware needed to perform the encryption. However, The University of California’s TinySpec has shown that using software-only encryption methods only incurs an additional 10% in overhead (Iyengar & Brooks, 2004). This is significant because limiting the amount of hardware on a node is critical to keeping the cost low. The author’s contribution to the EnviroSuite project also raises an important ethical issue pertaining to software use and accessibility. The following is a summary of the 508 Law (Section 508 Standards): “In 1998, Congress amended the Rehabilitation Act to require Federal agencies to make their electronic and information technology accessible to people with disabilities. Inaccessible technology interferes with an individual's ability to obtain and use information quickly and easily. Section 508 was enacted to eliminate barriers in information technology, to make available new opportunities for people with disabilities, and to encourage development of technologies that will help achieve these goals”.

Section 1194.21 discusses software applications. The author’s software will conform to Part (b) which states that “the application shall not disrupt or disable accessibility features of the operating system”. Part (c) states that “the focus control of the application be well-defined enough to allow assistive technology to track the focus 10

change”. The author’s proposed design of a tabbed-interface that only shows a small amount of data on focus changes will attempt to comply with this requirement. The software will also obey the requirement of part (k) which states that “flashing and blinking text will not be used”. Part (g) of section 1194.25 states that color coding shall not be used to convey information. The software will consist of a neutral gray coloring scheme and white textboxes. The author will attempt to meet the terms of Section 1194.31 part (b) by designing the interface with large fonts and controls. This part states that “operation of the software does not require eyesight greater than 20/70”. By observing the various parts of Section 508 that pertain to software applications, the author hopes to abide by the Association for Computer Machinery Code of Conduct, which includes professional responsibilities (ACM Code of Conduct, 2004). More specifically, the author will “strive to achieve the highest quality, effectiveness and dignity in both the process and products of professional work” and “honor contracts, agreements, and assigned responsibilities” (ACM Code of Conduct, 2004).

IV. Review of Technical Literature A. Current State of Knowledge Jan Rabaey of the University of California at Berkeley started the PicoRadio program in 1999 (Callaway, 2004). The program sought to advance the development of ad hoc wireless networks and helped spawn the Smart Dust program. Dust Inc., a spinoff of the Smart Dust program is currently building minute sensors that can sense and communicate but are as small as a cubic millimeter (Hill, Horton, & Kling, et al., 2004). Another important program involved in the progression of wireless sensor networks was 11

MIT’s µAMPS program. Anantha Chandrakasan of MIT started the program, which emphasized the development of low power wireless sensor networks (Callaway, 2004). Low power consumption was also one of the main goals of the Spec node (Hill, et al., 2004). Designed by Jason Hill of the U.C. Berkeley, the Spec node is a single-chip node designed specifically for low-cost production and low-power operation. In order to reduce size and complexity, the Spec node was built so it would operate only with simple sensors and communicate over short distances. The prototype versions were produced in February 2003. When combined with a tiny battery, the Spec node is capable of periodically reporting its presence for years (Hill, et al., 2004). Hill was the author of the original open source operating system named the Tiny Microthreading Operating System (TinyOS) (Culler & Hong, 2004). TinyOS was designed to run on platforms with limited memory and CPU constraints (Hill, et al., 2004). It provides integration between wireless communication and network functions, and is responsible for power and sensor management, and routing data. TinyOS was used on the first commercial node called the Rene Mote (Culler, Hill, & Horton et al., 2002). Figure 2 illustrates various characteristics of the four different classes of sensor nodes (Hill, et al., 2004).

12

Figure 2. Typical operating characteristics of the four classes of sensor-network nodes (Hill, et al., 2004)

Several members of the current microsensor community include U.C. Berkeley, U.C. Los Angeles, Intel Research Labs, Robert Bosch Corporation, U.S. Air Force Research Labs, Crossbow Technology, Ember, and Sensoria (Culler & Hong, 2004). Sensoria deals with many aspects of wireless sensor network design, which include microelectromechanical system (MEMS) sensor and transceiver integration, signal processing architectures, and network protocol design. The group hopes to provide distributed network and Internet access to sensors, controls, and processors deeply embedded in equipment, facilities, and the environment (Chong & Kumar, 2003). Presently, the Center for Embedded Network Sensing (CENS) in Los Angeles, California focuses on environmental and habitat monitoring. CENS studies vegetation response to climate change, and conducts population studies on birds (Chong & Kumar, 2003). The System for the Vigilance of the Amazon (SIVAM) monitors drug trafficking

13

and air traffic control in the Amazon Basin (Chong & Kumar, 2003). This network is sponsored by the Brazilian government and consists of a network of sensors that use imagery and radar (Chong & Kumar, 2003).

B. Problems Nodes used in distributed sensor networks are made of a microprocessor, data storage, sensors, analog to digital converters, a data transceiver, controllers, and an energy resource (Culler & Hong, 2004). Ideally, nodes must be cheap to manufacture, disposable, and durable enough to withstand harsh and fluctuating environmental conditions. They also will tend to be application-specific. As a result, nodes will only carry the software and hardware necessary due to cost and size constraints (Culler et al., 2002). A distributed sensor network is composed any number of these nodes, all of which have capabilities of sensing, computing, and communication. Usually, a sensor node has a communication range less than 100 feet (Iyengar & Brooks, 2004). Sensor networks present significant challenges involving the use of large numbers of resourceconstrained nodes (Culler & Hong, 2004). Once deployed, those nodes are left unattended and are exposed to changing environmental conditions. Other issues include routing, power management, and long-term network performance. Powering the nodes in a sensor network is an important issue. Most applications require three to five years of battery life, and battery size is the greatest single size constraint for the sensor in many situations (Culler et al., 2002). Ferro Solutions has recently developed an energy harvester that can power a sensor with vibrations from its environment (Treese, 2004). Alternatively, nodes could be constructed to utilize solar

14

energy (Culler, Estrin, & Srivastava, 2004). One method of energy conservation is for the sensor to turn off the hardware when it is in an idle state. Network nodes are limited in computing power and communication capabilities because of their power sources are small and non-renewable. Signal and information processing is another problem inherent to sensor networks. Issues include how data is shared among nodes and how a node uses data obtained by its neighbors. Nodes must also have a way to associate data to tracking objects. Data association can be computationally expensive and require significant bandwidth for communication (Culler, et al., 2004). There are also physical obstacles that nodes must overcome. Obstructions such as buildings and trees will add to the attenuation that a signal experiences. Additionally, sensors that are on the nodes may change their electrical characteristics when subjected to varying environmental conditions (Culler, et al., 2004). Nodes in a network may be non-uniformly distributed throughout the sensing environment. As a result, it may be necessary for the nodes to exhibit different clustering capabilities to account for this problem (Abdelzaher, Hou, & Lou et al., 2003). Networks must also exhibit a self-configuration property (Chong & Kumar, 2003). That is, once deployed, the network administrator should not have to go through any installation procedures to establish the network (Culler et al., 2002). The question of network size is also an issue. Varying the size of the network provides tradeoffs between power usage, reliability, and latency. Once deployed, nodes will experience little to zero maintenance. As a result, the network must provide a certain level of fault tolerance. Nodes in the network will fail

15

unexpectedly and turn on and off intermittently to conserve power. Network topology will be dynamic as new nodes are added to replace old ones. Protocols must exist to handle unpredictable traffic patterns such as a large cluster of events within one area of the network and zero activity in another. They must also perform data reliability and integrity checks. A sensor network is under the constraint of real-time processing. Data obtained from the network may only be valid for a brief period and must reach the network administrator quickly and reliably. There is minimal storage or buffer capacity on a wireless node because of size and cost considerations. Because there might be a large amount of inbound and outbound data traffic, there must be a way for nodes sensing the same event to aggregate data and send that to the network administrator in a way that allows for fast and efficient data manipulation (Abdelzaher et al., 2003). Due to the aforementioned problems inherent to sensor networks, application programmers must design systems that include low level functionality of the nodes. This includes data routing time synchronization and data aggregation. As a result, human interaction with sensor networks is a problem. Users must consider the functions of single nodes within a network and understand the interactions among the nodes. They must know about how nodes read and aggregate sensing data and how to associate data with objects and events. Additionally, they must have an understanding of sensor network constructs such as regions, neighborhoods, and groups (Abdelzaher, He, & Luo, et al., 2004). Ideally, the programming environment should offer the user a conceptual view of the environment (Abdelzaher, Blum, & He et al., 2003). It should be left to the system to translate high level commands into activities on individual sensor nodes

16

(Abdelzaher et al., 2003). One method of addressing this issue is through a group-based abstraction. The three main entities involved in this programming paradigm are Harvard University, the Palo Alto Research Center (PARC), and The University of Virginia. Welsh and Mainland (2004) of Harvard University are currently attempting to simplify sensor network program application design. Their goal is to abstract the details of low-level node communication and data sharing through the introduction of abstract regions. An abstract region is a group of nodes that share a geographical relationship, and provides a way to represent spatial and logical relationships among them. Moreover, an abstract region hides the details of node data management, routing, and sharing from the user. Grouping nodes is an advantage over considering individual nodes because data sharing among them exploits locality of communication. For example, locality of communication can be characterized by a particular radio frequency used by the nodes within the specified geographical location. An abstract region also addresses the idea of contour mapping. Contour mapping involves determining the set of points that surround an area of interest. The area of interest is defined by the nodes within the abstract region that emit strong sensor readings of the same type. Chu, Liu, Reich, and Zhao (2003) at the PARC have developed a system of StateCentric programming. State-Centric programming involves distinguishing between the location, shape, and motion of objects in space and time. The programming paradigm deals with the sensing and controlling of these states through sequential state updates. One approach being considered is the elected leader system in which a node in a group serves as the main point for information-driven sensor querying. The programming model also introduces the idea of collaboration groups. Collaboration groups can consist

17

of physical groups of nodes or abstract software system components called agents. The agents contribute to the state updates, while a group encapsulates the scope and structure properties of the agents. The scope property allows the user to group nodes according to physical attributes being sensed rather than individual node addresses. As a result, scoping is essential in maintaining network scalability. A group’s structure defines each node’s role within the group. Like the scope property, the notion of roles also prevents the user from addressing the behavior of individual nodes. Groups can also be subdivided into geographically constrained groups, neighborhood groups, or acquaintance groups. The group types are flexible enough to be utilized in different situations. The current implementation of the state-centric paradigm is called Programming and Interaction Environment for Collaborated Embedded Systems (PIECES) and is programmed in a combination of Java and Matlab. The author is part of a team developing a programming framework called EnviroSuite. EnviroSuite introduces a concept called environmentally immersive programming (Abdelzaher et al., 2004). It is “an object-based programming system” (Abdelzaher et al., 2004) that allows the user to think directly of logical objects and representations of physical elements in the environment. The author’s contribution to the project will be the creation of a graphical user interface (GUI). The GUI will allow the user to create objects to be monitored within the environment by specifying object conditions and attributes. At the present time, the user must interact with a text-based application and must know about the syntax of forming objects, and how objects are created and compiled on a lower programming scale.

18

C. Current and Future Applications Distributed sensor networks have many applications. These include “ocean and wildlife monitoring, manufacturing machine performance monitoring, building safety and earthquake monitoring, and numerous military applications” (Perrig, Stankovic, & Wagner, 2004). Future applications include traffic monitoring, wildfires, building security, and water quality surveillance. According to (Chong & Kumar, 2003), sensors could be placed in sensitive machinery to detect abnormal vibrations. Hence, the sensor network would be able to give advance warning of imminent failure. In this scenario, sensors would also be used to conduct quality control tests for the machinery. Today, traffic monitoring is limited to a few high-trafficked areas monitored by expensive camera equipment. Red light cameras also exist in intersections to deter motorists from running red lights. Additionally, radio and television stations often fly helicopters over highways to conduct traffic reports. In the future, sensor networks might be placed at every street intersection, thus eliminating the high cost equipment used to monitor and police traffic. The networks would be able to determine a global or local picture of the traffic within a certain region rather than at just a few intersections. If traffic lights are able to communicate with these sensor networks, then traffic light timing could be adjusted in real-time to better accommodate the current traffic patterns. Another idea would be to imbed sensors in vehicles themselves. Vehicles would then be able to exchange traffic information with one another and ground sensors. Drivers would be notified of traffic jams, and in conjunction with a global positioning system, be offered an alternative route.

19

Distributed sensor networks have evolved over decades of work and technological improvement. There continues to be a need for developing solutions that will enable these networks to be practical, secure, and cost-effective. However, once these obstacles are overcome, the possibilities for sensor networks are endless. On the other hand, there are many social and ethical issues attached to the continuing development of this burgeoning technology.

V. Statement of Project Activities A. Activities 1. Become oriented with the project Read Professor Abdelzaher’s abstract on the EnviroSuite system. Meet with Professor Abdelzaher and the EnviroSuite team to obtain information on what has already been done on the project to date. Read previously released literature on the project to obtain background knowledge needed to contribute to the project. Obtain an understanding of my role in the project. This activity took about two weeks.

2. Requirements Capture Meet with Professor Abdelzaher to develop a requirements specification of the GUI. Determine the general layout and format of the GUI. Discuss GUI functionality. This activity took about two weeks.

3. Design an Evolutionary Prototype Create the draft user interface. The evolutionary prototype will be developed as functionality is added in increments. At each EnviroSuite meeting present the prototype to date and receive feedback on design and implementation strategies. Start with basic

20

and essential features and then add to the GUI’s capability. This is an ongoing activity that will last the duration of the development stage.

4. Design the Data Structures Design the classes that will be utilized in the user interface. These classes will implement the actions caused by the GUI. This will take approximately three weeks.

5. Integrate Design and Internal Data Structures Using the created classes, use them to incrementally add functionality to the interface. This is the main development stage that will take approximately eight weeks.

6. Regression Testing Test the GUI at each implementation stage to ensure that added functionality does not degrade the state of the system. Also make use of various use cases to continue testing the system. Continue to modify and maintain the software as necessary and continue with testing and debugging as time permits. This activity will take approximately eight weeks.

21

B. Schedule

22

C. Personnel Professor Tarek Abdelzaher: Professor Abdelzaher is the technical advisor. He provides the author with functionality requirements and suggestions for the development of the GUI. His research focuses on middleware, operating systems, and networking solutions for providing performance-guaranteed services in embedded systems and on the Internet. Meetings with professor Abdelzaher and the EnviroSuite team are scheduled to occur on a weekly basis. Professor Bryan Pfaffenberger: Professor Pfaffenberger is the STS advisor for the Fall Semester phase of this project. He provides feedback and suggestions for the written sections of the thesis project. Meetings with professor Pfaffenberger will be scheduled as needed. Ajay Kulhari and Liqian Luo: Ajay and Liqian are computer science graduate students at The University of Virginia. They are working on separate parts of the EnviroSuite Project but provide suggestions and advice on the functionality and design of the GUI at the weekly meetings.

D. Resources This project requires access to any PC with the Microsoft Visual Studio software.

VI. Expected Outcomes This project will yield a graphical user interface that will allow the user to generate text files representing objects to be monitored within the environment. It will

23

allow the user to save and open these files as well as edit them. The user will also be able to generate and edit the various condition libraries that describe the objects.

24

Bibliography Abdelzaher, T., Blum, B., Cao, Q., Chen, Y., Evans, D., George, J., et al. (2004). EnviroTrack: Towards an Environmental Computing Paradigm for Distributed Sensor Networks. Tokyo, Japan: IEEE International Conference on Distributed Computing Systems.

Abdelzaher, T., Blum, B., He, T., Lu, C., Son, S., Stankovic, J. (2003). A Communication Architecture and Programming Abstractions for Real-Time Embedded Sensor Networks. Providence, RI: Workshop on Data Distribution for Real-Time Systems (in conjunction with ICDCS).

Abdelzaher, T., He, T., Luo, L., Stankovic, J. (2004). EnviroSuite: An Environmentally Immersive Programming Framework for Sensor Networks.

Abdelzaher, T., Hou, J., Lu, C., Stankovic, J. (2003). Real-Time Communication and Coordination in Embedded Sensor Networks. Proceedings of the IEEE, Vol. 91, No. 7.

Association of Computer Machinery (ACM) Code of Conduct. Retrieved on October 12, 2004, from http://onlineethics.org/codes/ACMcode.html#comp

Bass, T. (2000). Intrusion Detection Systems and Multisensor Data Fusion. Communications of the ACM, Vol. 43, No. 4.

25

Callaway, E. (2004). Wireless Sensor Networks: Architectures and Protocols. Plantation, FL: Auerbach Publications.

Chong, C., Kumar, S. (2003). Sensor Networks: Evolution, Opportunities, and Challenges. Proceedings of the IEEE, Vol. 91, No. 8

Chu, M., Liu, Jie., Liu, Juan, Reich, J., Zhao, F. (2003). State-Centric Programming for Sensor-Actuated Network Systems. Pervasive Computing, 3, 50-62.

Culler, D., Estrin, D., & Srivastava, M. (2004). Overview of Sensor Networks. Computer, 37 (8), 41-49.

Culler, D., Hill, J., Horton, M., Pister, K., Szewczyk, R., Woo, A. (2002). MICA: The Commercialization of Microsensor Motes. Sensors Online. Retrieved September 3, 2004, from http://www.sensorsmag.com/articles/0402/40/main.shtml

Culler, D., & Hong W. (2004). Wireless Sensor Networks. Communications of the ACM, Vol. 47, No. 6.

Definition of ALOHAnet. Retrieved October 12, 2004, from http://www.wordiq.com/definition/ALOHAnet

26

Hill, J., Horton, M., Kling, R., Krishnamurthy, L. (2004). The Platforms Enabling Wireless Sensor Networks. Communications of the ACM, Vol. 47, No. 6.

Iyengar, B., & Brooks, R. (2004). Special issue introduction—the road map for distributed sensor networks in the context of computing and communication. Journal of Parallel and Distributed Computing, 64, 785-787.

Lederer, S., Dey, A., & Mankoff, J. (2002). Everyday Privacy in Ubiquitous Computing Environments. Privacy In Ubicomp'2002: Workshop on Socially-informed Design of Privacy-enhancing Solutions in Ubiquitous Computing, Sweden, 1-5.

Mainland, G., & Welsh, M. (2004). Programming Sensor Networks Using Abstract Regions. In Proceedings of the First USENIX/ACM Symposium on Networked Systems Design and Implementation (NSDI '04).

Perrig, A., Stankovic, J., & Wagner, D. (2004). Security in Wireless Sensor Networks. Communications of the ACM, Vol. 47, No. 6.

Section 508 Standards. Retrieved October 12, 2004, from http://www.section508.gov/index.cfm?FuseAction=Content&ID=12

Treese, W. (2004, June). Putting it Together, pp. 15-17.

27

Wood, A., & Stankovic, J. Denial of Service in Sensor Networks. (2002, October). Computer, pp. 54-62.

Zachary, J. (2003). A Decentralized Approach to Secure Management of Nodes in Distributed Sensor Networks.

28

VIII. Required Appendices A. Budget and Equipment Checklist There is no projected budget for this project. The equipment necessary for this project includes any PC with the Microsoft Visual Studio software. The University of Virginia’s engineering school computer labs are all equipped with the necessary software. Executing the GUI software does not require any special equipment as it will be run as an executable file.

B. Biographical Sketch of Student As a computer engineering student, I have taken two classes devoted to software development. I believe that these classes make me a qualified candidate to accomplish this project. In both courses I worked both individually and as a small team to create software systems that were started at the beginning of the semester and developed throughout the semester. Both courses not only taught me programming techniques and object oriented design, but also project management, scheduling, and planning. I have previous experience using Microsoft Visual C# .NET. I also have experience with the data structures that will be used in the coding.

C. Preliminary Outline of Thesis 1. Problem a) Query Based Paradigms i) Cougar : Cornell ii) TinyDB : Berkeley, Intel

29

iii) Tina: Pittsburgh b) Event Based Paradigms i) DSWare : UVA ii) GalsC/GuysC : Berkeley, PARC iii) SensorWare : UCLA c) Node Based Paradigms i) MANTIS : Colorado ii) Mate : Berkeley iii) NesC : Berkeley, Intel d) Biological Based Paradigms i) Amorphous Computing : MIT ii) Swarm Computing : UVA 2. Methods a) Text Macros b) Design Decisions c) Undesired Events and Appropriate Actions d) Event Tables e) Mode Transition Tables f) Specification 3. Data a) Code b) UML class diagrams c) UML Use Cases

30

d) GUI screenshots e) Object Text File Example f) Condition Library Text File Example 4. Interpretation a) Inspection Report b) Evaluation of Section 508 Standards 5. Conclusion a) Further improvements b) Future work

31

Code Listing

Attribute.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for Attribute. /// public class Attribute { public Attribute() { setName(""); m_condition = new Condition(); setAggregationFunction(""); } public Attribute(String name, Condition condition, String aggregation_function) { m_condition = new Condition(); setName(name); m_condition.setCondition(condition); setAggregationFunction(aggregation_function); } public Condition getCondition() { return m_condition; } public void setName(String name) { m_name = name; } public String getName() { return m_name; } public void setAttribute(Attribute attribute) { this.setName(attribute.getName());

1

this.getCondition().setCondition(attribute.getCondition()); this.setAggregationFunction(attribute.getAggregationFunction()); } public bool equals(Attribute attributeToCompare) { if( this.getName() == attributeToCompare.getName() ) return true; return false; } public String getAggregationFunction() { return m_aggregation_function; } public void setAggregationFunction(String name) { m_aggregation_function = name; } public String print() { return this.getName()+""+this.getAggregationFunction()+"-"+this.getCondition().getName(); }

private Condition m_condition; private String m_name; private String m_aggregation_function; } }

2

AttributeCollection.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for AttributeCollection. /// public class AttributeCollection { public AttributeCollection() { m_attribute_collection = new ArrayList(); setName(""); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } public int getSize() { return m_attribute_collection.Count; } public Attribute getAttributeAt(int index) { return (Attribute)m_attribute_collection[index]; } public bool equals(AttributeCollection attribute_collection) { if(this.getName() == attribute_collection.getName()) return true; return false; } public int isMember(Attribute attribute) { for(int i = 0; i < this.getSize(); i++) { if( attribute.equals(this.getAttributeAt(i)) ) return i; }

3

return -1; //means that this attribute is not in the current collection } public void addAttribute(Attribute attributeToAdd) { //if attributeToAdd is not a member, it is ok to add it if(isMember(attributeToAdd) == -1) m_attribute_collection.Add(attributeToAdd); } public void deleteAttributeAt(int index) { m_attribute_collection.RemoveAt(index); } public void deleteCollection() { m_attribute_collection.Clear(); } public void setCollection(AttributeCollection collection) { this.setName(collection.getName()); this.deleteCollection(); for( int i = 0; i < collection.getSize(); i++) { this.addAttribute(collection.getAttributeAt(i)); } } // public void editAttributeAt(int index, Attribute replacement) // { // this.getAttributeAt(index).setAttribute(replacement); // } public String print() { String attributeList = ""; for( int i = 0; i < this.getSize()-1; i++) { attributeList += this.getAttributeAt(i).print()+"~"; } if( this.getSize() != 0 ) { attributeList += this.getAttributeAt(this.getSize()-1).print(); }

4

return attributeList; }

private String m_name; private ArrayList m_attribute_collection; } }

5

Condition.cs using System; using System.Windows.Forms; using System.IO; namespace Enviro_1 { /// /// Summary description for Condition. /// public class Condition { public Condition() { setName(""); setUnit(""); setUpperLimit("_"); setLowerLimit("_"); setDescription(""); setDataType(""); m_method = new Method(); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } public void setMethod(Method method) { this.getMethod().setName(method.getName()); this.getMethod().setPath(method.getPath()); } public Method getMethod() { return m_method; } public void setPath(String path) { this.getMethod().setPath(path); } public void setUnit(String unit) { m_unit = unit; } public String getUnit()

6

{ return m_unit; } public void setUpperLimit(String upperLimit) { m_upperLimit = upperLimit; } public String getUpperLimit() { return m_upperLimit; } public void setLowerLimit(String lowerLimit) { m_lowerLimit = lowerLimit; } public String getLowerLimit() { return m_lowerLimit; } public bool equals(Condition conditionToCompare) { if( conditionToCompare.getName() == this.getName()) { return true; } return false; } public void setCondition(Condition condition) { this.setName(condition.getName()); this.setUnit(condition.getUnit()); this.setLowerLimit(condition.getLowerLimit()); this.setUpperLimit(condition.getUpperLimit()); this.setDescription(condition.getDescription()); this.setDataType(condition.getDataType()); } public void setDescription(String description) { m_description = description; } public String getDescription() { return m_description; } public void setDataType(String datatype) { m_datatype = datatype;

7

} public String getDataType() { return m_datatype; } public String print() { if(this.getDescription() == "") return this.getName()+"-"+this.getUnit()+""+this.getLowerLimit()+"-"+this.getUpperLimit()+"-"+this.getDataType(); return this.getName()+"-"+this.getUnit()+""+this.getLowerLimit()+"-"+this.getUpperLimit()+""+this.getDescription()+"-"+this.getDataType(); } private private private private private private private

String String String String Method String String

m_name; m_unit; m_upperLimit; m_lowerLimit; m_method; m_description; m_datatype;

} }

8

ConditionCollection.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for ConditionCollection. /// public class ConditionCollection { public ConditionCollection() { m_condition_collection = new ArrayList(); setName(""); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } //returns the Condition at the specified index of the collection public Condition getConditionAt(int index) { if(index==-1) { MessageBox.Show("Index out of range!"); return null; } return (Condition)m_condition_collection[index]; } //if a user adds a new condition to this collection then the new condition //must be unique from the the existing collection of conditions //returns where the condition is found in the collection, if not found return -1 public int isMember(Condition condition) { for(int i = 0; i < this.getSize(); i++) { if( condition.equals(this.getConditionAt(i)) ) return i; }

9

return -1; //not a member of the current collection } public void addCondition(Condition conditionToAdd) { //if conditionToAdd is not a member, it is ok to add it if(isMember(conditionToAdd) == -1) m_condition_collection.Add(conditionToAdd); } public void deleteConditionAt(int index) { m_condition_collection.RemoveAt(index); } public void deleteCollection() { m_condition_collection.Clear(); } //goes through the conditions of this collection //takes a collection and assigns the list of these conditions to this collection //also changes the name of this collection to collection's name public void setCollection(ConditionCollection collection) { this.setName(collection.getName()); this.deleteCollection(); for( int i = 0; i < collection.getSize(); i++) { this.addCondition(collection.getConditionAt(i)); } } public void editConditionAt(int index, Condition replacement) { this.getConditionAt(index).setCondition(replacement); } public int getSize() { return m_condition_collection.Count; } public bool equals(ConditionCollection condition_collection) { if(this.getName() == condition_collection.getName()) return true; return false; }

10

public String print() { String conditionList = ""; for(int i = 0; i < this.getSize()-1; i++) { conditionList += this.getConditionAt(i).print()+","; } if( this.getSize() != 0) { conditionList += this.getConditionAt(this.getSize()-1).print(); } return conditionList; } private ArrayList m_condition_collection; private String m_name; } }

11

Method.cs using System; namespace Enviro_1 { /// /// Summary description for Method. /// public class Method { public Method() { setName(""); setPath(""); } public void reset() { setName(""); setPath(""); } public void setName(String name) { m_name = name; } public void setMethod(Method newMethod) { this.setName(newMethod.getName()); this.setPath(newMethod.getPath()); } public String getName() { return m_name; } public void setPath(String path) { m_path = path; } public String getPath() { return m_path; } public bool equals(Method method) { if( method.getName().Equals(this.getName()) ) { return true; }

12

return false; } public String print() { if( this.getName().Equals("") && this.getPath().Equals("") ) return ""; return m_name+"+"+m_path; } private String m_name; private String m_path; } }

13

MethodCollection.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for MethodCollection. /// public class MethodCollection { public MethodCollection() { m_method_collection = new ArrayList(); setName(""); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } //returns the Condition at the specified index of the collection public Method getMethodAt(int index) { if(index==-1) { MessageBox.Show("Index out of range!"); return null; } return (Method)m_method_collection[index]; } //if a user adds a new condition to this collection then the new condition //must be unique from the the existing collection of conditions //returns where the condition is found in the collection, if not found return -1 public int isMember(Method method) { for(int i = 0; i < this.getSize(); i++) { if( method.equals(this.getMethodAt(i)) ) return i; }

14

return -1; //not a member of the current collection } public void addMethod(Method methodToAdd) { if(isMember(methodToAdd) == -1) m_method_collection.Add(methodToAdd); } public void deleteMethodAt(int index) { m_method_collection.RemoveAt(index); } public void deleteCollection() { m_method_collection.Clear(); } //goes through the conditions of this collection //takes a collection and assigns the list of these conditions to this collection //also changes the name of this collection to collection's name public void setCollection(MethodCollection collection) { this.setName(collection.getName()); this.deleteCollection(); for( int i = 0; i < collection.getSize(); i++) { this.addMethod(collection.getMethodAt(i)); } } // // // //

public void editMethodAt(int index, Method replacement) { this.getMethodAt(index).setMethod(replacement); } public int getSize() { return m_method_collection.Count; } public bool equals(MethodCollection method_collection) { if(this.getName() == method_collection.getName()) return true; return false; } public String print() { String methodList = "";

15

// //

if(this.getSize().Equals(0)) return ""; for(int i = 0; i < this.getSize()-1; i++) { methodList += this.getMethodAt(i).print()+"~"; } if( this.getSize() != 0) { methodList += this.getMethodAt(this.getSize()-

1).print(); } return methodList; }

private String m_name; private ArrayList m_method_collection; } }

16

Object.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for Object. /// public class Object { public Object() { m_attribute_collection = new AttributeCollection(); m_condition_collection = new ConditionCollection(); m_method_collection = new MethodCollection(); m_main_method = new Method(); setName(""); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } public void addAttribute(Attribute attributeToAdd) { m_attribute_collection.addAttribute(attributeToAdd); } public void deleteAttributeAt(int index) { m_attribute_collection.deleteAttributeAt(index); } public void addCondition(Condition condition) { m_condition_collection.addCondition(condition); } public void deleteConditionAt(int index) { m_condition_collection.deleteConditionAt(index); } public void addMethod(Method method) {

17

m_method_collection.addMethod(method); } public void deleteMethodAt(int index) { m_method_collection.deleteMethodAt(index); }

public void setObject(Object newObject) { this.setName(newObject.getName()); //set the new name //set the new condition collection this.getConditionCollection().setCollection(newObject.getConditio nCollection()); //set the new attribute collection this.getAttributeCollection().setCollection(newObject.getAttribut eCollection()); //set the new method this.getMainMethod().setMethod(newObject.getMainMethod()); //set the new method collection this.getMethodCollection().setCollection(newObject.getMethodColle ction()); } public int isMember(Attribute attribute) { return m_attribute_collection.isMember(attribute); } public int getAttributeCollectionSize() { return m_attribute_collection.getSize(); } public int getConditionCollectionSize() { return m_condition_collection.getSize(); } public int getMethodCollectionSize() { return m_method_collection.getSize(); } // public Condition getConditionAt(int index) // { // return (Condition)m_condition_collection.getConditionAt(index); // }

public AttributeCollection getAttributeCollection()

18

{ return m_attribute_collection; } public ConditionCollection getConditionCollection() { return m_condition_collection; } public MethodCollection getMethodCollection() { return m_method_collection; } //if the name is the same return true, false otherwise public bool equals(Object objectToCompare) { if( this.getName() == objectToCompare.getName() ) { return true; } return false; } public String print() { return this.getName()+"|"+this.getConditionCollection().print()+"|"+this.getAt tributeCollection().print()+"|"+this.getMainMethod().print()+"~"+this.g etMethodCollection().print(); } public Method getMainMethod() { return m_main_method; } public void reset() { m_attribute_collection.deleteCollection(); m_condition_collection.deleteCollection(); m_main_method.reset(); m_method_collection.deleteCollection(); m_name = ""; } private private private private private

AttributeCollection m_attribute_collection; ConditionCollection m_condition_collection; Method m_main_method; MethodCollection m_method_collection; String m_name;

} }

19

ObjectCollection.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for ObjectCollection. /// public class ObjectCollection { public ObjectCollection() { m_object_collection = new ArrayList(); setName(""); } public void setName(String name) { m_name = name; } public String getName() { return m_name; } public int getSize() { return m_object_collection.Count; } public bool equals(ObjectCollection object_collection) { if(this.getName() == object_collection.getName() ) { return true; } return false; } public Object getObjectAt(int index) { return (Object)m_object_collection[index]; }

public int isMember(Object objectToCheck) { for(int i = 0; i < this.getSize(); i++) { if( objectToCheck.equals(this.getObjectAt(i)) )

20

return i; } return -1; //means that this object is not already in the collection } public void addObject(Object objectToAdd) { //if objectToAdd is not in the collection, add it //if(isMember(objectToAdd) == -1) m_object_collection.Add(objectToAdd); } public void deleteObject(Object objectToDelete) { for(int i = 0; i < this.getSize(); i++) { if( objectToDelete.equals(this.getObjectAt(i)) ) m_object_collection.RemoveAt(i); } } public void editCollection(ObjectCollection collection) { if(this.getSize() != collection.getSize()) { return; } for(int i = 0; i < this.getSize(); i++) { for(int j = 0; j < collection.getSize(); j++) { if(this.getObjectAt(i).equals(collection.getObjectAt(j))) { this.getObjectAt(i).setObject(collection.getObjectAt(j)); } } } } public String print() { String objectList = ""; for( int i = 0; i < this.getSize(); i++) { objectList += this.getObjectAt(i).print()+"\n"; } return objectList; }

21

public void deleteCollection() { m_object_collection.Clear(); } private String m_name; private ArrayList m_object_collection; } }

22

Project.cs using using using using

System; System.Windows.Forms; System.IO; System.Collections;

namespace Enviro_1 { /// /// Summary description for Project. /// public class Project { public Project() { m_object_collection = new ObjectCollection(); m_condition_collection = new ConditionCollection(); setName("Default Project Name"); hasSaved = true; } public void reset() { m_object_collection.deleteCollection(); m_condition_collection.deleteCollection(); setName("Default Project Name"); hasSaved = true; } //this name of this project is the same as the name of its objectCollection public void setName(String name) { m_object_collection.setName(name); } public String getName() { return m_object_collection.getName(); } public void addObject(Object objectToAdd) { m_object_collection.addObject(objectToAdd); } public void deleteObject(Object objectToDelete) { m_object_collection.deleteObject(objectToDelete); } public void editObject(Object objectToEdit) { //m_object_collection.editObject(objectToEdit); }

23

public int isMember(Object objectToCheck) { return m_object_collection.isMember(objectToCheck); } public int getSize() { return m_object_collection.getSize(); } public Object getObject(int index) { return (Object)m_object_collection.getObjectAt(index); } public ObjectCollection getObjectCollection() { return m_object_collection; } public String print() { return m_object_collection.print(); } public ConditionCollection getConditionCollection() { return m_condition_collection; } public void setSaved(bool saved) { hasSaved = saved; }

private ObjectCollection m_object_collection; private ConditionCollection m_condition_collection; public bool hasSaved; } }

24

Form1.cs using using using using using using using using using

System; System.Drawing; System.Collections; System.ComponentModel; System.Windows.Forms; System.Data; System.Drawing.Imaging; System.IO; System.Diagnostics;

namespace Enviro_1 { /// /// Summary description for EnviroTrack. /// public class Form1 : System.Windows.Forms.Form { private Project myProject = new Project(); private Object myObject = new Object(); private bool clickedOKFromSave = true; private String[] parts = null; private static char[] delimiter = "-".ToCharArray(); private const int max_parts = 6; private string default_condition_library_path = "Libraries/Condition Library/default.txt"; private bool changedPath = false; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.ListBox Aggregate; private System.Windows.Forms.Label Aggegrate; private System.Windows.Forms.MenuItem exit; private System.Windows.Forms.MenuItem project_menu; private System.Windows.Forms.MenuItem new_project; private System.Windows.Forms.MenuItem open_project; private System.Windows.Forms.MenuItem save_project; private System.Windows.Forms.TabControl tabs; private System.Windows.Forms.TabPage attached_methods_tab; private System.Windows.Forms.TabPage object_context_tab; private System.Windows.Forms.TabPage object_attributes_tab; private System.Windows.Forms.Label attribute_label; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label Attributes; private System.Windows.Forms.Button remove_condition_button; private System.Windows.Forms.Button add_condition_button; private System.Windows.Forms.ListBox condition_library_list; private System.Windows.Forms.ListBox current_condition_list1; private System.Windows.Forms.ListBox created_attributes;

25

private System.Windows.Forms.TextBox attribute_name; private System.Windows.Forms.TextBox function_name_textbox; private System.Windows.Forms.Label function_name_label; private System.Windows.Forms.ListBox object_list_box; private System.Windows.Forms.Button delete_object_button; private System.Windows.Forms.Label object_list_label; private System.Windows.Forms.Button add_object_button; private System.Windows.Forms.TextBox object_name_textbox; private System.Windows.Forms.Label object_name_label; private System.Windows.Forms.Button edit_object_button; private System.Windows.Forms.Button save_changes_button; private System.Windows.Forms.Button cancel_changes_button; private System.Windows.Forms.MenuItem conditon_library_menu; private System.Windows.Forms.MenuItem help_menu; private System.Windows.Forms.MenuItem about_menu; private System.Windows.Forms.MenuItem edit_condition_menu; private System.Windows.Forms.Label selected_condition_label; private System.Windows.Forms.Button edit_condition_button; private System.Windows.Forms.Button edit_attribute_button; private System.Windows.Forms.Button delete_attribute_button; private System.Windows.Forms.CheckBox upper_limit_checkbox; private System.Windows.Forms.CheckBox lower_limit_checkbox; private System.Windows.Forms.Label condition_upper_limit_label; private System.Windows.Forms.Label condition_lower_limit_label; private System.Windows.Forms.TextBox condition_upper_limit_textbox; private System.Windows.Forms.TextBox condition_lower_limit_textbox; private System.Windows.Forms.Button browse_button; private System.Windows.Forms.TextBox browse_textbox; private System.Windows.Forms.Label main_method_label; private System.Windows.Forms.CheckBox other_methods_checkbox; private System.Windows.Forms.TextBox other_browse_textbox; private System.Windows.Forms.Button other_browse_button; private System.Windows.Forms.Label method_name_label; private System.Windows.Forms.TextBox method_name_textbox; private System.Windows.Forms.Button add_method_button; private System.Windows.Forms.ListBox other_method_listbox; private System.Windows.Forms.Label condition_library_label; private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.ToolBar toolBar1; private System.Windows.Forms.ToolBarButton toolBarButton1; private System.Windows.Forms.ToolBarButton toolBarButton2; private System.Windows.Forms.ToolBarButton toolBarButton3; private System.Windows.Forms.ToolBarButton toolBarButton4; private System.Windows.Forms.ToolBarButton toolBarButton5; private System.Windows.Forms.ToolBarButton toolBarButton6; private System.Windows.Forms.ToolBarButton toolBarButton7; private System.Windows.Forms.Button delete_method_button; private System.Windows.Forms.Button cancel_condition_button;

26

private System.Windows.Forms.Button cancel_attribute_button; private System.Windows.Forms.Button create_attribute; private System.Windows.Forms.Button cancel_method_button; private System.Windows.Forms.Button cancel_object_button; private System.Windows.Forms.Button rename_object_button; private System.Windows.Forms.Button save_object_name; private System.Windows.Forms.TextBox upper_limit_input; private System.Windows.Forms.TextBox lower_limit_input; private System.Windows.Forms.Button cancel_rename_button; private System.Windows.Forms.ToolTip add_object_button_toolTip; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ToolTip save_changes_button_toolTip; private System.Windows.Forms.ToolTip create_attribute_toolTip; private System.Windows.Forms.ToolTip created_attributes_toolTip; private System.Windows.Forms.Label method_list_label; private System.Windows.Forms.ToolTip other_method_listbox_toolTip; private System.Windows.Forms.ToolTip object_list_box_toolTip; private System.Windows.Forms.MenuItem change_path_menu_item; private System.Windows.Forms.Label condition_unit; private System.Windows.Forms.RichTextBox condition_description_textBox; private System.Windows.Forms.GroupBox unit_groupBox; private System.Windows.Forms.GroupBox condition_description_groupBox; private System.Windows.Forms.GroupBox object_changes_groupBox; private System.Windows.Forms.Label datatype_label; private System.Windows.Forms.ComboBox datatype_drop_box; private System.Windows.Forms.ComboBox datatype_drop_box1; private System.Windows.Forms.Label datatype_label1; private System.Windows.Forms.Button confirm_method_list; private System.Windows.Forms.MenuItem CloseMenuItem; private System.ComponentModel.IContainer components; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); openAggregationLibrary(); // // TODO: Add any constructor code after InitializeComponent call // add_object_button_toolTip.InitialDelay = 100;

27

add_object_button_toolTip.SetToolTip(add_object_button,"Add to Object List");

save_changes_button_toolTip.SetToolTip(save_changes_button,"Save Current Object"); save_changes_button_toolTip.InitialDelay = 100;

create_attribute_toolTip.SetToolTip(create_attribute,"Add Current Attribute To List"); create_attribute_toolTip.InitialDelay = 100;

created_attributes_toolTip.SetToolTip(created_attributes,"Select an Attribute to Modify/Delete"); created_attributes_toolTip.InitialDelay = 100;

other_method_listbox_toolTip.SetToolTip(other_method_listbox,"Sel ect a Method to Modify/Delete"); other_method_listbox_toolTip.InitialDelay = 100;

object_list_box_toolTip.SetToolTip(object_list_box,"Select an Object to modfiy/delete"); object_list_box_toolTip.InitialDelay = 100; toolBar1.ShowToolTips = true; toolBar1.Buttons[0].ToolTipText = "New Project"; toolBar1.Buttons[3].ToolTipText = "Open Project"; toolBar1.Buttons[6].ToolTipText = "Save Project"; } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if( tabs.Visible == true ) { MessageBox.Show("Save or Cancel Changes before continuing!"); return; } if( myProject.hasSaved == false ) { string caption = "The project has changed."; string message = "Save before exiting?"; MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result;

28

// Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) //save first, then open new { // Call save object sender = new object(); System.EventArgs e = new EventArgs(); this.save_menu_Click(sender, e); if( clickedOKFromSave == true ) { reinitialize(); } else { return; } } else if( result == DialogResult.No ) //don't save, just open new { reinitialize(); } else if( result == DialogResult.Cancel ) //do nothing, cancel { return; } } if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.project_menu = new System.Windows.Forms.MenuItem();

29

this.new_project = new System.Windows.Forms.MenuItem(); this.open_project = new System.Windows.Forms.MenuItem(); this.save_project = new System.Windows.Forms.MenuItem(); this.exit = new System.Windows.Forms.MenuItem(); this.conditon_library_menu = new System.Windows.Forms.MenuItem(); this.edit_condition_menu = new System.Windows.Forms.MenuItem(); this.change_path_menu_item = new System.Windows.Forms.MenuItem(); this.help_menu = new System.Windows.Forms.MenuItem(); this.about_menu = new System.Windows.Forms.MenuItem(); this.Aggregate = new System.Windows.Forms.ListBox(); this.Aggegrate = new System.Windows.Forms.Label(); this.tabs = new System.Windows.Forms.TabControl(); this.object_context_tab = new System.Windows.Forms.TabPage(); this.datatype_drop_box1 = new System.Windows.Forms.ComboBox(); this.datatype_label1 = new System.Windows.Forms.Label(); this.datatype_drop_box = new System.Windows.Forms.ComboBox(); this.datatype_label = new System.Windows.Forms.Label(); this.lower_limit_input = new System.Windows.Forms.TextBox(); this.upper_limit_input = new System.Windows.Forms.TextBox(); this.cancel_condition_button = new System.Windows.Forms.Button(); this.edit_condition_button = new System.Windows.Forms.Button(); this.condition_lower_limit_textbox = new System.Windows.Forms.TextBox(); this.condition_lower_limit_label = new System.Windows.Forms.Label(); this.condition_upper_limit_textbox = new System.Windows.Forms.TextBox(); this.condition_upper_limit_label = new System.Windows.Forms.Label(); this.selected_condition_label = new System.Windows.Forms.Label(); this.upper_limit_checkbox = new System.Windows.Forms.CheckBox(); this.lower_limit_checkbox = new System.Windows.Forms.CheckBox(); this.remove_condition_button = new System.Windows.Forms.Button(); this.add_condition_button = new System.Windows.Forms.Button(); this.current_condition_list1 = new System.Windows.Forms.ListBox();

30

this.Attributes = new System.Windows.Forms.Label(); this.object_attributes_tab = new System.Windows.Forms.TabPage(); this.cancel_attribute_button = new System.Windows.Forms.Button(); this.delete_attribute_button = new System.Windows.Forms.Button(); this.edit_attribute_button = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.created_attributes = new System.Windows.Forms.ListBox(); this.create_attribute = new System.Windows.Forms.Button(); this.attribute_name = new System.Windows.Forms.TextBox(); this.attribute_label = new System.Windows.Forms.Label(); this.attached_methods_tab = new System.Windows.Forms.TabPage(); this.confirm_method_list = new System.Windows.Forms.Button(); this.method_list_label = new System.Windows.Forms.Label(); this.cancel_method_button = new System.Windows.Forms.Button(); this.delete_method_button = new System.Windows.Forms.Button(); this.other_method_listbox = new System.Windows.Forms.ListBox(); this.other_browse_textbox = new System.Windows.Forms.TextBox(); this.other_browse_button = new System.Windows.Forms.Button(); this.method_name_label = new System.Windows.Forms.Label(); this.method_name_textbox = new System.Windows.Forms.TextBox(); this.other_methods_checkbox = new System.Windows.Forms.CheckBox(); this.main_method_label = new System.Windows.Forms.Label(); this.browse_textbox = new System.Windows.Forms.TextBox(); this.browse_button = new System.Windows.Forms.Button(); this.add_method_button = new System.Windows.Forms.Button(); this.function_name_label = new System.Windows.Forms.Label(); this.function_name_textbox = new System.Windows.Forms.TextBox(); this.condition_library_list = new System.Windows.Forms.ListBox(); this.condition_library_label = new System.Windows.Forms.Label();

31

this.object_list_box = new System.Windows.Forms.ListBox(); this.delete_object_button = new System.Windows.Forms.Button(); this.object_list_label = new System.Windows.Forms.Label(); this.add_object_button = new System.Windows.Forms.Button(); this.object_name_textbox = new System.Windows.Forms.TextBox(); this.object_name_label = new System.Windows.Forms.Label(); this.edit_object_button = new System.Windows.Forms.Button(); this.save_changes_button = new System.Windows.Forms.Button(); this.cancel_changes_button = new System.Windows.Forms.Button(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton3 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton4 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton5 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton6 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton7 = new System.Windows.Forms.ToolBarButton(); this.cancel_object_button = new System.Windows.Forms.Button(); this.rename_object_button = new System.Windows.Forms.Button(); this.save_object_name = new System.Windows.Forms.Button(); this.cancel_rename_button = new System.Windows.Forms.Button(); this.add_object_button_toolTip = new System.Windows.Forms.ToolTip(this.components); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.save_changes_button_toolTip = new System.Windows.Forms.ToolTip(this.components); this.create_attribute_toolTip = new System.Windows.Forms.ToolTip(this.components); this.created_attributes_toolTip = new System.Windows.Forms.ToolTip(this.components); this.other_method_listbox_toolTip = new System.Windows.Forms.ToolTip(this.components); this.object_list_box_toolTip = new System.Windows.Forms.ToolTip(this.components);

32

this.condition_unit = new System.Windows.Forms.Label(); this.condition_description_groupBox = new System.Windows.Forms.GroupBox(); this.condition_description_textBox = new System.Windows.Forms.RichTextBox(); this.unit_groupBox = new System.Windows.Forms.GroupBox(); this.object_changes_groupBox = new System.Windows.Forms.GroupBox(); this.CloseMenuItem = new System.Windows.Forms.MenuItem(); this.tabs.SuspendLayout(); this.object_context_tab.SuspendLayout(); this.object_attributes_tab.SuspendLayout(); this.attached_methods_tab.SuspendLayout(); this.condition_description_groupBox.SuspendLayout(); this.unit_groupBox.SuspendLayout(); this.object_changes_groupBox.SuspendLayout(); this.SuspendLayout(); // // mainMenu1 // this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {

this.project_menu,

this.conditon_library_menu,

this.help_menu}); // // project_menu // this.project_menu.Index = 0; this.project_menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {

this.new_project,

this.open_project,

this.save_project,

this.CloseMenuItem,

this.exit}); this.project_menu.Text = "Project";

33

this.project_menu.Click += new System.EventHandler(this.project_menu_Click); // // new_project // this.new_project.Index = 0; this.new_project.Text = "New"; this.new_project.Click += new System.EventHandler(this.new_menu_Click); // // open_project // this.open_project.Index = 1; this.open_project.Text = "Open"; this.open_project.Click += new System.EventHandler(this.open_menu_Click); // // save_project // this.save_project.Index = 2; this.save_project.Text = "Save"; this.save_project.Click += new System.EventHandler(this.save_menu_Click); // // exit // this.exit.Index = 4; this.exit.Text = "Exit"; this.exit.Click += new System.EventHandler(this.exit_Click); // // conditon_library_menu // this.conditon_library_menu.Index = 1; this.conditon_library_menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {

this.edit_condition_menu,

this.change_path_menu_item}); this.conditon_library_menu.Text = "Condition Library"; // // edit_condition_menu // this.edit_condition_menu.Index = 0; this.edit_condition_menu.Text = "Edit"; this.edit_condition_menu.Click += new System.EventHandler(this.edit_condition_menu_Click); // // change_path_menu_item // this.change_path_menu_item.Index = 1; this.change_path_menu_item.Text = "Change Path";

34

this.change_path_menu_item.Click += new System.EventHandler(this.change_path_menu_item_Click); // // help_menu // this.help_menu.Index = 2; this.help_menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {

this.about_menu}); this.help_menu.Text = "Help"; // // about_menu // this.about_menu.Index = 0; this.about_menu.Text = "About"; this.about_menu.Click += new System.EventHandler(this.about_menu_Click); // // Aggregate // this.Aggregate.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Aggregate.ItemHeight = 20; this.Aggregate.Location = new System.Drawing.Point(296, 96); this.Aggregate.Name = "Aggregate"; this.Aggregate.Size = new System.Drawing.Size(72, 124); this.Aggregate.TabIndex = 8; this.Aggregate.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // // Aggegrate // this.Aggegrate.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Aggegrate.Location = new System.Drawing.Point(240, 72); this.Aggegrate.Name = "Aggegrate"; this.Aggegrate.Size = new System.Drawing.Size(216, 24); this.Aggegrate.TabIndex = 9; this.Aggegrate.Text = "Aggregation Method Library"; this.Aggegrate.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // tabs // this.tabs.Controls.Add(this.object_context_tab); this.tabs.Controls.Add(this.object_attributes_tab); this.tabs.Controls.Add(this.attached_methods_tab);

35

this.tabs.Location = new System.Drawing.Point(208, 192); this.tabs.Name = "tabs"; this.tabs.SelectedIndex = 0; this.tabs.Size = new System.Drawing.Size(680, 480); this.tabs.TabIndex = 25; this.tabs.Visible = false; this.tabs.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); // // object_context_tab // this.object_context_tab.Controls.Add(this.datatype_drop_box1); this.object_context_tab.Controls.Add(this.datatype_label1); this.object_context_tab.Controls.Add(this.datatype_drop_box); this.object_context_tab.Controls.Add(this.datatype_label); this.object_context_tab.Controls.Add(this.lower_limit_input); this.object_context_tab.Controls.Add(this.upper_limit_input); this.object_context_tab.Controls.Add(this.cancel_condition_button ); this.object_context_tab.Controls.Add(this.edit_condition_button); this.object_context_tab.Controls.Add(this.condition_lower_limit_t extbox); this.object_context_tab.Controls.Add(this.condition_lower_limit_l abel); this.object_context_tab.Controls.Add(this.condition_upper_limit_t extbox); this.object_context_tab.Controls.Add(this.condition_upper_limit_l abel); this.object_context_tab.Controls.Add(this.selected_condition_labe l); this.object_context_tab.Controls.Add(this.upper_limit_checkbox); this.object_context_tab.Controls.Add(this.lower_limit_checkbox); this.object_context_tab.Controls.Add(this.remove_condition_button ); this.object_context_tab.Controls.Add(this.add_condition_button); this.object_context_tab.Controls.Add(this.current_condition_list1 );

36

this.object_context_tab.Controls.Add(this.Attributes); this.object_context_tab.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.object_context_tab.Location = new System.Drawing.Point(4, 25); this.object_context_tab.Name = "object_context_tab"; this.object_context_tab.Size = new System.Drawing.Size(672, 451); this.object_context_tab.TabIndex = 0; this.object_context_tab.Text = "Detection Conditions"; this.object_context_tab.Click += new System.EventHandler(this.tabPage1_Click); // // datatype_drop_box1 // this.datatype_drop_box1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.datatype_drop_box1.Items.AddRange(new object[] { "Boolean", "Integer", "Float"}); this.datatype_drop_box1.Location = new System.Drawing.Point(464, 168); this.datatype_drop_box1.Name = "datatype_drop_box1"; this.datatype_drop_box1.Size = new System.Drawing.Size(168, 33); this.datatype_drop_box1.TabIndex = 86; this.datatype_drop_box1.Visible = false; this.datatype_drop_box1.SelectedIndexChanged += new System.EventHandler(this.datatype_drop_box1_SelectedIndexChanged); // // datatype_label1 // this.datatype_label1.Location = new System.Drawing.Point(464, 136); this.datatype_label1.Name = "datatype_label1"; this.datatype_label1.Size = new System.Drawing.Size(160, 32); this.datatype_label1.TabIndex = 85; this.datatype_label1.Text = "Data Type"; this.datatype_label1.Visible = false; // // datatype_drop_box // this.datatype_drop_box.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.datatype_drop_box.Items.AddRange(new object[] { "Boolean",

37

"Integer", "Float"}); this.datatype_drop_box.Location = new System.Drawing.Point(16, 208); this.datatype_drop_box.Name = "datatype_drop_box"; this.datatype_drop_box.Size = new System.Drawing.Size(168, 33); this.datatype_drop_box.TabIndex = 84; this.datatype_drop_box.SelectedIndexChanged += new System.EventHandler(this.datatype_drop_box_SelectedIndexChanged); // // datatype_label // this.datatype_label.Location = new System.Drawing.Point(16, 176); this.datatype_label.Name = "datatype_label"; this.datatype_label.Size = new System.Drawing.Size(160, 32); this.datatype_label.TabIndex = 83; this.datatype_label.Text = "Data Type"; // // lower_limit_input // this.lower_limit_input.Enabled = false; this.lower_limit_input.Location = new System.Drawing.Point(136, 320); this.lower_limit_input.Name = "lower_limit_input"; this.lower_limit_input.Size = new System.Drawing.Size(72, 31); this.lower_limit_input.TabIndex = 82; this.lower_limit_input.Text = ""; // // upper_limit_input // this.upper_limit_input.Enabled = false; this.upper_limit_input.Location = new System.Drawing.Point(136, 280); this.upper_limit_input.Name = "upper_limit_input"; this.upper_limit_input.Size = new System.Drawing.Size(72, 31); this.upper_limit_input.TabIndex = 81; this.upper_limit_input.Text = ""; // // cancel_condition_button // this.cancel_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_condition_button.Location = new System.Drawing.Point(552, 392); this.cancel_condition_button.Name = "cancel_condition_button"; this.cancel_condition_button.Size = new System.Drawing.Size(104, 32);

38

this.cancel_condition_button.TabIndex = 76; this.cancel_condition_button.Text = "Cancel"; this.cancel_condition_button.Visible = false; this.cancel_condition_button.Click += new System.EventHandler(this.cancel_condition_button_Click); // // edit_condition_button // this.edit_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.edit_condition_button.Location = new System.Drawing.Point(448, 392); this.edit_condition_button.Name = "edit_condition_button"; this.edit_condition_button.Size = new System.Drawing.Size(104, 32); this.edit_condition_button.TabIndex = 75; this.edit_condition_button.Text = "Save"; this.edit_condition_button.Visible = false; this.edit_condition_button.Click += new System.EventHandler(this.edit_condition_button_Click); // // condition_lower_limit_textbox // this.condition_lower_limit_textbox.Enabled = false; this.condition_lower_limit_textbox.Location = new System.Drawing.Point(568, 344); this.condition_lower_limit_textbox.Name = "condition_lower_limit_textbox"; this.condition_lower_limit_textbox.Size = new System.Drawing.Size(72, 31); this.condition_lower_limit_textbox.TabIndex = 74; this.condition_lower_limit_textbox.Text = ""; this.condition_lower_limit_textbox.Visible = false; this.condition_lower_limit_textbox.TextChanged += new System.EventHandler(this.selected_condition_greater_textbox_TextChanged ); // // condition_lower_limit_label // this.condition_lower_limit_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_lower_limit_label.Location = new System.Drawing.Point(464, 352); this.condition_lower_limit_label.Name = "condition_lower_limit_label"; this.condition_lower_limit_label.Size = new System.Drawing.Size(96, 24); this.condition_lower_limit_label.TabIndex = 73; this.condition_lower_limit_label.Text = "Lower Limit"; this.condition_lower_limit_label.Visible = false;

39

this.condition_lower_limit_label.Click += new System.EventHandler(this.selected_condition_greater_label_Click); // // condition_upper_limit_textbox // this.condition_upper_limit_textbox.Enabled = false; this.condition_upper_limit_textbox.Location = new System.Drawing.Point(568, 296); this.condition_upper_limit_textbox.Name = "condition_upper_limit_textbox"; this.condition_upper_limit_textbox.Size = new System.Drawing.Size(72, 31); this.condition_upper_limit_textbox.TabIndex = 72; this.condition_upper_limit_textbox.Text = ""; this.condition_upper_limit_textbox.Visible = false; this.condition_upper_limit_textbox.TextChanged += new System.EventHandler(this.condition_upper_limit_textbox_TextChanged); // // condition_upper_limit_label // this.condition_upper_limit_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_upper_limit_label.Location = new System.Drawing.Point(464, 304); this.condition_upper_limit_label.Name = "condition_upper_limit_label"; this.condition_upper_limit_label.Size = new System.Drawing.Size(96, 24); this.condition_upper_limit_label.TabIndex = 71; this.condition_upper_limit_label.Text = "Upper Limit"; this.condition_upper_limit_label.Visible = false; // // selected_condition_label // this.selected_condition_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.selected_condition_label.Location = new System.Drawing.Point(432, 264); this.selected_condition_label.Name = "selected_condition_label"; this.selected_condition_label.Size = new System.Drawing.Size(216, 24); this.selected_condition_label.TabIndex = 70; this.selected_condition_label.Text = "Selected Condition\'s Limits"; this.selected_condition_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.selected_condition_label.Visible = false; // // upper_limit_checkbox // this.upper_limit_checkbox.Enabled = false;

40

this.upper_limit_checkbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.upper_limit_checkbox.Location = new System.Drawing.Point(16, 288); this.upper_limit_checkbox.Name = "upper_limit_checkbox"; this.upper_limit_checkbox.Size = new System.Drawing.Size(112, 24); this.upper_limit_checkbox.TabIndex = 69; this.upper_limit_checkbox.Text = "Upper Limit"; this.upper_limit_checkbox.CheckedChanged += new System.EventHandler(this.upper_limit_checkbox_CheckedChanged); // // lower_limit_checkbox // this.lower_limit_checkbox.Enabled = false; this.lower_limit_checkbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lower_limit_checkbox.Location = new System.Drawing.Point(16, 328); this.lower_limit_checkbox.Name = "lower_limit_checkbox"; this.lower_limit_checkbox.Size = new System.Drawing.Size(112, 24); this.lower_limit_checkbox.TabIndex = 68; this.lower_limit_checkbox.Text = "Lower Limit"; this.lower_limit_checkbox.CheckedChanged += new System.EventHandler(this.lower_limit_checkbox_CheckedChanged); // // remove_condition_button // this.remove_condition_button.BackColor = System.Drawing.Color.Red; this.remove_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.remove_condition_button.ForeColor = System.Drawing.Color.White; this.remove_condition_button.Location = new System.Drawing.Point(496, 72); this.remove_condition_button.Name = "remove_condition_button"; this.remove_condition_button.Size = new System.Drawing.Size(104, 40); this.remove_condition_button.TabIndex = 64; this.remove_condition_button.Text = "Delete"; this.remove_condition_button.Visible = false; this.remove_condition_button.Click += new System.EventHandler(this.remove_condition_button_Click); // // add_condition_button //

41

this.add_condition_button.BackColor = System.Drawing.Color.Green; this.add_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.add_condition_button.ForeColor = System.Drawing.Color.White; this.add_condition_button.Location = new System.Drawing.Point(40, 80); this.add_condition_button.Name = "add_condition_button"; this.add_condition_button.Size = new System.Drawing.Size(104, 40); this.add_condition_button.TabIndex = 63; this.add_condition_button.Text = "Add"; this.add_condition_button.Click += new System.EventHandler(this.add_condition_button_Click); // // current_condition_list1 // this.current_condition_list1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.current_condition_list1.ItemHeight = 16; this.current_condition_list1.Location = new System.Drawing.Point(232, 64); this.current_condition_list1.Name = "current_condition_list1"; this.current_condition_list1.Size = new System.Drawing.Size(192, 340); this.current_condition_list1.TabIndex = 62; this.current_condition_list1.SelectedIndexChanged += new System.EventHandler(this.current_condition_list1_SelectedIndexChanged); // // Attributes // this.Attributes.Font = new System.Drawing.Font("Arial", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Attributes.Location = new System.Drawing.Point(160, 32); this.Attributes.Name = "Attributes"; this.Attributes.Size = new System.Drawing.Size(328, 24); this.Attributes.TabIndex = 7; this.Attributes.Text = "Object\'s Current Detection Conditions"; this.Attributes.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // object_attributes_tab //

42

this.object_attributes_tab.Controls.Add(this.cancel_attribute_but ton); this.object_attributes_tab.Controls.Add(this.delete_attribute_but ton); this.object_attributes_tab.Controls.Add(this.edit_attribute_butto n); this.object_attributes_tab.Controls.Add(this.label2); this.object_attributes_tab.Controls.Add(this.created_attributes); this.object_attributes_tab.Controls.Add(this.create_attribute); this.object_attributes_tab.Controls.Add(this.attribute_name); this.object_attributes_tab.Controls.Add(this.attribute_label); this.object_attributes_tab.Controls.Add(this.Aggegrate); this.object_attributes_tab.Controls.Add(this.Aggregate); this.object_attributes_tab.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.object_attributes_tab.Location = new System.Drawing.Point(4, 22); this.object_attributes_tab.Name = "object_attributes_tab"; this.object_attributes_tab.Size = new System.Drawing.Size(672, 454); this.object_attributes_tab.TabIndex = 1; this.object_attributes_tab.Text = "Measurement Attributes"; // // cancel_attribute_button // this.cancel_attribute_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_attribute_button.Location = new System.Drawing.Point(328, 304); this.cancel_attribute_button.Name = "cancel_attribute_button"; this.cancel_attribute_button.Size = new System.Drawing.Size(88, 56); this.cancel_attribute_button.TabIndex = 73; this.cancel_attribute_button.Text = "Cancel"; this.cancel_attribute_button.Visible = false; this.cancel_attribute_button.Click += new System.EventHandler(this.cancel_attribute_button_Click); // // delete_attribute_button //

43

this.delete_attribute_button.BackColor = System.Drawing.Color.Red; this.delete_attribute_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.delete_attribute_button.ForeColor = System.Drawing.Color.White; this.delete_attribute_button.Location = new System.Drawing.Point(256, 376); this.delete_attribute_button.Name = "delete_attribute_button"; this.delete_attribute_button.Size = new System.Drawing.Size(160, 48); this.delete_attribute_button.TabIndex = 72; this.delete_attribute_button.Text = "Delete"; this.delete_attribute_button.Visible = false; this.delete_attribute_button.Click += new System.EventHandler(this.delete_attribute_button_Click); // // edit_attribute_button // this.edit_attribute_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.edit_attribute_button.Location = new System.Drawing.Point(256, 304); this.edit_attribute_button.Name = "edit_attribute_button"; this.edit_attribute_button.Size = new System.Drawing.Size(72, 56); this.edit_attribute_button.TabIndex = 71; this.edit_attribute_button.Text = "Save"; this.edit_attribute_button.Visible = false; this.edit_attribute_button.Click += new System.EventHandler(this.edit_attribute_button_Click); // // label2 // this.label2.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label2.Location = new System.Drawing.Point(40, 72); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(180, 24); this.label2.TabIndex = 70; this.label2.Text = "Current Attribute List"; this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // created_attributes // this.created_attributes.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F,

44

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.created_attributes.ItemHeight = 20; this.created_attributes.Location = new System.Drawing.Point(48, 96); this.created_attributes.Name = "created_attributes"; this.created_attributes.Size = new System.Drawing.Size(184, 324); this.created_attributes.TabIndex = 25; this.created_attributes.SelectedIndexChanged += new System.EventHandler(this.created_attributes_SelectedIndexChanged); // // create_attribute // this.create_attribute.BackColor = System.Drawing.Color.Green; this.create_attribute.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.create_attribute.ForeColor = System.Drawing.Color.White; this.create_attribute.Location = new System.Drawing.Point(256, 232); this.create_attribute.Name = "create_attribute"; this.create_attribute.Size = new System.Drawing.Size(160, 56); this.create_attribute.TabIndex = 24; this.create_attribute.Text = "Create"; this.create_attribute.Click += new System.EventHandler(this.create_attribute_Click); // // attribute_name // this.attribute_name.Location = new System.Drawing.Point(168, 16); this.attribute_name.Name = "attribute_name"; this.attribute_name.Size = new System.Drawing.Size(216, 31); this.attribute_name.TabIndex = 11; this.attribute_name.Text = ""; this.attribute_name.TextChanged += new System.EventHandler(this.attribute_name_TextChanged); // // attribute_label // this.attribute_label.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.attribute_label.Location = new System.Drawing.Point(16, 16); this.attribute_label.Name = "attribute_label"; this.attribute_label.Size = new System.Drawing.Size(136, 24); this.attribute_label.TabIndex = 10; this.attribute_label.Text = "Attribute Name";

45

this.attribute_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // attached_methods_tab // this.attached_methods_tab.Controls.Add(this.confirm_method_list); this.attached_methods_tab.Controls.Add(this.method_list_label); this.attached_methods_tab.Controls.Add(this.cancel_method_button) ; this.attached_methods_tab.Controls.Add(this.delete_method_button) ; this.attached_methods_tab.Controls.Add(this.other_method_listbox) ; this.attached_methods_tab.Controls.Add(this.other_browse_textbox) ; this.attached_methods_tab.Controls.Add(this.other_browse_button); this.attached_methods_tab.Controls.Add(this.method_name_label); this.attached_methods_tab.Controls.Add(this.method_name_textbox); this.attached_methods_tab.Controls.Add(this.other_methods_checkbo x); this.attached_methods_tab.Controls.Add(this.main_method_label); this.attached_methods_tab.Controls.Add(this.browse_textbox); this.attached_methods_tab.Controls.Add(this.browse_button); this.attached_methods_tab.Controls.Add(this.add_method_button); this.attached_methods_tab.Controls.Add(this.function_name_label); this.attached_methods_tab.Controls.Add(this.function_name_textbox ); this.attached_methods_tab.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.attached_methods_tab.Location = new System.Drawing.Point(4, 22); this.attached_methods_tab.Name = "attached_methods_tab"; this.attached_methods_tab.Size = new System.Drawing.Size(672, 454); this.attached_methods_tab.TabIndex = 2; this.attached_methods_tab.Text = "Attached Methods"; // // confirm_method_list

46

// this.confirm_method_list.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.confirm_method_list.Location = new System.Drawing.Point(184, 360); this.confirm_method_list.Name = "confirm_method_list"; this.confirm_method_list.Size = new System.Drawing.Size(128, 40); this.confirm_method_list.TabIndex = 16; this.confirm_method_list.Text = "Confirm Edit"; this.confirm_method_list.Visible = false; this.confirm_method_list.Click += new System.EventHandler(this.confirm_method_list_Click); // // method_list_label // this.method_list_label.Location = new System.Drawing.Point(472, 160); this.method_list_label.Name = "method_list_label"; this.method_list_label.Size = new System.Drawing.Size(168, 24); this.method_list_label.TabIndex = 15; this.method_list_label.Text = "Method List"; this.method_list_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.method_list_label.Visible = false; // // cancel_method_button // this.cancel_method_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_method_button.Location = new System.Drawing.Point(312, 360); this.cancel_method_button.Name = "cancel_method_button"; this.cancel_method_button.Size = new System.Drawing.Size(128, 40); this.cancel_method_button.TabIndex = 14; this.cancel_method_button.Text = "Cancel"; this.cancel_method_button.Visible = false; this.cancel_method_button.Click += new System.EventHandler(this.cancel_method_button_Click); // // delete_method_button // this.delete_method_button.BackColor = System.Drawing.Color.Red; this.delete_method_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

47

this.delete_method_button.ForeColor = System.Drawing.Color.White; this.delete_method_button.Location = new System.Drawing.Point(184, 312); this.delete_method_button.Name = "delete_method_button"; this.delete_method_button.Size = new System.Drawing.Size(128, 32); this.delete_method_button.TabIndex = 12; this.delete_method_button.Text = "Delete"; this.delete_method_button.Visible = false; this.delete_method_button.Click += new System.EventHandler(this.delete_method_button_Click); // // other_method_listbox // this.other_method_listbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.other_method_listbox.ItemHeight = 20; this.other_method_listbox.Location = new System.Drawing.Point(472, 192); this.other_method_listbox.Name = "other_method_listbox"; this.other_method_listbox.Size = new System.Drawing.Size(168, 244); this.other_method_listbox.TabIndex = 11; this.other_method_listbox.Visible = false; this.other_method_listbox.SelectedIndexChanged += new System.EventHandler(this.other_method_listbox_SelectedIndexChanged); // // other_browse_textbox // this.other_browse_textbox.Location = new System.Drawing.Point(144, 264); this.other_browse_textbox.Name = "other_browse_textbox"; this.other_browse_textbox.Size = new System.Drawing.Size(288, 31); this.other_browse_textbox.TabIndex = 10; this.other_browse_textbox.Text = ""; this.other_browse_textbox.Visible = false; // // other_browse_button // this.other_browse_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.other_browse_button.Location = new System.Drawing.Point(24, 264); this.other_browse_button.Name = "other_browse_button"; this.other_browse_button.Size = new System.Drawing.Size(96, 32); this.other_browse_button.TabIndex = 9;

48

this.other_browse_button.Text = "Path"; this.other_browse_button.Visible = false; this.other_browse_button.Click += new System.EventHandler(this.other_browse_button_Click); // // method_name_label // this.method_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.method_name_label.Location = new System.Drawing.Point(24, 200); this.method_name_label.Name = "method_name_label"; this.method_name_label.Size = new System.Drawing.Size(120, 32); this.method_name_label.TabIndex = 8; this.method_name_label.Text = "Method Name"; this.method_name_label.Visible = false; // // method_name_textbox // this.method_name_textbox.Location = new System.Drawing.Point(144, 192); this.method_name_textbox.Name = "method_name_textbox"; this.method_name_textbox.Size = new System.Drawing.Size(288, 31); this.method_name_textbox.TabIndex = 7; this.method_name_textbox.Text = ""; this.method_name_textbox.Visible = false; // // other_methods_checkbox // this.other_methods_checkbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.other_methods_checkbox.Location = new System.Drawing.Point(24, 144); this.other_methods_checkbox.Name = "other_methods_checkbox"; this.other_methods_checkbox.Size = new System.Drawing.Size(192, 40); this.other_methods_checkbox.TabIndex = 6; this.other_methods_checkbox.Text = "Include Other Methods"; this.other_methods_checkbox.CheckedChanged += new System.EventHandler(this.other_methods_checkbox_CheckedChanged); // // main_method_label // this.main_method_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

49

this.main_method_label.Location = new System.Drawing.Point(24, 64); this.main_method_label.Name = "main_method_label"; this.main_method_label.Size = new System.Drawing.Size(112, 16); this.main_method_label.TabIndex = 5; this.main_method_label.Text = "Main Method"; // // browse_textbox // this.browse_textbox.Location = new System.Drawing.Point(152, 88); this.browse_textbox.Name = "browse_textbox"; this.browse_textbox.Size = new System.Drawing.Size(504, 31); this.browse_textbox.TabIndex = 4; this.browse_textbox.Text = ""; // // browse_button // this.browse_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.browse_button.Location = new System.Drawing.Point(24, 88); this.browse_button.Name = "browse_button"; this.browse_button.Size = new System.Drawing.Size(96, 32); this.browse_button.TabIndex = 3; this.browse_button.Text = "Path"; this.browse_button.Click += new System.EventHandler(this.browse_button_Click); // // add_method_button // this.add_method_button.BackColor = System.Drawing.Color.Green; this.add_method_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.add_method_button.ForeColor = System.Drawing.Color.White; this.add_method_button.Location = new System.Drawing.Point(312, 312); this.add_method_button.Name = "add_method_button"; this.add_method_button.Size = new System.Drawing.Size(128, 32); this.add_method_button.TabIndex = 2; this.add_method_button.Text = "Add"; this.add_method_button.Visible = false; this.add_method_button.Click += new System.EventHandler(this.add_method_button_Click); // // function_name_label //

50

this.function_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.function_name_label.Location = new System.Drawing.Point(32, 16); this.function_name_label.Name = "function_name_label"; this.function_name_label.Size = new System.Drawing.Size(120, 32); this.function_name_label.TabIndex = 1; this.function_name_label.Text = "Function Name"; // // function_name_textbox // this.function_name_textbox.Location = new System.Drawing.Point(152, 16); this.function_name_textbox.Name = "function_name_textbox"; this.function_name_textbox.Size = new System.Drawing.Size(288, 31); this.function_name_textbox.TabIndex = 0; this.function_name_textbox.Text = ""; this.function_name_textbox.TextChanged += new System.EventHandler(this.function_name_textbox_TextChanged); // // condition_library_list // this.condition_library_list.Enabled = false; this.condition_library_list.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_library_list.ItemHeight = 16; this.condition_library_list.Location = new System.Drawing.Point(8, 304); this.condition_library_list.Name = "condition_library_list"; this.condition_library_list.Size = new System.Drawing.Size(192, 116); this.condition_library_list.TabIndex = 65; this.condition_library_list.Visible = false; this.condition_library_list.SelectedIndexChanged += new System.EventHandler(this.condition_library_list_SelectedIndexChanged); // // condition_library_label // this.condition_library_label.Font = new System.Drawing.Font("Arial", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_library_label.Location = new System.Drawing.Point(32, 280); this.condition_library_label.Name = "condition_library_label";

51

this.condition_library_label.Size = new System.Drawing.Size(144, 24); this.condition_library_label.TabIndex = 61; this.condition_library_label.Text = "Condition Library"; this.condition_library_label.Visible = false; // // object_list_box // this.object_list_box.ItemHeight = 16; this.object_list_box.Location = new System.Drawing.Point(8, 72); this.object_list_box.Name = "object_list_box"; this.object_list_box.Size = new System.Drawing.Size(168, 196); this.object_list_box.TabIndex = 31; this.object_list_box.Visible = false; this.object_list_box.SelectedIndexChanged += new System.EventHandler(this.object_list_box_SelectedIndexChanged_1); // // delete_object_button // this.delete_object_button.BackColor = System.Drawing.Color.Red; this.delete_object_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.delete_object_button.ForeColor = System.Drawing.Color.White; this.delete_object_button.Location = new System.Drawing.Point(192, 112); this.delete_object_button.Name = "delete_object_button"; this.delete_object_button.Size = new System.Drawing.Size(120, 24); this.delete_object_button.TabIndex = 30; this.delete_object_button.Text = "Delete"; this.delete_object_button.Visible = false; this.delete_object_button.Click += new System.EventHandler(this.delete_object_button_Click_1); // // object_list_label // this.object_list_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.object_list_label.ImageAlign = System.Drawing.ContentAlignment.TopCenter; this.object_list_label.Location = new System.Drawing.Point(48, 48); this.object_list_label.Name = "object_list_label"; this.object_list_label.Size = new System.Drawing.Size(104, 24); this.object_list_label.TabIndex = 29;

52

this.object_list_label.Text = "Object List"; this.object_list_label.Visible = false; // // add_object_button // this.add_object_button.BackColor = System.Drawing.Color.Green; this.add_object_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.add_object_button.ForeColor = System.Drawing.Color.White; this.add_object_button.Location = new System.Drawing.Point(192, 72); this.add_object_button.Name = "add_object_button"; this.add_object_button.Size = new System.Drawing.Size(120, 24); this.add_object_button.TabIndex = 28; this.add_object_button.Text = "Add"; this.add_object_button.Visible = false; this.add_object_button.Click += new System.EventHandler(this.add_object_button_Click_1); // // object_name_textbox // this.object_name_textbox.Location = new System.Drawing.Point(320, 72); this.object_name_textbox.Name = "object_name_textbox"; this.object_name_textbox.Size = new System.Drawing.Size(184, 22); this.object_name_textbox.TabIndex = 27; this.object_name_textbox.Text = ""; this.object_name_textbox.Visible = false; // // object_name_label // this.object_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.object_name_label.Location = new System.Drawing.Point(360, 48); this.object_name_label.Name = "object_name_label"; this.object_name_label.Size = new System.Drawing.Size(112, 24); this.object_name_label.TabIndex = 26; this.object_name_label.Text = "Object Name"; this.object_name_label.Visible = false; // // edit_object_button // this.edit_object_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

53

this.edit_object_button.Location = new System.Drawing.Point(192, 152); this.edit_object_button.Name = "edit_object_button"; this.edit_object_button.Size = new System.Drawing.Size(120, 24); this.edit_object_button.TabIndex = 32; this.edit_object_button.Text = "Edit"; this.edit_object_button.Visible = false; this.edit_object_button.Click += new System.EventHandler(this.edit_object_button_Click); // // save_changes_button // this.save_changes_button.BackColor = System.Drawing.SystemColors.Control; this.save_changes_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.save_changes_button.Location = new System.Drawing.Point(8, 24); this.save_changes_button.Name = "save_changes_button"; this.save_changes_button.Size = new System.Drawing.Size(184, 56); this.save_changes_button.TabIndex = 33; this.save_changes_button.Text = "Save Changes"; this.save_changes_button.Visible = false; this.save_changes_button.Click += new System.EventHandler(this.save_changes_button_Click); // // cancel_changes_button // this.cancel_changes_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_changes_button.Location = new System.Drawing.Point(192, 24); this.cancel_changes_button.Name = "cancel_changes_button"; this.cancel_changes_button.Size = new System.Drawing.Size(176, 56); this.cancel_changes_button.TabIndex = 34; this.cancel_changes_button.Text = "Cancel Changes"; this.cancel_changes_button.Visible = false; this.cancel_changes_button.Click += new System.EventHandler(this.cancel_changes_button_Click); // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(25, 25); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageLis t1.ImageStream")));

54

this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // toolBar1 // this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {

this.toolBarButton1,

this.toolBarButton2,

this.toolBarButton3,

this.toolBarButton4,

this.toolBarButton5,

this.toolBarButton6,

this.toolBarButton7}); this.toolBar1.ButtonSize = new System.Drawing.Size(25, 25); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList1; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(896, 37); this.toolBar1.TabIndex = 66; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_Butto nClick); // // toolBarButton1 // this.toolBarButton1.ImageIndex = 0; // // toolBarButton2 // this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton3 // this.toolBarButton3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; //

55

// toolBarButton4 // this.toolBarButton4.ImageIndex = 2; // // toolBarButton5 // this.toolBarButton5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton6 // this.toolBarButton6.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton7 // this.toolBarButton7.ImageIndex = 1; // // cancel_object_button // this.cancel_object_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_object_button.Location = new System.Drawing.Point(328, 152); this.cancel_object_button.Name = "cancel_object_button"; this.cancel_object_button.Size = new System.Drawing.Size(120, 24); this.cancel_object_button.TabIndex = 67; this.cancel_object_button.Text = "Cancel"; this.cancel_object_button.Visible = false; this.cancel_object_button.Click += new System.EventHandler(this.cancel_object_button_Click); // // rename_object_button // this.rename_object_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.rename_object_button.Location = new System.Drawing.Point(328, 112); this.rename_object_button.Name = "rename_object_button"; this.rename_object_button.Size = new System.Drawing.Size(120, 24); this.rename_object_button.TabIndex = 68; this.rename_object_button.Text = "Rename"; this.rename_object_button.Visible = false; this.rename_object_button.Click += new System.EventHandler(this.rename_object_button_Click); // // save_object_name //

56

this.save_object_name.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.save_object_name.Location = new System.Drawing.Point(520, 72); this.save_object_name.Name = "save_object_name"; this.save_object_name.Size = new System.Drawing.Size(56, 24); this.save_object_name.TabIndex = 69; this.save_object_name.Text = "Save"; this.save_object_name.Visible = false; this.save_object_name.Click += new System.EventHandler(this.save_object_name_Click); // // cancel_rename_button // this.cancel_rename_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_rename_button.Location = new System.Drawing.Point(576, 72); this.cancel_rename_button.Name = "cancel_rename_button"; this.cancel_rename_button.Size = new System.Drawing.Size(72, 24); this.cancel_rename_button.TabIndex = 70; this.cancel_rename_button.Text = "Cancel"; this.cancel_rename_button.Visible = false; this.cancel_rename_button.Click += new System.EventHandler(this.cancel_rename_button_Click); // // add_object_button_toolTip // this.add_object_button_toolTip.AutoPopDelay = 5000; this.add_object_button_toolTip.InitialDelay = 200; this.add_object_button_toolTip.ReshowDelay = 100; // // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(280, 176); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(424, 360); this.pictureBox1.TabIndex = 71; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // condition_unit // this.condition_unit.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F,

57

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_unit.Location = new System.Drawing.Point(32, 24); this.condition_unit.Name = "condition_unit"; this.condition_unit.Size = new System.Drawing.Size(120, 24); this.condition_unit.TabIndex = 84; // // condition_description_groupBox // this.condition_description_groupBox.Controls.Add(this.condition_d escription_textBox); this.condition_description_groupBox.Location = new System.Drawing.Point(16, 496); this.condition_description_groupBox.Name = "condition_description_groupBox"; this.condition_description_groupBox.Size = new System.Drawing.Size(184, 128); this.condition_description_groupBox.TabIndex = 85; this.condition_description_groupBox.TabStop = false; this.condition_description_groupBox.Text = "Condition Description"; this.condition_description_groupBox.Visible = false; // // condition_description_textBox // this.condition_description_textBox.Location = new System.Drawing.Point(8, 32); this.condition_description_textBox.Name = "condition_description_textBox"; this.condition_description_textBox.Size = new System.Drawing.Size(168, 88); this.condition_description_textBox.TabIndex = 0; this.condition_description_textBox.Text = ""; // // unit_groupBox // this.unit_groupBox.Controls.Add(this.condition_unit); this.unit_groupBox.Location = new System.Drawing.Point(16, 432); this.unit_groupBox.Name = "unit_groupBox"; this.unit_groupBox.Size = new System.Drawing.Size(184, 56); this.unit_groupBox.TabIndex = 86; this.unit_groupBox.TabStop = false; this.unit_groupBox.Text = "Unit"; this.unit_groupBox.Visible = false; // // object_changes_groupBox // this.object_changes_groupBox.Controls.Add(this.cancel_changes_but ton);

58

this.object_changes_groupBox.Controls.Add(this.save_changes_butto n); this.object_changes_groupBox.Location = new System.Drawing.Point(456, 96); this.object_changes_groupBox.Name = "object_changes_groupBox"; this.object_changes_groupBox.Size = new System.Drawing.Size(376, 88); this.object_changes_groupBox.TabIndex = 87; this.object_changes_groupBox.TabStop = false; this.object_changes_groupBox.Text = "Object Options"; this.object_changes_groupBox.Visible = false; // // CloseMenuItem // this.CloseMenuItem.Index = 3; this.CloseMenuItem.Text = "Close"; this.CloseMenuItem.Click += new System.EventHandler(this.CloseMenuItem_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(896, 681); this.Controls.Add(this.object_changes_groupBox); this.Controls.Add(this.unit_groupBox); this.Controls.Add(this.cancel_rename_button); this.Controls.Add(this.save_object_name); this.Controls.Add(this.rename_object_button); this.Controls.Add(this.cancel_object_button); this.Controls.Add(this.toolBar1); this.Controls.Add(this.edit_object_button); this.Controls.Add(this.object_list_box); this.Controls.Add(this.delete_object_button); this.Controls.Add(this.object_list_label); this.Controls.Add(this.add_object_button); this.Controls.Add(this.object_name_textbox); this.Controls.Add(this.object_name_label); this.Controls.Add(this.tabs); this.Controls.Add(this.condition_library_label); this.Controls.Add(this.condition_library_list); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.condition_description_groupBox); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Menu = this.mainMenu1; this.Name = "Form1"; this.Text = "EnviroTrack"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.Form1_Load); this.tabs.ResumeLayout(false);

59

this.object_context_tab.ResumeLayout(false); this.object_attributes_tab.ResumeLayout(false); this.attached_methods_tab.ResumeLayout(false); this.condition_description_groupBox.ResumeLayout(false); this.unit_groupBox.ResumeLayout(false); this.object_changes_groupBox.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); }

private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { } private void EnviroTrack_Load(object sender, System.EventArgs e) {

} private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e) { //we are in the methods tab so make left panel disappear if( tabs.SelectedIndex == 2 ) { condition_library_label.Visible = false; condition_library_list.Visible = false; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; return; } if(tabs.Visible == true) { condition_library_label.Visible = true; condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true;

60

condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; }

//tab 1 upper_limit_checkbox.Visible = true; upper_limit_checkbox.Checked = false; upper_limit_input.Text = ""; upper_limit_input.Enabled = false; upper_limit_input.Visible = true; datatype_drop_box.Visible = true; datatype_drop_box.SelectedIndex = -1; datatype_label.Visible = true; lower_limit_checkbox.Visible = true; lower_limit_checkbox.Checked = false; lower_limit_input.Text = ""; lower_limit_input.Enabled = false; lower_limit_input.Visible = true; remove_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_lower_limit_label.Visible = false; condition_upper_limit_textbox.Text = ""; condition_upper_limit_textbox.Visible = false; condition_lower_limit_textbox.Text = ""; condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box1.SelectedIndex = -1; current_condition_list1.ClearSelected(); add_condition_button.Visible = true;

//tab2 attribute_name.Text = ""; create_attribute.Visible = true; created_attributes.ClearSelected(); edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; Aggregate.ClearSelected(); //tab3 if(other_methods_checkbox.Checked == true) { method_name_textbox.Text = ""; other_browse_textbox.Text = ""; add_method_button.Visible = true; cancel_method_button.Visible = false; delete_method_button.Visible = false;

61

other_method_listbox.ClearSelected(); } } private void tabPage1_Click(object sender, System.EventArgs e) { }

private void create_attribute_Click(object sender, System.EventArgs e) { if( condition_library_list.SelectedIndex == -1 ) { MessageBox.Show("Please select a condition!"); return; } if( Aggregate.SelectedIndex == -1 ) { MessageBox.Show("Please select an aggregate function!"); return; } if( isValidName(attribute_name.Text) == false ) { MessageBox.Show("Name cannot be null or contain + ~ , | _ -"); attribute_name.Text = ""; return; } for( int i = 0; i < myObject.getAttributeCollectionSize(); i++) { if( attribute_name.Text.ToString().Equals(myObject.getAttributeCollection() .getAttributeAt(i).getName())) { MessageBox.Show("That attribute already exists!"); return; } } created_attributes.Items.Add(attribute_name.Text); String aggregation_function = Aggregate.SelectedItem.ToString(); String selectedCondition = condition_library_list.SelectedItem.ToString(); Condition dummyCondition = new Condition(); dummyCondition.setName(selectedCondition); dummyCondition.setUnit(condition_unit.Text);

62

Attribute dummyAttribute = new Attribute(attribute_name.Text.ToString(),dummyCondition,aggregation_fun ction); myObject.addAttribute(dummyAttribute); attribute_name.Text = ""; Aggregate.ClearSelected(); created_attributes.ClearSelected(); condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; } private void exit_Click(object sender, System.EventArgs e) { //force cancel or save object changes before continuing to exit if( tabs.Visible == true ) { MessageBox.Show("Cancel or Save Object changes before continuing!"); return; } Close(); } //open a project file private void open_menu_Click(object sender, System.EventArgs e) { //force cancel or save object changes before continuing to open new Project if( tabs.Visible == true ) { MessageBox.Show("Cancel or Save Object changes before continuing"); return; } if( myProject.hasSaved == false ) { string caption = "The project has changed."; string message = "Save before opening new?"; MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) //save first, then open new {

63

// Call save this.save_menu_Click(sender, e); if( clickedOKFromSave == true ) { reinitialize(); } else { return; } } else if( result == DialogResult.No ) //don't save, just open new { reinitialize(); } else if( result == DialogResult.Cancel ) //do nothing, cancel { return; } } OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text files (*.txt)|*.txt"; ofd.Title = "Please select a Project File to use"; ofd.RestoreDirectory = true; ofd.InitialDirectory = "Projects\\config"; ofd.RestoreDirectory = true; //restores root directory if ( ofd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( ofd.FileName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream ); String input; input = sreader.ReadLine(); if ( !input.Equals( "*** Project File ***" ) ) { MessageBox.Show("Project file corrupt!"); sreader.Close(); fstream.Close(); return; } object_list_box.Items.Clear(); while ( true ) { input = sreader.ReadLine(); if ( input == null ) break; Object dummyObject = new Object();

64

String[] parts = null; char[] major_delimiter = "|".ToCharArray(); int max_parts = 4; //name of object, detection conditions, attributes, methods // Use split to parse parts = input.Split(major_delimiter, max_parts ); String objectName = parts[0].ToString(); dummyObject.setName(objectName.ToString()); String detectionConditions = parts[1].ToString(); char[] secondary_delimiter = "".ToCharArray(); int numberOfConditions = 0; char[] condition_delimiter = ",".ToCharArray(); //use parts[1] to reconstruct detection conditions //go through the detection condition string and count all condition delimiters for( int i = 0; i < detectionConditions.Length; i++) { if( detectionConditions[i].Equals(condition_delimiter[0]) ) numberOfConditions++; } numberOfConditions++; //account for last condition String[] conditionGroup = detectionConditions.Split(condition_delimiter,numberOfConditions); for( int i = 0; i < conditionGroup.Length; i++ ) { String[] oneCondition = conditionGroup[i].Split(secondary_delimiter,5); Condition dummyCondition = new Condition(); for(int j = 0; j < oneCondition.Length; j++) { if( j == 0 ) { dummyCondition.setName(oneCondition[0].ToString()); }

65

else if( j == 1 ) { dummyCondition.setUnit(oneCondition[1].ToString()); } else if( j == 2 ) { dummyCondition.setLowerLimit(oneCondition[2].ToString()); } else if( j == 3 ) { dummyCondition.setUpperLimit(oneCondition[3].ToString()); } else if( j == 4 ) { dummyCondition.setDataType(oneCondition[4].ToString()); } }

dummyObject.addCondition(dummyCondition); } //use parts[2] to reconstruct attributes////////////////////// int numberOfAttributes = 0; char[] attribute_delimiter = "~".ToCharArray(); String Attributes = parts[2].ToString(); for( int i = 0; i < Attributes.Length; i++ ) { if( Attributes[i].Equals(attribute_delimiter[0]) ) numberOfAttributes++; } numberOfAttributes++; //account for last attribute String[] attributeGroup = Attributes.Split(attribute_delimiter,numberOfAttributes); for( int i = 0; i < attributeGroup.Length; i++ ) { String[] oneAttribute = attributeGroup[i].Split(secondary_delimiter,3); Attribute dummyAttribute = new Attribute(); for( int j = 0; j < oneAttribute.Length; j++ )

66

{ if( j == 0 ) { dummyAttribute.setName(oneAttribute[0].ToString()); } else if( j == 1 ) { dummyAttribute.setAggregationFunction(oneAttribute[1].ToString()) ; } else if( j == 2 ) { dummyAttribute.getCondition().setName(oneAttribute[2].ToString()) ; } }

dummyObject.addAttribute(dummyAttribute); } //use parts[3] to reconstruct method information////////////////////// int numberOfMethods = 0; char[] method_delimiter = "~".ToCharArray(); String Methods = parts[3].ToString(); for( int i = 0; i < Methods.Length; i++ ) { if( Methods[i].Equals(method_delimiter[0]) ) numberOfMethods++; } numberOfMethods++; //account for last method String[] methodGroup = Methods.Split(method_delimiter,numberOfMethods); char[] method_name_path_delimiter = "+".ToCharArray();

for( int i = 0; i < methodGroup.Length; i++ ) { String[] oneMethod = methodGroup[i].Split(method_name_path_delimiter,2); if( oneMethod.Length != 1 ) {

67

if( i == 0 ) { dummyObject.getMainMethod().setName(oneMethod[0].ToString()); dummyObject.getMainMethod().setPath(oneMethod[1].ToString()); } else { Method dummyMethod = new Method(); dummyMethod.setName(oneMethod[0].ToString()); dummyMethod.setPath(oneMethod[1].ToString()); dummyObject.addMethod(dummyMethod); } } }

object_list_box.Items.Add( dummyObject.getName() ); myProject.addObject(dummyObject); //add this object to the project } sreader.Close(); fstream.Close(); if( openConditionLibrary() == true ) { } else { reinitialize(); return; } object_name_textbox.Visible = true; add_object_button.Visible = true; object_list_label.Visible = true; object_list_box.Visible = true; object_name_label.Visible = true; pictureBox1.Visible = false; condition_library_label.Visible = false; condition_library_list.Visible = false; condition_library_list.ClearSelected(); unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; tabs.Visible = false; object_list_box.Enabled = true; resetTabs(); save_changes_button.Visible = false;

68

cancel_changes_button.Visible = false; } } public bool openConditionLibrary() { FileInfo fi = new FileInfo(default_condition_library_path); if( fi.Exists == false ) { MessageBox.Show(fi.FullName); } FileStream fstream = new FileStream( fi.FullName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream ); String input; input = sreader.ReadLine(); if ( !input.Equals( "*** Condition Library ***" ) ) { sreader.Close(); fstream.Close(); MessageBox.Show("Error reading condition library file"); Close(); return false; } condition_library_list.Items.Clear(); condition_unit.Text = ""; condition_description_textBox.Text = ""; myProject.getConditionCollection().deleteCollection(); while ( true ) { input = sreader.ReadLine(); if ( input == null ) break; // Use split to parse parts = input.Split(delimiter, max_parts ); //only display the name and unit of the condition, not the path condition_library_list.Items.Add(parts[0].ToString()); Condition dummyCondition = new Condition(); dummyCondition.setName(parts[0].ToString()); //name dummyCondition.setUnit(parts[1].ToString()); //unit

69

dummyCondition.getMethod().setName(parts[2].ToString()); //method name dummyCondition.getMethod().setPath(parts[3].ToString()); //method path dummyCondition.setDescription(parts[4].ToString()); //condition description dummyCondition.setDataType(parts[5].ToString()); //datatype

myProject.getConditionCollection().addCondition(dummyCondition); } sreader.Close(); fstream.Close(); return true; } public bool changeConditionLibrary() { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "Libraries\\Condition Library"; ofd.Title = "Open a Condition Library"; ofd.Filter = "Text files (*.txt)|*.txt"; ofd.RestoreDirectory = true; if ( ofd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( ofd.FileName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream ); String input; input = sreader.ReadLine(); if ( !input.Equals( "*** Condition Library ***" ) ) { sreader.Close(); fstream.Close(); MessageBox.Show("Error reading condition library file"); Close(); return false; } condition_library_list.Items.Clear(); condition_unit.Text = ""; condition_description_textBox.Text = ""; myProject.getConditionCollection().deleteCollection();

70

while ( true ) { input = sreader.ReadLine(); if ( input == null ) break; // Use split to parse parts = input.Split(delimiter, max_parts ); //only display the name and unit of the condition, not the path condition_library_list.Items.Add(parts[0].ToString()); Condition dummyCondition = new Condition(); dummyCondition.setName(parts[0].ToString()); //name dummyCondition.setUnit(parts[1].ToString()); //unit dummyCondition.getMethod().setName(parts[2].ToString()); //method name dummyCondition.getMethod().setPath(parts[3].ToString()); //method path dummyCondition.setDescription(parts[4].ToString()); //condition description dummyCondition.setDataType(parts[5].ToString()); //datatype

myProject.getConditionCollection().addCondition(dummyCondition); } sreader.Close(); fstream.Close(); changedPath = true; condition_library_label.Visible = true; condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true; return true; }//end if return false; } public void openAggregationLibrary() { FileStream fstream2 = new FileStream( "Libraries/Aggregation Library/config/aggregation_methods.txt", FileMode.Open); StreamReader sreader2 = new StreamReader( fstream2 );

71

String input2; input2 = sreader2.ReadLine(); if ( !input2.Equals( "*** Aggregation Methods Library ***" ) ) { sreader2.Close(); fstream2.Close(); return; } while ( true ) { input2 = sreader2.ReadLine(); if ( input2 == null ) break; Aggregate.Items.Add(input2); } sreader2.Close(); fstream2.Close(); } public void reinitialize() { myProject.reset(); myProject.hasSaved = true; myObject.reset(); object_list_box.Items.Clear(); condition_library_list.Items.Clear(); object_name_textbox.Text = ""; pictureBox1.Visible = true; object_list_label.Visible = false; object_list_box.Visible = false; condition_library_label.Visible = false; condition_library_list.Visible = false; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; add_object_button.Visible = false; object_name_label.Visible = false; object_name_textbox.Visible = false; save_object_name.Visible = false; cancel_rename_button.Visible = false; cancel_object_button.Visible = false; rename_object_button.Visible = false; edit_object_button.Visible = false; delete_object_button.Visible = false; save_changes_button.Visible = false; cancel_changes_button.Visible = false; object_changes_groupBox.Visible = false; tabs.Visible = false; }

72

private void new_menu_Click(object sender, System.EventArgs e) { //force cancel or save object changes before continuing to open new Project if( tabs.Visible == true ) { MessageBox.Show("Cancel or Save Object changes before continuing"); return; } if( myProject.hasSaved == false ) { string caption = "The project has changed."; string message = "Save before creating a new project?"; MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) //save first, then open new { // Call save this.save_menu_Click(sender, e); if( clickedOKFromSave == true ) { reinitialize(); } else { return; } } else if( result == DialogResult.No ) //don't save, just open new { reinitialize(); } else if( result == DialogResult.Cancel ) //do nothing, cancel { return; } } if( openConditionLibrary() == true) { resetApp(); }

73

} public void resetApp() { object_list_box.Enabled = true; delete_object_button.Enabled = true; delete_object_button.Visible = false; rename_object_button.Visible = false; edit_object_button.Visible = false; cancel_object_button.Visible = false; save_object_name.Visible = false; cancel_rename_button.Visible = false; add_object_button.Enabled = true; edit_object_button.Enabled = true; object_name_textbox.Enabled = true; myProject.getObjectCollection().deleteCollection(); myProject.setName("Default Project Name"); myProject.setSaved(true); condition_library_label.Visible = false; condition_library_list.Visible = false; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; myObject = new Object(); tabs.Enabled = false; object_list_box.Items.Clear(); object_name_textbox.Text = "";

object_list_label.Visible = true; object_name_label.Visible = true; object_name_textbox.Visible = true; add_object_button.Visible = true; object_list_box.Visible = true; pictureBox1.Visible = false; resetTabs(); } public void resetTabs() { condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; //tab 1 upper_limit_checkbox.Visible = true; upper_limit_checkbox.Checked = false; upper_limit_input.Text = ""; upper_limit_input.Enabled = false; upper_limit_input.Visible = true; lower_limit_checkbox.Visible = true; lower_limit_checkbox.Checked = false;

74

lower_limit_input.Text = ""; lower_limit_input.Enabled = false; lower_limit_input.Visible = true; current_condition_list1.Items.Clear(); remove_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_lower_limit_label.Visible = false; condition_upper_limit_textbox.Text = ""; condition_upper_limit_textbox.Visible = false; condition_lower_limit_textbox.Text = ""; condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; current_condition_list1.ClearSelected(); add_condition_button.Visible = true; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box1.SelectedIndex = -1; //tab2 attribute_name.Text = ""; created_attributes.Items.Clear(); create_attribute.Visible = true; edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; Aggregate.ClearSelected(); //tab3 function_name_textbox.Text = ""; browse_textbox.Text = ""; other_methods_checkbox.Checked = false; method_name_label.Visible = false; method_name_textbox.Visible = false; other_browse_button.Visible = false; other_browse_textbox.Visible = false; method_list_label.Visible = false; other_method_listbox.Visible = false; other_method_listbox.Items.Clear(); add_method_button.Visible = false; cancel_method_button.Visible = false; confirm_method_list.Visible = false; delete_method_button.Visible = false; tabs.SelectedIndex = 0; } private void save_menu_Click(object sender, System.EventArgs e) { if( pictureBox1.Visible == true ) { MessageBox.Show("There is nothing to Save."); return; }

75

//if currently working on an object ask to cancel or save object changes //before saving the project if( tabs.Visible == true ) { MessageBox.Show("Please cancel or save object changes before saving Project!"); return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Text files (*.txt)|*.txt"; sfd.InitialDirectory = "Projects\\config"; sfd.RestoreDirectory = true; if ( sfd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( sfd.FileName, FileMode.Create ); StreamWriter swriter = new StreamWriter( fstream ); swriter.Write( "*** Project File ***" ); swriter.Write( "\n" ); swriter.Write(myProject.print()); swriter.Close(); fstream.Close(); MessageBox.Show("Project has been successfully saved"); clickedOKFromSave = true; myProject.setSaved(true); return; } else { clickedOKFromSave = false; } return; }

private void Create_Click(object sender, System.EventArgs e) { } private void new_object_Click(object sender, System.EventArgs e) { object_name_label.Enabled = true;

76

object_name_textbox.Enabled = true; } private void checkedListBox1_SelectedIndexChanged(object sender, System.EventArgs e) {

}

private void Form1_Load(object sender, System.EventArgs e) { } private void current_condition_list1_SelectedIndexChanged(object sender, System.EventArgs e) { if(current_condition_list1.SelectedIndex == -1 ) return; edit_condition_button.Enabled = true; condition_upper_limit_textbox.Enabled = true; condition_lower_limit_textbox.Enabled = true; condition_library_list.ClearSelected(); condition_library_label.Visible = false; condition_library_list.Visible = false; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; Condition dummyCondition = new Condition(); dummyCondition = myObject.getConditionCollection().getConditionAt(current_condition_list 1.SelectedIndex); for(int i = 0; i < condition_library_list.Items.Count; i++) { if( condition_library_list.Items[i].ToString().Equals(dummyCondition.getNam e()) ) { condition_library_list.SelectedIndex = i; } } if(dummyCondition.getUpperLimit() == "_") condition_upper_limit_textbox.Text = ""; else condition_upper_limit_textbox.Text = dummyCondition.getUpperLimit();

77

if(dummyCondition.getLowerLimit() == "_") condition_lower_limit_textbox.Text = ""; else condition_lower_limit_textbox.Text = dummyCondition.getLowerLimit(); switch(dummyCondition.getDataType()) { case "Boolean": datatype_drop_box1.SelectedIndex = 0; condition_upper_limit_textbox.Enabled = false; condition_lower_limit_textbox.Enabled = false; break; case "Integer": datatype_drop_box1.SelectedIndex = 1; condition_upper_limit_textbox.Enabled = true; condition_lower_limit_textbox.Enabled = true; break; case "Float": datatype_drop_box1.SelectedIndex = 2; condition_upper_limit_textbox.Enabled = true; condition_lower_limit_textbox.Enabled = true; break; default:

MessageBox.Show("ERROR"); break;

} selected_condition_label.Visible = true; condition_upper_limit_label.Visible = true; condition_lower_limit_label.Visible = true; edit_condition_button.Visible = true; cancel_condition_button.Visible = true; condition_upper_limit_textbox.Visible = true; condition_lower_limit_textbox.Visible = true; datatype_label1.Visible = true; datatype_drop_box1.Visible = true; datatype_label.Visible = false; datatype_drop_box.Visible = false; add_condition_button.Visible = false; remove_condition_button.Visible = true; upper_limit_checkbox.Visible = false; upper_limit_checkbox.Checked = false; upper_limit_input.Visible = false; upper_limit_input.Text = ""; lower_limit_checkbox.Visible = false;

78

lower_limit_checkbox.Checked = false; lower_limit_input.Visible = false; lower_limit_input.Text = ""; } private void add_condition_button_Click(object sender, System.EventArgs e) { bool selectedItem = true; if( condition_library_list.SelectedIndex == -1) { MessageBox.Show("Please select a condition from the library"); selectedItem = false; return; } if(datatype_drop_box.SelectedIndex == -1) { MessageBox.Show("Select a data type"); return; } if( upper_limit_checkbox.Checked == true && upper_limit_input.Text.Equals("") ) { MessageBox.Show("Please enter an upper limit!"); return; } if( lower_limit_checkbox.Checked == true && lower_limit_input.Text.Equals("") ) { MessageBox.Show("Please enter a lower limit!"); return; } //if integer or float datatype is selected if(datatype_drop_box.SelectedIndex == 1 || datatype_drop_box.SelectedIndex == 2 ) { if(upper_limit_checkbox.Checked == false && lower_limit_checkbox.Checked == false) { MessageBox.Show("There must be an upper or lower limit!"); return; } } if( selectedItem == true) { for(int i = 0; i < current_condition_list1.Items.Count; i++) {

79

if( condition_library_list.SelectedItem.ToString() == current_condition_list1.Items[i].ToString() ) { MessageBox.Show(condition_library_list.SelectedItem.ToString()+" already exists!"); return; } } if( upper_limit_checkbox.Checked == true ) { if(datatype_drop_box.SelectedIndex == 1) //type integer { if( isDigit(upper_limit_input.Text) == false ) { MessageBox.Show("Upper limit must be an INTEGER!"); upper_limit_input.Text = ""; return; } } else if(datatype_drop_box.SelectedIndex == 2) //type float { if( isFloat(upper_limit_input.Text) == false ) { MessageBox.Show("Upper limit must be a FLOAT!"); upper_limit_input.Text = ""; return; } } } if( lower_limit_checkbox.Checked == true ) { if(datatype_drop_box.SelectedIndex == 1) //type integer { if( isDigit(lower_limit_input.Text) == false ) { MessageBox.Show("Lower limit must be an INTEGER!"); lower_limit_input.Text = ""; return; } } else if(datatype_drop_box.SelectedIndex == 2) //type float {

80

if( isFloat(lower_limit_input.Text) == false ) { MessageBox.Show("Lower limit must be a FLOAT!"); lower_limit_input.Text = ""; return; } } } if(datatype_drop_box.SelectedIndex == 1) //type integer { if( upper_limit_checkbox.Checked == true && lower_limit_checkbox.Checked == true ) { int upper_limit = Convert.ToUInt16(upper_limit_input.Text); int lower_limit = Convert.ToUInt16(lower_limit_input.Text); if( upper_limit <= lower_limit ) { MessageBox.Show("Upper limit must be larger than Lower limit!"); lower_limit_input.Text = ""; upper_limit_input.Text = ""; return; } } } else if(datatype_drop_box.SelectedIndex == 2) //type float { if( upper_limit_checkbox.Checked == true && lower_limit_checkbox.Checked == true ) { double upper_limit = Convert.ToDouble(upper_limit_input.Text); double lower_limit = Convert.ToDouble(lower_limit_input.Text); if( upper_limit <= lower_limit ) { MessageBox.Show("Upper limit must be larger than Lower limit!"); lower_limit_input.Text = ""; upper_limit_input.Text = ""; return; } } }

current_condition_list1.Items.Add(condition_library_list.Selected Item);

81

Condition dummyCondition = new Condition(); dummyCondition.setName(condition_library_list.SelectedItem.ToStri ng()); dummyCondition.setUnit(condition_unit.Text); if( upper_limit_input.Text.ToString().Equals("") ) { dummyCondition.setUpperLimit("_"); } else { dummyCondition.setUpperLimit(upper_limit_input.Text.ToString()); } if( lower_limit_input.Text.ToString().Equals("") ) { dummyCondition.setLowerLimit("_"); } else { dummyCondition.setLowerLimit(lower_limit_input.Text.ToString()); }

dummyCondition.setDataType(datatype_drop_box.Text); myObject.addCondition(dummyCondition); upper_limit_checkbox.Checked = false; lower_limit_checkbox.Checked = false; upper_limit_checkbox.Enabled = false; lower_limit_checkbox.Enabled = false; upper_limit_input.Text = ""; lower_limit_input.Text = ""; upper_limit_input.Enabled = false; lower_limit_input.Enabled = false; condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; datatype_drop_box.SelectedIndex = -1; } } public bool isDigit(String text) { for( int i = 0; i < text.Length; i++ ) { if( text[i].Equals('0') || text[i].Equals('1') || text[i].Equals('2') || text[i].Equals('3') || text[i].Equals('4') || text[i].Equals('5') ||

82

text[i].Equals('6') || text[i].Equals('7') || text[i].Equals('8') || text[i].Equals('9') ) { } else { return false; } } return true; } public bool isFloat(String text) { if(text.Length == 1) { return false; } int count = 0; for( int i = 0; i < text.Length; i++ ) { if( text[i].Equals('.') ) { count++; } if( text[i].Equals('0') || text[i].Equals('1') || text[i].Equals('2') || text[i].Equals('3') || text[i].Equals('4') || text[i].Equals('5') || text[i].Equals('6') || text[i].Equals('7') || text[i].Equals('8') || text[i].Equals('9') || text[i].Equals('.')) { } else { return false; } } if( count != 1 ) { return false; } return true; }

83

private void condition_library_list_SelectedIndexChanged(object sender, System.EventArgs e) { int index = condition_library_list.SelectedIndex; if( index == -1 ) { return; } condition_unit.Text = myProject.getConditionCollection().getConditionAt(index).getUnit(); condition_description_textBox.Text = myProject.getConditionCollection().getConditionAt(index).getDescription (); switch(myProject.getConditionCollection().getConditionAt(index).g etDataType()) { case "Boolean": datatype_drop_box.SelectedIndex = 0; break; case "Integer": datatype_drop_box.SelectedIndex = 1; break; case "Float": datatype_drop_box.SelectedIndex = 2; break; default:

MessageBox.Show("ERROR"); break;

} }

private void remove_condition_button_Click(object sender, System.EventArgs e) { if( current_condition_list1.SelectedIndex == -1 ) { MessageBox.Show("Please select a condition to delete!"); return; }

myObject.getConditionCollection().deleteConditionAt(current_condi tion_list1.SelectedIndex); current_condition_list1.Items.Clear(); for(int i = 0; i < myObject.getConditionCollectionSize(); i++) {

84

current_condition_list1.Items.Add(myObject.getConditionCollection ().getConditionAt(i).getName()); } condition_upper_limit_textbox.Text = ""; condition_lower_limit_textbox.Text = ""; remove_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_upper_limit_textbox.Visible = false; condition_lower_limit_label.Visible = false; condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; add_condition_button.Visible = true; upper_limit_checkbox.Visible = true; upper_limit_input.Visible = true; lower_limit_checkbox.Visible = true; lower_limit_input.Visible = true; condition_library_list.Enabled = true; condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; condition_library_label.Visible = true; condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box1.SelectedIndex = -1; datatype_label.Visible = true; datatype_drop_box.Visible = true; datatype_drop_box.SelectedIndex = -1; } private void object_list_box_SelectedIndexChanged(object sender, System.EventArgs e) { } private void edit_object_button_Click(object sender, System.EventArgs e) { if( object_list_box.SelectedIndex == -1 ) { MessageBox.Show("Please select an object to edit!"); return; }

85

tabs.Visible = true; tabs.SelectedIndex = 0; save_changes_button.Visible = true; cancel_changes_button.Visible = true; object_changes_groupBox.Visible = true; tabs.Enabled = true; object_list_box.Enabled = false; add_object_button.Visible = false; delete_object_button.Visible = false; rename_object_button.Visible = false; cancel_object_button.Visible = false; edit_object_button.Visible = false; object_name_label.Visible = false; object_name_textbox.Visible = false; condition_library_list.Enabled = true; condition_library_label.Visible = true; condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true;

resetTabs(); if( changedPath == false ) { openConditionLibrary(); } myObject.reset(); myObject.setObject(myProject.getObject(object_list_box.SelectedIn dex)); current_condition_list1.Items.Clear(); for(int i = 0; i < myObject.getConditionCollectionSize(); i++) { current_condition_list1.Items.Add(myObject.getConditionCollection ().getConditionAt(i).getName()); } created_attributes.Items.Clear(); for(int i = 0; i < myObject.getAttributeCollectionSize(); i++) { created_attributes.Items.Add(myObject.getAttributeCollection().ge tAttributeAt(i).getName()); } function_name_textbox.Text = myObject.getMainMethod().getName(); browse_textbox.Text = myObject.getMainMethod().getPath(); other_method_listbox.Items.Clear(); if( myObject.getMethodCollectionSize() > 0 )

86

{ other_methods_checkbox.Checked = true; } other_method_listbox.Items.Clear(); for(int i = 0; i < myObject.getMethodCollectionSize(); i++ ) { other_method_listbox.Items.Add(myObject.getMethodCollection().get MethodAt(i).getName()); } } public bool isValidName(String text) { if( text.Length.Equals(0) ) return false; int numberOfSpaces = 0; for( int i = 0; i < text.Length; i++ ) { if( text[i].ToString().Equals(" ") ) { numberOfSpaces++; } //cannot include text delimiter characters else if( text[i].ToString().Equals("-") || text[i].ToString().Equals("~") || text[i].ToString().Equals("|") || text[i].ToString().Equals(",") || text[i].ToString().Equals("+") || text[i].ToString().Equals("_") ) { return false; } } if( numberOfSpaces.Equals( text.Length ) ) { return false; } return true; } private void add_object_button_Click_1(object sender, System.EventArgs e) { //check for duplicate names for(int i = 0; i < object_list_box.Items.Count; i++) { if(object_name_textbox.Text.Equals(object_list_box.Items[i].ToStr ing())) {

87

MessageBox.Show(object_name_textbox.Text+" already exists in the Object List"); return; } } //check for valid name if( isValidName(object_name_textbox.Text) == false ) { MessageBox.Show("Name cannot be null or contain + ~ , | _ -"); object_name_textbox.Text = ""; return; } Object objectToAdd = new Object(); objectToAdd.setName(object_name_textbox.Text.ToString()); object_list_box.Items.Add(object_name_textbox.Text); myProject.addObject(objectToAdd); object_name_textbox.Text = ""; myProject.hasSaved = false; } private void delete_object_button_Click_1(object sender, System.EventArgs e) { bool itemIsSelected = false; for(int i = 0 ; i < object_list_box.Items.Count; i++) { if(object_list_box.GetSelected(i) == true) { itemIsSelected = true; break; } } if(itemIsSelected == false) { MessageBox.Show("An object must be selected to continue"); } else { myProject.deleteObject(myProject.getObject(object_list_box.Select edIndex)); object_list_box.Items.Remove(object_list_box.SelectedItem); myProject.hasSaved = false; } delete_object_button.Visible cancel_object_button.Visible edit_object_button.Visible = rename_object_button.Visible

= false; = false; false; = false;

88

add_object_button.Visible = true; object_name_label.Visible = true; object_name_textbox.Visible = true; } private void cancel_changes_button_Click(object sender, System.EventArgs e) { myObject.reset(); toolBar1.Visible = true; new_project.Enabled = true; //in the project menu tabs.Visible = false; open_project.Enabled = true; save_project.Enabled = true; object_list_box.ClearSelected(); condition_library_list.ClearSelected(); condition_library_list.Visible = false; condition_library_label.Visible = false; add_object_button.Visible = true; delete_object_button.Visible = true; edit_object_button.Visible = true; object_name_label.Visible = true; object_name_textbox.Visible = true; object_name_textbox.Enabled = true; object_list_box.Enabled = true; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; //clear all the inputs and lists///////////////// //start in the first tab current_condition_list1.Items.Clear(); upper_limit_checkbox.Checked = false; lower_limit_checkbox.Checked = false; upper_limit_input.Text = ""; lower_limit_input.Text = ""; condition_upper_limit_textbox.Text = ""; condition_lower_limit_textbox.Text = ""; //now go to second tab created_attributes.Items.Clear(); attribute_name.Text = ""; tabs.Enabled = false; //now go to third tab function_name_textbox.Text = ""; browse_textbox.Text = ""; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_methods_checkbox.Checked = false; other_method_listbox.Items.Clear(); //make both buttons invisible save_changes_button.Visible = false; cancel_changes_button.Visible = false; cancel_object_button.Visible = false; edit_object_button.Visible = false; delete_object_button.Visible = false;

89

rename_object_button.Visible = false; object_changes_groupBox.Visible = false; } private void about_menu_Click(object sender, System.EventArgs e) { About aboutWindow = new About(); aboutWindow.Show(); }

private void edit_condition_menu_Click(object sender, System.EventArgs e) { Form2 libraryWindow = new Form2(); libraryWindow.Show(); } private void save_changes_button_Click(object sender, System.EventArgs e) { if( myObject.getConditionCollectionSize() < 1 ) { MessageBox.Show("Object must have 1 or more conditions!"); tabs.SelectedIndex = 0; return; } if( myObject.getAttributeCollectionSize() < 1 ) { MessageBox.Show("Object must have 1 or more attributes!"); tabs.SelectedIndex = 1; return; } if( !isValidName(function_name_textbox.Text) ) { MessageBox.Show("Function name cannot be null or contain + ~ , | _ -"); tabs.SelectedIndex = 2; return; } if( !isValidName(browse_textbox.Text) ) { MessageBox.Show("Path cannot be null or contain + ~ , | _ -"); tabs.SelectedIndex = 2; return; } if( other_method_listbox.SelectedIndex != -1) {

90

MessageBox.Show("Confirm or Cancel Method List Selection!"); return; }

myObject.getMainMethod().setName(function_name_textbox.Text); myObject.getMainMethod().setPath(browse_textbox.Text);

myProject.getObject(object_list_box.SelectedIndex).setObject(myOb ject); toolBar1.Visible = true; tabs.Visible = false; new_project.Enabled = true; open_project.Enabled = true; save_project.Enabled = true; object_list_box.ClearSelected(); condition_library_list.ClearSelected(); condition_library_list.Visible = false; condition_library_label.Visible = false; add_object_button.Visible = true; delete_object_button.Visible = true; edit_object_button.Visible = true; object_name_label.Visible = true; object_name_textbox.Visible = true; object_list_box.Enabled = true; unit_groupBox.Visible = false; condition_description_groupBox.Visible = false; //clear all the inputs and lists //start in the first tab current_condition_list1.Items.Clear(); upper_limit_checkbox.Checked = false; lower_limit_checkbox.Checked = false; upper_limit_input.Text = ""; lower_limit_input.Text = ""; condition_upper_limit_textbox.Text = ""; condition_lower_limit_textbox.Text = ""; //now go to second tab created_attributes.Items.Clear(); attribute_name.Text = ""; tabs.Enabled = false; //now go to third tab function_name_textbox.Text = ""; browse_textbox.Text = ""; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_methods_checkbox.Checked = false; other_method_listbox.Items.Clear(); //make both buttons invisible save_changes_button.Visible = false; cancel_changes_button.Visible = false;

91

delete_object_button.Visible = false; rename_object_button.Visible = false; edit_object_button.Visible = false; cancel_object_button.Visible = false; object_changes_groupBox.Visible = false; } private void edit_condition_button_Click(object sender, System.EventArgs e) { if(datatype_drop_box1.SelectedIndex == 1) //type integer { if( isDigit(condition_upper_limit_textbox.Text) == false ) { MessageBox.Show("Upper limit must be an INTEGER!"); condition_upper_limit_textbox.Text = ""; return; } if( isDigit(condition_lower_limit_textbox.Text) == false ) { MessageBox.Show("Lower limit must be an INTEGER!"); condition_lower_limit_textbox.Text = ""; return; } } else if(datatype_drop_box1.SelectedIndex == 2) //type float { if( isFloat(condition_upper_limit_textbox.Text) == false ) { MessageBox.Show("Upper limit must be a FLOAT!"); condition_upper_limit_textbox.Text = ""; return; } if( isFloat(condition_lower_limit_textbox.Text) == false ) { MessageBox.Show("Lower limit must be a FLOAT!"); condition_lower_limit_textbox.Text = ""; return; } } if(datatype_drop_box1.SelectedIndex == 1) //type integer { int upper_limit = Convert.ToUInt16(condition_upper_limit_textbox.Text);

92

int lower_limit = Convert.ToUInt16(condition_lower_limit_textbox.Text); if( upper_limit <= lower_limit ) { MessageBox.Show("Upper limit must be larger than Lower limit!"); condition_lower_limit_textbox.Text = ""; condition_upper_limit_textbox.Text = ""; return; } } else if(datatype_drop_box1.SelectedIndex == 2) //type float { double upper_limit = Convert.ToDouble(condition_upper_limit_textbox.Text); double lower_limit = Convert.ToDouble(condition_lower_limit_textbox.Text); if( upper_limit <= lower_limit ) { MessageBox.Show("Upper limit must be larger than Lower limit!"); condition_lower_limit_textbox.Text = ""; condition_upper_limit_textbox.Text = ""; return; } }

myObject.getConditionCollection().getConditionAt(current_conditio n_list1.SelectedIndex).setUpperLimit(condition_upper_limit_textbox.Text .ToString()); myObject.getConditionCollection().getConditionAt(current_conditio n_list1.SelectedIndex).setLowerLimit(condition_lower_limit_textbox.Text .ToString()); myObject.getConditionCollection().getConditionAt(current_conditio n_list1.SelectedIndex).setDataType(datatype_drop_box1.Text); current_condition_list1.SelectedIndex = -1; condition_upper_limit_textbox.Text = ""; condition_upper_limit_textbox.Visible = false; condition_lower_limit_textbox.Text = ""; condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_lower_limit_label.Visible = false; add_condition_button.Visible = true; remove_condition_button.Visible = false; upper_limit_checkbox.Visible = true; upper_limit_checkbox.Enabled = false;

93

upper_limit_input.Visible = true; lower_limit_checkbox.Visible = true; lower_limit_checkbox.Enabled = false; lower_limit_input.Visible = true; condition_library_list.Enabled = true; condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; condition_library_label.Visible = true; condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box1.SelectedIndex = -1; datatype_label.Visible = true; datatype_drop_box.Visible = true; datatype_drop_box.SelectedIndex = -1; } private void upper_limit_checkbox_CheckedChanged(object sender, System.EventArgs e) { if(upper_limit_checkbox.Checked == true) upper_limit_input.Enabled = true; if(upper_limit_checkbox.Checked == false) { upper_limit_input.Enabled = false; upper_limit_input.Text = ""; } } private void lower_limit_checkbox_CheckedChanged(object sender, System.EventArgs e) { if(lower_limit_checkbox.Checked == true) lower_limit_input.Enabled = true; if(lower_limit_checkbox.Checked == false) { lower_limit_input.Enabled = false; lower_limit_input.Text = ""; } } private void created_attributes_SelectedIndexChanged(object sender, System.EventArgs e) { if( created_attributes.SelectedIndex.Equals(-1) ) { create_attribute.Visible = true; return; } create_attribute.Visible = false;

94

edit_attribute_button.Visible = true; cancel_attribute_button.Visible = true; delete_attribute_button.Visible = true; condition_library_list.ClearSelected(); Aggregate.ClearSelected(); Attribute attributeToExamine = new Attribute(); attributeToExamine = myObject.getAttributeCollection().getAttributeAt(created_attributes.Sel ectedIndex); attribute_name.Text = attributeToExamine.getName(); bool found = false; for(int i = 0 ; i < condition_library_list.Items.Count; i++) { String thisCondition = condition_library_list.Items[i].ToString(); String [] matchName = thisCondition.Split("".ToCharArray(),2); if( matchName[0].ToString().Equals(attributeToExamine.getCondition().getNam e()) ) { condition_library_list.SetSelected(i,true); found = true; break; } } if(found == false) { MessageBox.Show("This attribute does not have a condition listed in the current library"); } for(int i = 0; i < Aggregate.Items.Count; i++) { if( Aggregate.Items[i].ToString().Equals(attributeToExamine.getAggregationF unction()) ) { Aggregate.SetSelected(i,true); break; } } } private void edit_attribute_button_Click(object sender, System.EventArgs e) { if( !isValidName(attribute_name.Text) ) { MessageBox.Show("Attribute name cannot be null or contain + ~ , | _ -");

95

attribute_name.Text = ""; return; } String aggregation_function = Aggregate.SelectedItem.ToString(); String selectedCondition = condition_library_list.SelectedItem.ToString(); Condition dummyCondition = new Condition(); dummyCondition.setName(selectedCondition); dummyCondition.setUnit(condition_unit.Text); Attribute dummyAttribute = new Attribute(attribute_name.Text.ToString(),dummyCondition,aggregation_fun ction);

myObject.getAttributeCollection().getAttributeAt(created_attribut es.SelectedIndex).setAttribute(dummyAttribute); //can't change one item in the list box so clear it and redraw it created_attributes.Items.Clear(); for(int i = 0; i < myObject.getAttributeCollection().getSize(); i++) { created_attributes.Items.Add(myObject.getAttributeCollection().ge tAttributeAt(i).getName()); }

Aggregate.ClearSelected(); created_attributes.ClearSelected(); condition_library_list.ClearSelected(); attribute_name.Text = ""; create_attribute.Visible = true; edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; condition_unit.Text = ""; condition_description_textBox.Text = ""; } private void selected_condition_greater_textbox_TextChanged(object sender, System.EventArgs e) { } private void delete_attribute_button_Click(object sender, System.EventArgs e) { if( created_attributes.SelectedIndex == -1 ) {

96

MessageBox.Show("Please select an attribute to delete!"); return; }

myObject.getAttributeCollection().deleteAttributeAt(created_attri butes.SelectedIndex); created_attributes.Items.RemoveAt(created_attributes.SelectedInde x); attribute_name.Text = ""; condition_library_list.ClearSelected(); created_attributes.ClearSelected(); Aggregate.ClearSelected(); create_attribute.Visible = true; edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; condition_unit.Text = ""; condition_description_textBox.Text = ""; } private void selected_condition_greater_label_Click(object sender, System.EventArgs e) { } private void browse_button_Click(object sender, System.EventArgs e) { if( isValidName(function_name_textbox.Text) == false ) { MessageBox.Show("Function name cannot be null or contain + ~ , | _ -"); function_name_textbox.Text = ""; return; }

OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text files (*.txt)|*.txt"; ofd.InitialDirectory = "Libraries\\Method Library"; ofd.Title = "Open a Method Implementation File"; ofd.Filter = "Text files (*.txt)|*.txt"; ofd.RestoreDirectory = true; //restore root directory if ( ofd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( ofd.FileName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream );

97

browse_textbox.Text = ofd.FileName.ToString(); sreader.Close(); fstream.Close(); } } private void other_methods_checkbox_CheckedChanged(object sender, System.EventArgs e) { if( (isValidName(function_name_textbox.Text) == false || isValidName(browse_textbox.Text) == false) && other_methods_checkbox.Checked == true ) { other_methods_checkbox.Checked = false; MessageBox.Show("Name and path cannot include ~ + , | _ or be null"); return; } if( other_methods_checkbox.Checked == false ) { method_name_label.Visible = false; method_name_textbox.Visible = false; other_browse_button.Visible = false; other_browse_textbox.Visible = false; add_method_button.Visible = false; other_method_listbox.Visible = false; method_list_label.Visible = false; } else if( other_methods_checkbox.Checked == true ) { method_name_label.Visible = true; method_name_textbox.Visible = true; other_browse_button.Visible = true; other_browse_textbox.Visible = true; add_method_button.Visible = true; other_method_listbox.Visible = true; method_list_label.Visible = true; } } private void other_browse_button_Click(object sender, System.EventArgs e) { if( isValidName(method_name_textbox.Text) == false ) { MessageBox.Show("Method name cannot be null or contain + ~ , | _ -"); method_name_textbox.Text = ""; return; } OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text files (*.txt)|*.txt";

98

ofd.InitialDirectory = "Libraries\\Method Library"; ofd.Title = "Open a Method Implementation File"; ofd.Filter = "Text files (*.txt)|*.txt"; ofd.RestoreDirectory = true; if ( ofd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( ofd.FileName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream ); other_browse_textbox.Text = ofd.FileName.ToString(); sreader.Close(); fstream.Close(); } } private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { // Evaluate the Button property of the ToolBarButtonClickEventArgs // to determine which button was clicked. switch (toolBar1.Buttons.IndexOf(e.Button)) { case 0 : //new project //MessageBox.Show("NEW"); System.EventArgs myEvent0 = new EventArgs(); new_menu_Click(sender, myEvent0); break; case 1 : //separator break; case 2 : //separator break; case 3 : //open project //MessageBox.Show("OPEN"); System.EventArgs myEvent3 = new EventArgs(); open_menu_Click(sender, myEvent3); break; case 4 : //separator break; case 5 : //separator break; case 6 : //open project //MessageBox.Show("SAVE"); System.EventArgs myEvent6 = new EventArgs(); save_menu_Click(sender, myEvent6); break; } }

99

private void add_method_button_Click(object sender, System.EventArgs e) { if( isValidName(method_name_textbox.Text) == false ) { MessageBox.Show("Method name cannot be null or contain + ~ , | _ -"); method_name_textbox.Text = ""; return; } if( isValidName(other_browse_textbox.Text) == false ) { MessageBox.Show("Path cannot be null or contain + ~ , | _ -"); other_browse_textbox.Text = ""; return; } for( int i = 0; i < other_method_listbox.Items.Count; i++ ) { if( method_name_textbox.Text.Equals( myObject.getMethodCollection().getMethodAt(i).getName()) ) { MessageBox.Show("That method already exists!"); return; } } Method newMethod = new Method(); newMethod.setName(method_name_textbox.Text); newMethod.setPath(other_browse_textbox.Text); myObject.addMethod(newMethod); other_method_listbox.Items.Add(method_name_textbox.Text); other_method_listbox.ClearSelected(); cancel_method_button.Visible = false; confirm_method_list.Visible = false; delete_method_button.Visible = false; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; } private void delete_method_button_Click(object sender, System.EventArgs e) { //delete from method collection int index = other_method_listbox.SelectedIndex; if( index == -1 ) { return; } myObject.getMethodCollection().deleteMethodAt(index);

100

//clear from listbox other_method_listbox.Items.Clear(); //redraw listbox for( int i = 0; i < myObject.getMethodCollectionSize(); i++ ) { other_method_listbox.Items.Add(myObject.getMethodCollection().get MethodAt(i).getName()); } delete_method_button.Visible = false; cancel_method_button.Visible = false; confirm_method_list.Visible = false; confirm_method_list.Visible = false; add_method_button.Visible = true; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_method_listbox.ClearSelected(); } private void condition_upper_limit_textbox_TextChanged(object sender, System.EventArgs e) { } private void cancel_condition_button_Click(object sender, System.EventArgs e) { current_condition_list1.SelectedIndex = -1; condition_upper_limit_textbox.Text = ""; condition_upper_limit_textbox.Visible = false; condition_lower_limit_textbox.Text = ""; condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_lower_limit_label.Visible = false; add_condition_button.Visible = true; remove_condition_button.Visible = false; upper_limit_checkbox.Visible = true; upper_limit_checkbox.Enabled = false; upper_limit_input.Visible = true; lower_limit_checkbox.Visible = true; lower_limit_checkbox.Enabled = false; lower_limit_input.Visible = true; condition_library_list.Enabled = true; condition_library_list.ClearSelected(); condition_unit.Text = ""; condition_description_textBox.Text = ""; condition_library_label.Visible = true;

101

condition_library_list.Visible = true; unit_groupBox.Visible = true; condition_description_groupBox.Visible = true; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box1.SelectedIndex = -1; datatype_label.Visible = true; datatype_drop_box.Visible = true; datatype_drop_box.SelectedIndex = -1; } private void cancel_attribute_button_Click(object sender, System.EventArgs e) { Aggregate.ClearSelected(); created_attributes.ClearSelected(); condition_library_list.ClearSelected(); attribute_name.Text = ""; create_attribute.Visible = true; edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; condition_unit.Text = ""; condition_description_textBox.Text = ""; } private void other_method_listbox_SelectedIndexChanged(object sender, System.EventArgs e) { int index = other_method_listbox.SelectedIndex; if( index == -1 ) { return; } method_name_textbox.Text = myObject.getMethodCollection().getMethodAt(index).getName(); other_browse_textbox.Text = myObject.getMethodCollection().getMethodAt(index).getPath(); add_method_button.Visible = false; cancel_method_button.Visible = true; confirm_method_list.Visible = true; delete_method_button.Visible = true; } private void save_method_button_Click(object sender, System.EventArgs e) { add_method_button.Visible = true; cancel_method_button.Visible = false; confirm_method_list.Visible = false; delete_method_button.Visible = false;

102

method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_method_listbox.ClearSelected(); } private void cancel_method_button_Click(object sender, System.EventArgs e) { add_method_button.Visible = true; cancel_method_button.Visible = false; confirm_method_list.Visible = false; delete_method_button.Visible = false; confirm_method_list.Visible = false; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_method_listbox.ClearSelected(); } private void object_list_box_SelectedIndexChanged_1(object sender, System.EventArgs e) { add_object_button.Visible = false; delete_object_button.Visible = true; edit_object_button.Visible = true; cancel_object_button.Visible = true; rename_object_button.Visible = true; object_name_label.Visible = false; object_name_textbox.Visible = false; save_object_name.Visible = false; cancel_rename_button.Visible = false; } private void rename_object_button_Click(object sender, System.EventArgs e) { object_name_label.Visible = true; object_name_textbox.Visible = true; save_object_name.Visible = true; cancel_rename_button.Visible = true; rename_object_button.Visible = false; edit_object_button.Visible = false; delete_object_button.Visible = false; cancel_object_button.Visible = false; } private void save_object_name_Click(object sender, System.EventArgs e) { if( isValidName(object_name_textbox.Text) == false ) { MessageBox.Show("Object name cannot be null or contain + ~ , | _ -"); object_name_textbox.Text = ""; return; }

103

int index = object_list_box.SelectedIndex; int projectSize = myProject.getSize(); String newName = object_name_textbox.Text; myProject.getObject(index).setName(newName); object_list_box.Items.Clear(); for( int i = 0; i < projectSize; i++ ) { object_list_box.Items.Add(myProject.getObject(i).getName()); } object_name_textbox.Text = ""; add_object_button.Visible = true; object_list_box.ClearSelected(); delete_object_button.Visible = false; cancel_object_button.Visible = false; rename_object_button.Visible = false; edit_object_button.Visible = false; save_object_name.Visible = false; cancel_rename_button.Visible = false; myProject.setSaved(false); } private void cancel_object_button_Click(object sender, System.EventArgs e) { object_list_box.ClearSelected(); add_object_button.Visible = true; delete_object_button.Visible = false; edit_object_button.Visible = false; rename_object_button.Visible = false; cancel_object_button.Visible = false; save_object_name.Visible = false; object_name_label.Visible = true; object_name_textbox.Visible = true; } private void cancel_rename_button_Click(object sender, System.EventArgs e) { cancel_rename_button.Visible = false; save_object_name.Visible = false; object_name_textbox.Visible = false; object_name_label.Visible =false; delete_object_button.Visible rename_object_button.Visible edit_object_button.Visible = cancel_object_button.Visible

= true; = true; true; = true;

object_name_textbox.Text = ""; } private void pictureBox1_Click(object sender, System.EventArgs e) {

104

} private void project_menu_Click(object sender, System.EventArgs e) { } private void change_path_menu_item_Click(object sender, System.EventArgs e) { if(pictureBox1.Visible == true) { MessageBox.Show("Please start or open a project first!"); return; } if(tabs.Visible == false) { MessageBox.Show("You must be editing an object to change path!"); return; } if(tabs.SelectedIndex == 2) { MessageBox.Show("Unable to change path while viewing this tab!"); return; } changeConditionLibrary(); if(tabs.SelectedIndex == 0) { current_condition_list1.ClearSelected(); current_condition_list1.Visible = true; add_condition_button.Visible = true; upper_limit_checkbox.Checked = false; upper_limit_checkbox.Visible = true; upper_limit_input.Text = ""; upper_limit_input.Visible = true; lower_limit_checkbox.Checked = false; lower_limit_checkbox.Visible = true; lower_limit_input.Text = ""; lower_limit_input.Visible = true; remove_condition_button.Visible = false; selected_condition_label.Visible = false; condition_upper_limit_label.Visible = false; condition_upper_limit_textbox.Text = ""; condition_upper_limit_textbox.Visible = false; condition_lower_limit_label.Visible = false; condition_lower_limit_textbox.Text = "";

105

condition_lower_limit_textbox.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; datatype_label1.Visible = false; datatype_drop_box1.Visible = false; datatype_drop_box.Visible = true; datatype_label.Visible = true; datatype_drop_box1.SelectedIndex = -1; datatype_drop_box.SelectedIndex = -1; upper_limit_checkbox.Enabled = true; lower_limit_checkbox.Enabled = true; } else if(tabs.SelectedIndex == 1) { created_attributes.ClearSelected(); attribute_name.Text = ""; Aggregate.ClearSelected(); create_attribute.Visible = true; edit_attribute_button.Visible = false; cancel_attribute_button.Visible = false; delete_attribute_button.Visible = false; }

} private void function_name_textbox_TextChanged(object sender, System.EventArgs e) { } private void attribute_name_TextChanged(object sender, System.EventArgs e) { } private void datatype_drop_box_SelectedIndexChanged(object sender, System.EventArgs e) { if(datatype_drop_box.SelectedIndex == -1) { return; } else { upper_limit_input.Text = ""; upper_limit_input.Enabled = false; upper_limit_checkbox.Checked = false; lower_limit_input.Text = ""; lower_limit_input.Enabled = false; lower_limit_checkbox.Checked = false;

106

if(datatype_drop_box.SelectedIndex { upper_limit_checkbox.Enabled lower_limit_checkbox.Enabled } else { upper_limit_checkbox.Enabled lower_limit_checkbox.Enabled }

== 0) = false; = false;

= true; = true;

} } private void datatype_drop_box1_SelectedIndexChanged(object sender, System.EventArgs e) { if(datatype_drop_box1.SelectedIndex == -1) { return; } else { if(datatype_drop_box1.SelectedIndex == 0) { condition_upper_limit_textbox.Enabled = false; condition_upper_limit_textbox.Text = ""; condition_lower_limit_textbox.Enabled = false; condition_lower_limit_textbox.Text = ""; } else { condition_upper_limit_textbox.Enabled = true; condition_lower_limit_textbox.Enabled = true; } } } private void confirm_method_list_Click(object sender, System.EventArgs e) { if( !isValidName(method_name_textbox.Text) ) { MessageBox.Show("Method name cannot be null or contain + ~ , | _ -"); method_name_textbox.Text = ""; return; } if( !isValidName(other_browse_textbox.Text) ) { MessageBox.Show("Method path cannot be null or contain + ~ , | _ -"); other_browse_textbox.Text = ""; return;

107

}

myObject.getMethodCollection().getMethodAt(other_method_listbox.S electedIndex).setName(method_name_textbox.Text); myObject.getMethodCollection().getMethodAt(other_method_listbox.S electedIndex).setPath(other_browse_textbox.Text); add_method_button.Visible = true; cancel_method_button.Visible = false; confirm_method_list.Visible = false; delete_method_button.Visible = false; confirm_method_list.Visible = false; method_name_textbox.Text = ""; other_browse_textbox.Text = ""; other_method_listbox.ClearSelected(); //redraw list other_method_listbox.Items.Clear(); for(int i = 0; i < myObject.getMethodCollectionSize(); i++) { other_method_listbox.Items.Add(myObject.getMethodCollection().get MethodAt(i).getName()); } } private void menuItem1_Click(object sender, System.EventArgs e) { } private void CloseMenuItem_Click(object sender, System.EventArgs e) { //force cancel or save object changes before continuing to exit if( tabs.Visible == true ) { MessageBox.Show("Cancel or Save Object changes before continuing!"); return; } if( myProject.hasSaved == false ) { string caption = "The project has changed."; string message = "Save before closing?"; MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result; // Displays the MessageBox.

108

result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) //save first, then open new { // Call save this.save_menu_Click(sender, e); if( clickedOKFromSave == true ) { reinitialize(); } else { return; } } else if( result == DialogResult.No ) //don't save, just open new { reinitialize(); } else if( result == DialogResult.Cancel ) //do nothing, cancel { return; } } reinitialize(); } } }

109

Form2.cs using using using using using using using using using

System; System.Drawing; System.Collections; System.ComponentModel; System.Windows.Forms; System.Data; System.Drawing.Imaging; System.IO; System.Diagnostics;

namespace Enviro_1 { /// /// Summary description for Form2. /// public class Form2 : System.Windows.Forms.Form { private ConditionCollection myLibrary = new ConditionCollection(); private String[] parts = null; private static char[] delimiter = "-".ToCharArray(); private const int max_parts = 6; private String path = ""; private bool hasSaved = true; private bool cancelDialog = false;

private System.Windows.Forms.Label condition_library_label; private System.Windows.Forms.Button add_condition_button; private System.Windows.Forms.TextBox condition_name_textbox; private System.Windows.Forms.Label condition_name_label; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.Label unit_label; private System.Windows.Forms.TextBox condition_unit_textbox; private System.Windows.Forms.Button exit_button; private System.Windows.Forms.ListBox condition_library; private System.Windows.Forms.Button open_library_button; private System.Windows.Forms.Button delete_condition_button; private System.Windows.Forms.Button browse_button; private System.Windows.Forms.TextBox browse_textbox; private System.Windows.Forms.Button save_button; private System.Windows.Forms.Button cancel_condition_button; private System.Windows.Forms.Button edit_condition_button; private System.Windows.Forms.TextBox method_name_textbox; private System.Windows.Forms.Label method_name_label; private System.Windows.Forms.Button new_library_button;

110

private System.Windows.Forms.ToolTip condition_library_toolTip; private System.Windows.Forms.ToolTip new_library_button_toolTip; private System.Windows.Forms.ToolTip open_library_button_toolTip; private System.Windows.Forms.Label condition_label; private System.Windows.Forms.Label method_label; private System.Windows.Forms.GroupBox library_groupBox; private System.Windows.Forms.GroupBox condition_description_groupBox; private System.Windows.Forms.RichTextBox condition_description_textBox; private System.Windows.Forms.ComboBox datatype_drop_box; private System.Windows.Forms.Label data_type_label; private System.ComponentModel.IContainer components; public Form2() { // // Required for Windows Form Designer support // InitializeComponent();

condition_library_toolTip.SetToolTip(condition_library,"Select a condition to modify/delete"); new_library_button_toolTip.SetToolTip(new_library_button,"Start a new condition library"); open_library_button_toolTip.SetToolTip(open_library_button,"Open existing condition library");

} /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(condition_library.SelectedIndex != -1) { MessageBox.Show("Confirm Edit or Cancel condition selection before continuing"); return; } promptSave("close"); if( cancelDialog == true ) return; if(components != null)

111

{ components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.condition_library = new System.Windows.Forms.ListBox(); this.condition_library_label = new System.Windows.Forms.Label(); this.add_condition_button = new System.Windows.Forms.Button(); this.delete_condition_button = new System.Windows.Forms.Button(); this.condition_name_textbox = new System.Windows.Forms.TextBox(); this.condition_name_label = new System.Windows.Forms.Label(); this.unit_label = new System.Windows.Forms.Label(); this.condition_unit_textbox = new System.Windows.Forms.TextBox(); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.save_button = new System.Windows.Forms.Button(); this.exit_button = new System.Windows.Forms.Button(); this.open_library_button = new System.Windows.Forms.Button(); this.browse_button = new System.Windows.Forms.Button(); this.browse_textbox = new System.Windows.Forms.TextBox(); this.cancel_condition_button = new System.Windows.Forms.Button(); this.edit_condition_button = new System.Windows.Forms.Button(); this.method_name_textbox = new System.Windows.Forms.TextBox(); this.method_name_label = new System.Windows.Forms.Label(); this.new_library_button = new System.Windows.Forms.Button(); this.condition_library_toolTip = new System.Windows.Forms.ToolTip(this.components); this.new_library_button_toolTip = new System.Windows.Forms.ToolTip(this.components); this.open_library_button_toolTip = new System.Windows.Forms.ToolTip(this.components);

112

this.condition_label = new System.Windows.Forms.Label(); this.method_label = new System.Windows.Forms.Label(); this.library_groupBox = new System.Windows.Forms.GroupBox(); this.condition_description_groupBox = new System.Windows.Forms.GroupBox(); this.condition_description_textBox = new System.Windows.Forms.RichTextBox(); this.datatype_drop_box = new System.Windows.Forms.ComboBox(); this.data_type_label = new System.Windows.Forms.Label(); this.library_groupBox.SuspendLayout(); this.condition_description_groupBox.SuspendLayout(); this.SuspendLayout(); // // condition_library // this.condition_library.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_library.ItemHeight = 20; this.condition_library.Location = new System.Drawing.Point(400, 56); this.condition_library.Name = "condition_library"; this.condition_library.Size = new System.Drawing.Size(160, 464); this.condition_library.TabIndex = 0; this.condition_library.SelectedIndexChanged += new System.EventHandler(this.condition_library_SelectedIndexChanged); // // condition_library_label // this.condition_library_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_library_label.Location = new System.Drawing.Point(400, 32); this.condition_library_label.Name = "condition_library_label"; this.condition_library_label.Size = new System.Drawing.Size(160, 24); this.condition_library_label.TabIndex = 1; this.condition_library_label.Text = "Condition Library"; // // add_condition_button // this.add_condition_button.BackColor = System.Drawing.Color.Green; this.add_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

113

this.add_condition_button.ForeColor = System.Drawing.Color.White; this.add_condition_button.Location = new System.Drawing.Point(56, 400); this.add_condition_button.Name = "add_condition_button"; this.add_condition_button.Size = new System.Drawing.Size(176, 48); this.add_condition_button.TabIndex = 10; this.add_condition_button.Text = "Add"; this.add_condition_button.Click += new System.EventHandler(this.add_condition_button_Click); // // delete_condition_button // this.delete_condition_button.BackColor = System.Drawing.Color.Red; this.delete_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.delete_condition_button.ForeColor = System.Drawing.Color.White; this.delete_condition_button.Location = new System.Drawing.Point(56, 448); this.delete_condition_button.Name = "delete_condition_button"; this.delete_condition_button.Size = new System.Drawing.Size(176, 48); this.delete_condition_button.TabIndex = 13; this.delete_condition_button.Text = "Delete"; this.delete_condition_button.Visible = false; this.delete_condition_button.Click += new System.EventHandler(this.delete_conditon_button_Click); // // condition_name_textbox // this.condition_name_textbox.Location = new System.Drawing.Point(64, 120); this.condition_name_textbox.Name = "condition_name_textbox"; this.condition_name_textbox.Size = new System.Drawing.Size(304, 20); this.condition_name_textbox.TabIndex = 3; this.condition_name_textbox.Text = ""; this.condition_name_textbox.TextChanged += new System.EventHandler(this.condition_name_textbox_TextChanged); // // condition_name_label // this.condition_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_name_label.Location = new System.Drawing.Point(0, 120);

114

this.condition_name_label.Name = "condition_name_label"; this.condition_name_label.Size = new System.Drawing.Size(56, 16); this.condition_name_label.TabIndex = 5; this.condition_name_label.Text = "Name"; this.condition_name_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // unit_label // this.unit_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.unit_label.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.unit_label.Location = new System.Drawing.Point(0, 144); this.unit_label.Name = "unit_label"; this.unit_label.Size = new System.Drawing.Size(40, 16); this.unit_label.TabIndex = 7; this.unit_label.Text = "Unit"; this.unit_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // condition_unit_textbox // this.condition_unit_textbox.Location = new System.Drawing.Point(64, 144); this.condition_unit_textbox.Name = "condition_unit_textbox"; this.condition_unit_textbox.Size = new System.Drawing.Size(304, 20); this.condition_unit_textbox.TabIndex = 4; this.condition_unit_textbox.Text = ""; this.condition_unit_textbox.TextChanged += new System.EventHandler(this.condition_unit_textbox_TextChanged); // // save_button // this.save_button.Enabled = false; this.save_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.save_button.Location = new System.Drawing.Point(232, 24); this.save_button.Name = "save_button"; this.save_button.Size = new System.Drawing.Size(104, 32); this.save_button.TabIndex = 14; this.save_button.Text = "Save"; this.save_button.Click += new System.EventHandler(this.save_button_Click_1); //

115

// exit_button // this.exit_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.exit_button.Location = new System.Drawing.Point(64, 520); this.exit_button.Name = "exit_button"; this.exit_button.Size = new System.Drawing.Size(272, 40); this.exit_button.TabIndex = 15; this.exit_button.Text = "Exit"; this.exit_button.Click += new System.EventHandler(this.exit_button_Click); // // open_library_button // this.open_library_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.open_library_button.Location = new System.Drawing.Point(128, 24); this.open_library_button.Name = "open_library_button"; this.open_library_button.Size = new System.Drawing.Size(96, 32); this.open_library_button.TabIndex = 2; this.open_library_button.Text = "Open"; this.open_library_button.Click += new System.EventHandler(this.open_library_button_Click); // // browse_button // this.browse_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.browse_button.Location = new System.Drawing.Point(8, 256); this.browse_button.Name = "browse_button"; this.browse_button.Size = new System.Drawing.Size(56, 24); this.browse_button.TabIndex = 6; this.browse_button.Text = "Path"; this.browse_button.Click += new System.EventHandler(this.browse_button_Click); // // browse_textbox // this.browse_textbox.Location = new System.Drawing.Point(72, 256); this.browse_textbox.Name = "browse_textbox"; this.browse_textbox.Size = new System.Drawing.Size(312, 20); this.browse_textbox.TabIndex = 7;

116

this.browse_textbox.Text = ""; this.browse_textbox.TextChanged += new System.EventHandler(this.browse_textbox_TextChanged); // // cancel_condition_button // this.cancel_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cancel_condition_button.Location = new System.Drawing.Point(232, 448); this.cancel_condition_button.Name = "cancel_condition_button"; this.cancel_condition_button.Size = new System.Drawing.Size(136, 48); this.cancel_condition_button.TabIndex = 12; this.cancel_condition_button.Text = "Cancel"; this.cancel_condition_button.Visible = false; this.cancel_condition_button.Click += new System.EventHandler(this.cancel_condition_button_Click); // // edit_condition_button // this.edit_condition_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.edit_condition_button.Location = new System.Drawing.Point(232, 400); this.edit_condition_button.Name = "edit_condition_button"; this.edit_condition_button.Size = new System.Drawing.Size(136, 48); this.edit_condition_button.TabIndex = 11; this.edit_condition_button.Text = "Confirm Edit"; this.edit_condition_button.Visible = false; this.edit_condition_button.Click += new System.EventHandler(this.edit_condition_button_Click); // // method_name_textbox // this.method_name_textbox.Location = new System.Drawing.Point(72, 232); this.method_name_textbox.Name = "method_name_textbox"; this.method_name_textbox.Size = new System.Drawing.Size(312, 20); this.method_name_textbox.TabIndex = 6; this.method_name_textbox.Text = ""; // // method_name_label // this.method_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

117

this.method_name_label.Location = new System.Drawing.Point(8, 232); this.method_name_label.Name = "method_name_label"; this.method_name_label.Size = new System.Drawing.Size(56, 24); this.method_name_label.TabIndex = 17; this.method_name_label.Text = "Name"; // // new_library_button // this.new_library_button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.new_library_button.Location = new System.Drawing.Point(24, 24); this.new_library_button.Name = "new_library_button"; this.new_library_button.Size = new System.Drawing.Size(96, 32); this.new_library_button.TabIndex = 1; this.new_library_button.Text = "New"; this.new_library_button.Click += new System.EventHandler(this.new_library_button_Click); // // condition_label // this.condition_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.condition_label.Location = new System.Drawing.Point(144, 88); this.condition_label.Name = "condition_label"; this.condition_label.Size = new System.Drawing.Size(128, 24); this.condition_label.TabIndex = 18; this.condition_label.Text = "Condition"; this.condition_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // method_label // this.method_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.method_label.Location = new System.Drawing.Point(168, 208); this.method_label.Name = "method_label"; this.method_label.Size = new System.Drawing.Size(80, 24); this.method_label.TabIndex = 19; this.method_label.Text = "Method"; this.method_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // library_groupBox

118

// this.library_groupBox.Controls.Add(this.new_library_button); this.library_groupBox.Controls.Add(this.open_library_button); this.library_groupBox.Controls.Add(this.save_button); this.library_groupBox.Location = new System.Drawing.Point(8, 8); this.library_groupBox.Name = "library_groupBox"; this.library_groupBox.Size = new System.Drawing.Size(376, 64); this.library_groupBox.TabIndex = 20; this.library_groupBox.TabStop = false; this.library_groupBox.Text = "Library Options"; // // condition_description_groupBox // this.condition_description_groupBox.Controls.Add(this.condition_d escription_textBox); this.condition_description_groupBox.Location = new System.Drawing.Point(16, 296); this.condition_description_groupBox.Name = "condition_description_groupBox"; this.condition_description_groupBox.Size = new System.Drawing.Size(368, 96); this.condition_description_groupBox.TabIndex = 8; this.condition_description_groupBox.TabStop = false; this.condition_description_groupBox.Text = "Condition Description"; // // condition_description_textBox // this.condition_description_textBox.Location = new System.Drawing.Point(8, 16); this.condition_description_textBox.Name = "condition_description_textBox"; this.condition_description_textBox.Size = new System.Drawing.Size(352, 72); this.condition_description_textBox.TabIndex = 9; this.condition_description_textBox.Text = ""; // // datatype_drop_box // this.datatype_drop_box.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.datatype_drop_box.Items.AddRange(new object[] { "Boolean", "Integer", "Float"}); this.datatype_drop_box.Location = new System.Drawing.Point(96, 176); this.datatype_drop_box.Name = "datatype_drop_box";

119

this.datatype_drop_box.Size = new System.Drawing.Size(136, 21); this.datatype_drop_box.TabIndex = 5; // // data_type_label // this.data_type_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.data_type_label.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.data_type_label.Location = new System.Drawing.Point(0, 176); this.data_type_label.Name = "data_type_label"; this.data_type_label.Size = new System.Drawing.Size(88, 24); this.data_type_label.TabIndex = 23; this.data_type_label.Text = "Data Type"; this.data_type_label.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // Form2 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(584, 582); this.Controls.Add(this.data_type_label); this.Controls.Add(this.datatype_drop_box); this.Controls.Add(this.condition_description_groupBox); this.Controls.Add(this.library_groupBox); this.Controls.Add(this.method_label); this.Controls.Add(this.condition_label); this.Controls.Add(this.method_name_label); this.Controls.Add(this.method_name_textbox); this.Controls.Add(this.browse_textbox); this.Controls.Add(this.condition_unit_textbox); this.Controls.Add(this.condition_name_textbox); this.Controls.Add(this.edit_condition_button); this.Controls.Add(this.cancel_condition_button); this.Controls.Add(this.browse_button); this.Controls.Add(this.exit_button); this.Controls.Add(this.unit_label); this.Controls.Add(this.condition_name_label); this.Controls.Add(this.delete_condition_button); this.Controls.Add(this.add_condition_button); this.Controls.Add(this.condition_library_label); this.Controls.Add(this.condition_library); this.Menu = this.mainMenu1; this.Name = "Form2"; this.Text = "Edit Condition Library"; this.Load += new System.EventHandler(this.Form2_Load); this.library_groupBox.ResumeLayout(false); this.condition_description_groupBox.ResumeLayout(false);

120

this.ResumeLayout(false); } #endregion private void condition_name_textbox_TextChanged(object sender, System.EventArgs e) { } private void condition_library_SelectedIndexChanged(object sender, System.EventArgs e) { int index = condition_library.SelectedIndex; if( index == -1 ) { condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; browse_textbox.Text = ""; return; } condition_name_textbox.Text = myLibrary.getConditionAt(index).getName(); condition_unit_textbox.Text = myLibrary.getConditionAt(index).getUnit(); browse_textbox.Text = myLibrary.getConditionAt(index).getMethod().getPath(); method_name_textbox.Text = myLibrary.getConditionAt(index).getMethod().getName(); condition_description_textBox.Text = myLibrary.getConditionAt(index).getDescription(); switch(myLibrary.getConditionAt(index).getDataType()) { case "Boolean": datatype_drop_box.SelectedIndex = 0; break; case "Integer": datatype_drop_box.SelectedIndex = 1; break; case "Float": datatype_drop_box.SelectedIndex = 2; break; default MessageBox.Show("ERROR");

: break;

} delete_condition_button.Visible = true; edit_condition_button.Visible = true; cancel_condition_button.Visible = true; add_condition_button.Visible = false;

121

}

private void add_condition_button_Click(object sender, System.EventArgs e) { //check for blank name if( !isValidName(condition_name_textbox.Text) ) { MessageBox.Show("Name cannot be null or contain + ~ , | _ -"); condition_name_textbox.Text = ""; return; } if( !isValidName(condition_unit_textbox.Text) ) { MessageBox.Show("Unit cannot be null or contain + ~ , | _ -"); condition_unit_textbox.Text = ""; return; } if( datatype_drop_box.SelectedIndex == -1) { MessageBox.Show("Select a Data Type!"); return; } if( !isValidName(method_name_textbox.Text) ) { MessageBox.Show("Method cannot be null or contain + ~ , | _ -"); method_name_textbox.Text = ""; return; } if( !isValidName(browse_textbox.Text) ) { MessageBox.Show("Path cannot be null or contain + ~ , | _ -"); browse_textbox.Text = ""; return; } if( !isValidName(condition_description_textBox.Text) ) { MessageBox.Show("Description cannot be null or contain + ~ , | _ -"); condition_description_textBox.Text = ""; return; } for( int i = 0; i < myLibrary.getSize(); i++ ) { if( myLibrary.getConditionAt(i).getName().Equals(condition_name_textbox.Tex t.ToString()) ) {

122

MessageBox.Show(condition_name_textbox.Text.ToString()+" already exists in the library!"); return; } }

condition_library.Items.Add(condition_name_textbox.Text); Condition newCondition = new Condition(); newCondition.setName(condition_name_textbox.Text); newCondition.setUnit(condition_unit_textbox.Text); newCondition.getMethod().setPath(browse_textbox.Text); newCondition.getMethod().setName(method_name_textbox.Text); newCondition.setDescription(condition_description_textBox.Text); newCondition.setDataType(datatype_drop_box.Text); myLibrary.addCondition(newCondition); condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; method_name_textbox.Text = ""; browse_textbox.Text = ""; condition_library.SelectedIndex = -1; datatype_drop_box.SelectedIndex = -1; hasSaved = false; save_button.Enabled = true; condition_description_textBox.Text = ""; } private void delete_conditon_button_Click(object sender, System.EventArgs e) { if( condition_library.SelectedIndex == -1 ) { MessageBox.Show("Please select a condition to delete"); return; } else { myLibrary.deleteConditionAt(condition_library.SelectedIndex); condition_library.Items.Remove(condition_library.SelectedItem); condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; browse_textbox.Text = ""; condition_description_textBox.Text = ""; hasSaved = false; save_button.Enabled = true; method_name_textbox.Text = ""; delete_condition_button.Visible = false; edit_condition_button.Visible = false; cancel_condition_button.Visible = false;

123

add_condition_button.Visible = true; datatype_drop_box.SelectedIndex = -1; } } private void save_button_Click_1(object sender, System.EventArgs e) { if(condition_library.SelectedIndex != -1) { MessageBox.Show("Confirm Edit or Cancel condition selection before continuing"); return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = "Libraries\\Condition Library"; sfd.Filter = "Text files (*.txt)|*.txt"; sfd.RestoreDirectory = true; if ( sfd.ShowDialog() == DialogResult.OK ) { FileStream fstream = new FileStream( sfd.FileName, FileMode.Create ); StreamWriter swriter = new StreamWriter( fstream ); swriter.Write( "*** Condition Library ***" ); swriter.Write( "\n" ); for( int i = 0; i < myLibrary.getSize(); i++) { swriter.Write(myLibrary.getConditionAt(i).getName()+ ""+myLibrary.getConditionAt(i).getUnit()+"-"+ myLibrary.getConditionAt(i).getMethod().getName()+"-"+ myLibrary.getConditionAt(i).getMethod().getPath()+"-"+ myLibrary.getConditionAt(i).getDescription()+"-"+ myLibrary.getConditionAt(i).getDataType()); swriter.Write("\n"); }

swriter.Close(); fstream.Close(); MessageBox.Show("Library has been successfully saved"); } else //user canceled out of save dialog box { return;

124

} hasSaved = true; }

private void exit_button_Click(object sender, System.EventArgs e) { Close(); } public void promptSave(String action) { if( hasSaved == false ) { string caption = "The project has changed."; string message = "Save before continuing?"; MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) //save first, then take action { //ask user where to save SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = "Libraries\\Condition Library"; sfd.Filter = "Text files (*.txt)|*.txt"; if ( sfd.ShowDialog() == DialogResult.OK ) { cancelDialog = false; FileStream fstream = new FileStream( sfd.FileName, FileMode.Create ); StreamWriter swriter = new StreamWriter( fstream ); swriter.Write( "*** Condition Library ***" ); swriter.Write( "\n" ); for( int i = 0; i < myLibrary.getSize(); i++) { swriter.Write(myLibrary.getConditionAt(i).getName()+ ""+myLibrary.getConditionAt(i).getUnit()+"-"+

125

myLibrary.getConditionAt(i).getMethod()+"-"+ myLibrary.getConditionAt(i).getDescription()+"-"+ myLibrary.getConditionAt(i).getDataType()); swriter.Write("\n"); } swriter.Close(); fstream.Close(); MessageBox.Show("Project has been successfully saved"); hasSaved = true; if( action.Equals("open") ) { openLibrary(); } else if( action.Equals("close") ) { Close(); } else if( action.Equals("new") ) { newLibrary(); } } else //user canceled out of save dialog box { cancelDialog = true; return; } } else if( result == DialogResult.No ) //don't save, just take action { hasSaved = true; cancelDialog = false; if( action.Equals("open") ) { openLibrary(); } else if( action.Equals("close") ) { Close(); } else if( action.Equals("new") ) { newLibrary(); } } else //user pressed cancel so do nothing { cancelDialog = true;

126

return; } } return; } private void open_library_button_Click(object sender, System.EventArgs e) { if(condition_library.SelectedIndex != -1) { MessageBox.Show("Confirm Edit or Cancel condition selection before continuing"); return; } if( hasSaved == true ) { openLibrary(); } else { promptSave("open"); } } public void openLibrary() { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "Libraries\\Condition Library"; ofd.Filter = "Text files (*.txt)|*.txt"; ofd.RestoreDirectory = true; if ( ofd.ShowDialog() == DialogResult.OK ) { hasSaved = true; //clear out existing stuff condition_library.Items.Clear(); condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; browse_textbox.Text = ""; method_name_textbox.Text = ""; myLibrary.deleteCollection(); FileStream fstream = new FileStream( ofd.FileName, FileMode.Open ); StreamReader sreader = new StreamReader( fstream ); //configure the path to save to path = ofd.FileName.ToString(); String input; input = sreader.ReadLine();

127

if ( !input.Equals( "*** Condition Library ***" ) ) { sreader.Close(); fstream.Close(); MessageBox.Show("Error reading condition library file"); Close(); return; } while ( true ) { input = sreader.ReadLine(); if ( input == null ) break; Condition conditionToAdd = new Condition(); // Use split to parse parts = input.Split(delimiter, max_parts ); conditionToAdd.setName(parts[0]); conditionToAdd.setUnit(parts[1]); conditionToAdd.getMethod().setName(parts[2]); conditionToAdd.getMethod().setPath(parts[3]); conditionToAdd.setDescription(parts[4]); conditionToAdd.setDataType(parts[5]);

condition_library.Items.Add(parts[0].ToString()); myLibrary.addCondition(conditionToAdd); }//end while

sreader.Close(); fstream.Close(); condition_name_textbox.Enabled = true; condition_unit_textbox.Enabled = true; add_condition_button.Enabled = true; delete_condition_button.Enabled = true; save_button.Enabled = false; datatype_drop_box.SelectedIndex = -1; condition_description_textBox.Text = ""; }//end if } private void Form2_Load(object sender, System.EventArgs e) { }

128

private void browse_button_Click(object sender, System.EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "Libraries\\Condition Library"; ofd.Filter = "Text files (*.txt)|*.txt"; if ( ofd.ShowDialog() == DialogResult.OK ) { browse_textbox.Text = ofd.FileName.ToString(); } } private void condition_unit_textbox_TextChanged(object sender, System.EventArgs e) { //only enable save if user is editing a condition if(condition_library.SelectedIndex != -1 ) { save_button.Enabled = true; } } private void browse_textbox_TextChanged(object sender, System.EventArgs e) { //only enable save if user is editing a condition if(condition_library.SelectedIndex != -1 ) { save_button.Enabled = true; } } private void cancel_condition_button_Click(object sender, System.EventArgs e) { cancel_condition_button.Visible = false; edit_condition_button.Visible = false; delete_condition_button.Visible = false; add_condition_button.Visible = true; condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; browse_textbox.Text = ""; method_name_textbox.Text = ""; condition_description_textBox.Text = ""; condition_library.ClearSelected(); datatype_drop_box.SelectedIndex = -1; } private void edit_condition_button_Click(object sender, System.EventArgs e) { int index = condition_library.SelectedIndex;

129

myLibrary.getConditionAt(index).setName(condition_name_textbox.Te xt); myLibrary.getConditionAt(index).setUnit(condition_unit_textbox.Te xt); myLibrary.getConditionAt(index).setDataType(datatype_drop_box.Tex t); Method myMethod = new Method(); myMethod.setName(method_name_textbox.Text); myMethod.setPath(browse_textbox.Text); myLibrary.getConditionAt(index).setMethod(myMethod);

myLibrary.getConditionAt(index).setDescription(condition_descript ion_textBox.Text); condition_library.ClearSelected(); condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; method_name_textbox.Text = ""; browse_textbox.Text = ""; condition_description_textBox.Text = ""; edit_condition_button.Visible = false; delete_condition_button.Visible = false; cancel_condition_button.Visible = false; add_condition_button.Visible = true; datatype_drop_box.SelectedIndex = -1; //redraw list condition_library.Items.Clear(); for( int i = 0; i < myLibrary.getSize(); i++ ) { condition_library.Items.Add(myLibrary.getConditionAt(i).getName() ); } hasSaved = false; } private void new_library_button_Click(object sender, System.EventArgs e) { if(condition_library.SelectedIndex != -1) { MessageBox.Show("Confirm Edit or Cancel condition selection before continuing"); return; } //check to see if this library has been saved if( hasSaved == true ) {

130

newLibrary(); } else { promptSave("new"); }

} public void newLibrary() { //start new hasSaved = true; myLibrary.deleteCollection(); condition_library.Items.Clear(); condition_name_textbox.Text = ""; condition_unit_textbox.Text = ""; method_name_textbox.Text = ""; browse_textbox.Text = ""; condition_description_textBox.Text = ""; add_condition_button.Visible = true; edit_condition_button.Visible = false; cancel_condition_button.Visible = false; delete_condition_button.Visible = false; save_button.Enabled = false; datatype_drop_box.SelectedIndex = -1; } public bool isValidName(String text) { if( text.Length.Equals(0) ) return false; int numberOfSpaces = 0; for( int i = 0; i < text.Length; i++ ) { if( text[i].ToString().Equals(" ") ) { numberOfSpaces++; } //cannot include text delimiter characters else if( text[i].ToString().Equals("-") || text[i].ToString().Equals("~") || text[i].ToString().Equals("|") || text[i].ToString().Equals(",") || text[i].ToString().Equals("+") || text[i].ToString().Equals("_") ) { return false; } } if( numberOfSpaces.Equals( text.Length ) ) { return false; }

131

return true; }

}//end class }

132

Tarek Abdelzaher Approved Date STS 402 Advisor

Bachelor of Science in Computer Engineering. By. Adam Lee ...... University of Virginia (UVA), UC Berkeley, and UCLA all view DSNs through an event-based ...... electronic and information technology accessible to people with disabilities. Ina.

2MB Sizes 4 Downloads 141 Views

Recommend Documents

Tarek Abdelzaher Approved Date STS 402 Advisor
Mar 28, 2005 - Bachelor of Science in Computer Engineering. By. Adam Lee ...... UC Berkeley and The University of Colorado have developed a node-.

STS 1.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. STS 1.pdf.

STS Overall.xlsx
10. 23. Newell. Craig. CFT#Cycling#Team. 9. 24. Bailey. Simon. AAVC. 9. 25. Broglio. Steve. Lathrup#Industries. 8. 26. Cawthorn. Will. AAVC. 7. 27. Stange. Cory. Bissell#ABG#Nuvo. 4. 28. Prentice. Anthony. Team#Priority#Health. 4. 29. Kroske. Scott.

Law and Advocacy Programme Officer/Advisor Starting Date
Mar 5, 2014 - Email: [email protected] ... In March 2009, TT became the official National Contact of ... government, business and civil society.

Law and Advocacy Programme Officer/Advisor Starting Date
Mar 5, 2014 - In March 2009, TT became the official National Contact of Transparency ... citizens (in particular the youth) and the business sector in.

Approved Drawn Checked Date Description Revision AXP209 QFN49
RTCVDD. CSI-IOVDD. HPL. 6. VMIC. 6. MICIN1 6. HPR. 6. HPCOM 6. TPX2. 5 ... 5. LCD-D15. 5. LCD-D2. 3. 5. CS. I-MC. LK. 6. C. S. I-H. S. Y. N. C. 6. C. S. I-V. S ...... 6. S. 7. S. 8. S. 9. TP-WAKE-RST. TP-WAKE-RST. S0. S1. S2. S3. S4. S5. S6 ..... 2.

STS 2.PDF
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. STS 2.PDF. STS ...

402.pdf
Advancia, ESCP Europe and HEC. Abstract: The aim of ... Such difficulties to define clusters geographically, industrially and institutionally .... Displaying 402.pdf.

G.O.No.402 Fin
G.O.No.402, Dated 10th October 2013. (Vijaya, Purattasi-24, Thiruvalluvar Aandu 2044). Ad-hoc Increase – CONSOLIDATED PAY / FIXED PAY / HONORARIUM ...

STS 1744_2011, rec 53_2009.pdf
Download. Connect more apps... Try one of the apps below to open or edit this item. STS 1744_2011, rec 53_2009.pdf. STS 1744_2011, rec 53_2009.pdf. Open.

Tarek Ahmed - Advanced Reservoir Engineering.pdf
Page 1 of 422. TLFeBOOK. Page 1 of 422. Page 2 of 422. Advanced. Reservoir. Engineering. TLFeBOOK. Page 2 of 422. Page 3 of 422. This page intentionally left blank. TLFeBOOK. Page 3 of 422. Main menu. Displaying Tarek Ahmed - Advanced Reservoir Engin

Tarek Ahmed - Reservoir Engineering Handbook.pdf
Page 2 of 1,377. RESERVOIR. ENGINEERING. HANDBOOK. Third Edition. FM.qxd 3/22/06 4:52 AM Page i. Page 2 of 1,377. Page 3 of 1,377. This Page Is Intentionally Left Blank. Page 3 of 1,377. Tarek Ahmed - Reservoir Engineering Handbook.pdf. Tarek Ahmed -

Stanza 402.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Stanza 402.pdf.

Numer 402.pdf
i Łukasiewicz. 11.30 Chrzcielna: Pydych Wojciech, Kaworek Juliusz, Cudnik Jan. Roczek: Czupkiewicz Filip. 15.30 Nieszpory. 16.00 W int. Beaty Szozda z ok.

Cronograma Trimestrais 402.pdf
Page 1 of 2. COLÉGIO FRANCISCANO SAGRADA FAMÍLIA ... Texto 5: Arte Moderna Brasileira. Matemática ... Cronograma Trimestrais 402.pdf. Cronograma ...

Advisor - Communications -
environments that inspire young people to put their education into action. Through investments in ... education and improve life outcomes for all children – along the continuum from birth through high school. Through our ... Understanding of and pa

BROCHURE: Infor Interaction Advisor
data to instantly create customer profiles, and then applies an optimum combination of predictive analytics and cross-channel business rules to deliver the ...

advisor
committed to Continuous Professional Development and best practice in the field of .... in student applications to the Business School for the year 2006/07,.

CIRCULAR 4-2016 CONSECUENCIAS STS 1995-2016.pdf ...
... was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. CIRCULAR 4-2016 CONSECUENCIAS STS 1995-2016.pdf. C

Drone Services (402) 506-9700 Presentation.pdf
... operating team are licensed and insured. pilots. Our vehicles are prominently marked with our company. logo. We follow all safety precautions and when necessary, try. to notify nearby persons or residence of our flight intentions. Apogee is fully

New foreign approved participant
Jun 16, 2016 - Should the case be that there is no open interest for this class as of the date of delisting from the Toronto Exchange (June 22, 2016) the class ...

Approved
Guests; Cheyenne Suchan, Kristi McFarland. Agenda Approval. A motion was made by Perry Van Tassell and seconded by Ben Hoskisson to accept the ...