private void Override_Click(object sender, RoutedEventArgs e, Ignitor passed)
 {
     if (passed.IsOverriden)
     {
         passed.IsOverriden      = false;
         Override.Content        = "OFF";
         Override.Background     = Brushes.LightGray;
         Override_On.Background  = Brushes.LightGray;
         Override_Off.Background = Brushes.LightGray;
         Override_On.Opacity     = 0.50;
         Override_Off.Opacity    = 0.50;
     }
     else
     {
         passed.IsOverriden   = true;
         Override.Content     = "ON";
         Override.Background  = Brushes.Green;
         Override_On.Opacity  = 1.00;
         Override_Off.Opacity = 1.00;
         if (passed.isOn)
         {
             Override_On.Background  = Brushes.Green;
             Override_Off.Background = Brushes.Red;
         }
         else
         {
             Override_Off.Background = Brushes.Green;
             Override_On.Background  = Brushes.Red;
         }
     }
 }
예제 #2
0
        void Glow_Click(object sender, RoutedEventArgs e, Ignitor passed)
        {
            Popup_Ignitor newWindow = new Popup_Ignitor(passed, passed.Description);

            newWindow.Owner = this;
            newWindow.Top   = PointToScreen(Mouse.GetPosition(this)).Y - 150;
            newWindow.Left  = PointToScreen(Mouse.GetPosition(this)).X - 100;

            newWindow.Show();
        }
        public Popup_Ignitor(Ignitor passed, string description)
        {
            InitializeComponent();
            this.DataContext         = passed;
            Name.Text                = passed.Name;
            Description.Text         = description;
            Description.TextWrapping = TextWrapping.Wrap;
            if (passed.isOn)
            {
                Command.Text = "On";
            }
            else
            {
                Command.Text = "Off";
            }
            if (passed.IsOverriden)
            {
                Override.Content     = "ON";
                Override.Background  = Brushes.Green;
                Override_On.Opacity  = 1.00;
                Override_Off.Opacity = 1.00;
                if (passed.isOn)
                {
                    Override_On.Background  = Brushes.Green;
                    Override_Off.Background = Brushes.Red;
                }
                else
                {
                    Override_Off.Background = Brushes.Green;
                    Override_On.Background  = Brushes.Red;
                }
            }
            else
            {
                Override.Content        = "OFF";
                Override.Background     = Brushes.LightGray;
                Override_On.Background  = Brushes.LightGray;
                Override_Off.Background = Brushes.LightGray;
                Override_On.Opacity     = 0.50;
                Override_Off.Opacity    = 0.50;
            }


            Override.Click        += delegate(object sender, RoutedEventArgs e) { Override_Click(sender, e, passed); };
            Override_On.Click     += delegate(object sender, RoutedEventArgs e) { Override_State_Click(sender, e, passed); };
            Override_Off.Click    += delegate(object sender, RoutedEventArgs e) { Override_State_Click(sender, e, passed); };
            passed.OnStateChanged += new Ignitor.StateChanged(Passed_OnStateChanged);
        }
 private void Override_State_Click(object sender, RoutedEventArgs e, Ignitor passed)
 {
     if (passed.IsOverriden)
     {
         if (sender == Override_On)
         {
             passed.TurnOn();
             Override_On.Background  = Brushes.Green;
             Override_Off.Background = Brushes.Red;
         }
         else if (sender == Override_Off)
         {
             passed.TurnOff();
             Override_Off.Background = Brushes.Green;
             Override_On.Background  = Brushes.Red;
         }
     }
 }
예제 #5
0
        void initPandID()
        {
            Rocket_Image.Source    = new BitmapImage(new Uri(MainWindow.symbol_path + @"\Rocket_flipped_propane.png"));
            Glow_Plug_Image.Source = new BitmapImage(new Uri(MainWindow.symbol_path + @"\Glow_Plug\Glow_Plug_Off.png"));

            Fill_Valve       = new Valve(Fill_Valve_Image, "Fill Valve", false, "Valve used to control the fill process");
            Tank_Valve       = new Valve(Tank_Vent_Image, "Tank Vent Valve", true, "Valve used to vent the Tank");
            Propane_Valve    = new Valve(Propane_Valve_Image, "Propane Valve", true, "Valve used to control propane flow");
            Fill_Vent_Valve  = new Valve(Fill_Vent_Valve_Image, "Fill Vent Valve", true, "Valve used to vent the fill line");
            Servo_Valve      = new Valve(Servo_element, "Servo Valve", true, "Valve used to control nitrous into the motor");
            fill_Arm_Contact = new Fill_Arm_Contact(Contact, "Fill Arm Contactor", "Contactor used to contect fill arm to the rocket");
            tank_Level       = new Tank_Level(Tank_Level_Image);
            ignitor          = new Ignitor(Glow_Plug_Image, "Glow Plug", "Ignites Propane in the combustion chamber to begin combustion of the fuel grain");

            Fill_Valve.image.MouseLeftButtonDown      += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Fill_Valve));
            Tank_Valve.image.MouseLeftButtonDown      += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Tank_Valve));
            Propane_Valve.image.MouseLeftButtonDown   += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Propane_Valve));
            Fill_Vent_Valve.image.MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Fill_Vent_Valve));
            Servo_Valve.image.MouseLeftButtonDown     += new MouseButtonEventHandler((sender, e) => Valve_Click(sender, e, Servo_Valve));
            Glow_Plug_Image.MouseLeftButtonDown       += new MouseButtonEventHandler((sender, e) => Glow_Click(sender, e, ignitor));
        }