예제 #1
0
        private void setSelectedElement(object sender, RoutedEventArgs e)
        {
            FB_view.View_Valve_2_Pos fb_valve = GetValveById(((FB_view.View_Valve_2_Pos)((Grid)((Button)sender).Parent).Parent).GetId());
            if (null != fb_valve)
            {
                if (fb_valve.GetId() == lastElement_id)
                {
                    fb_valve.rect.Fill = COLOR_GREY_UNSEL;
                    lastElement_id     = -1;
                }
                else
                {
                    var last_valve = GetValveById(lastElement_id);
                    if (null != last_valve)
                    {
                        last_valve.rect.Fill = COLOR_GREY_UNSEL;
                    }
                    fb_valve.rect.Fill = COLOR_GREY_SEL;
                    lastElement_id     = fb_valve.GetId();

                    fb_json.Text    = fb_valve.ReadFBJson(Manager.Project_Explorer.PATH_FB);
                    param_json.Text = fb_valve.ReadParamJson();
                }
            }
        }
예제 #2
0
 private void AddNewFB(FB_view.View_Valve_2_Pos fb)
 {
     fb.bp.Click += new RoutedEventHandler(setSelectedElement);
     i++;
     valveView.Children.Add(fb);
 }