Beispiel #1
0
        void initObjects()
        {
            Valve            Fill             = new Valve(Fill_Valve, "Fill Valve", false, "Valve used to control the fill process");
            Valve            Tank             = new Valve(Tank_Vent, "Tank Vent Valve", true, "Valve used to vent the Tank");
            Valve            Propane          = new Valve(Propane_Valve, "Propane Valve", true, "Valve used to control propane flow");
            Valve            Fill_Vent        = new Valve(Fill_Vent_Valve, "Fill Vent Valve", true, "Valve used to vent the fill line");
            Valve            Servo_valve      = new Valve(Servo_element, "Servo Valve", true, "Valve used to control nitrous into the motor");
            Fill_Arm_Contact fill_Arm_Contact = new Fill_Arm_Contact(Contact, "Fill Arm Contactor", "Contactor used to contect fill arm to the rocket");
            Tank_Level       tank_Level       = new Tank_Level(Tank_Level_Image);

            Fill.image.MouseLeftButtonDown        += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Fill));
            Tank.image.MouseLeftButtonDown        += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Tank));
            Propane.image.MouseLeftButtonDown     += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Propane));
            Fill_Vent.image.MouseLeftButtonDown   += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Fill_Vent));
            Servo_valve.image.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Servo_valve));
            //Glow_Plug.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Ignitor_Click(sender, e, Servo_valve));

            P1_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, P1));
            P1.textBlock      = P1_Display;
            P1.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            P1.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            P2_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, P2));
            P2.textBlock      = P2_Display;
            P2.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            P2.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            P3_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, P3));
            P3.textBlock      = P3_Display;
            P3.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            P3.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            P4_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, P4));
            P4.textBlock      = P4_Display;
            P4.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            P4.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T1_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T1));
            T1.textBlock      = T1_Display;
            T1.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T1.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T2_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T2));
            T2.textBlock      = T2_Display;
            T2.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T2.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T3_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T3));
            T3.textBlock      = T3_Display;
            T3.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T3.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T4_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T4));
            T4.textBlock      = T4_Display;
            T4.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T4.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T5_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T5));
            T5.textBlock      = T5_Display;
            T5.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T5.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);
            T6_Display.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Sensor_Click(sender, e, T6));
            T6.textBlock      = T6_Display;
            T6.OnDataCaution += new DataObject.DataCaution(OnDataCaution_Handler);
            T6.OnDataWarning += new DataObject.DataWarning(OnDataWarning_Handler);

            string[] Idle_state_text = {};
            State    Idle_state      = new State(State.Name.Idle, Idle_state_text, 30, Sequence_Stack.Width);

            string[] Fill_state_text = { "This text should wrap", "Lets see how this works", "State 3", "State 4" };
            State    Fill_state      = new State(State.Name.Fill_Tank, Fill_state_text, 30, Sequence_Stack.Width);

            string[] Fill_Disconnect_state_text = { "State 1", "State 2", "State 3", "State 4" };
            State    Fill_Disconnect_State      = new State(State.Name.Disconnect_Fill_Arm, Fill_Disconnect_state_text, 30, Sequence_Stack.Width);

            string[] Door_Close_state_text = { "State 1", "State 2", "State 3", "State 4" };
            State    Door_Close_state      = new State(State.Name.Close_Fill_Door, Door_Close_state_text, 30, Sequence_Stack.Width);

            string[] Launch_state_text = { "Burn Wire Check", "Ignition", "Open Valve", "Take Off" };
            State    Launch_state      = new State(State.Name.Launch, Launch_state_text, 30, Sequence_Stack.Width);

            Caution_Button.Click         += delegate(object sender, RoutedEventArgs e) { Caution_Button_Click(sender, e); };
            Warning_Button.Click         += delegate(object sender, RoutedEventArgs e) { Warning_Button_Click(sender, e); };
            Fill_Button.Click            += delegate(object sender, RoutedEventArgs e) { Fill_Command_Button_Click(sender, e, Fill_state); };
            Fill_Disconnect_Button.Click += delegate(object sender, RoutedEventArgs e) { Fill_Command_Button_Click(sender, e, Fill_Disconnect_State); };
            Door_Button.Click            += delegate(object sender, RoutedEventArgs e) { Fill_Command_Button_Click(sender, e, Door_Close_state); };
            Launch_Button.Click          += delegate(object sender, RoutedEventArgs e) { Fill_Command_Button_Click(sender, e, Launch_state); };

            Pad_Connect_Button.Click += delegate(object sender, RoutedEventArgs e) { Connect_Button_Click(sender, e); };
        }