コード例 #1
0
 public AnalogModelControl(BackData back, AnalogConfigModel model)
 {
     this._model    = model;
     this._backData = back;
     InitializeComponent();
     _backData.Timer.Add(GetValue);
     text_id.Text   = model.Name;
     text_port.Text = model.Port.ToString();
 }
コード例 #2
0
        public AddAnalog(AnalogConfigModel model)
        {
            _data = model;
            InitializeComponent();

            //加载显示的资源,资源有对应的枚举,在AppDate类注册
            foreach (var i in AppData._HelperModeContext)
            {
                comboBox_HelperMode.Items.Add(i.Key);
            }
            foreach (var i in AppData._DecisionModeContext)
            {
                comboBox_Decision.Items.Add(i.Key);
            }
        }
コード例 #3
0
 /// <summary>
 /// 添加一个模拟量监听模块的点击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_AddAnalogControl(object sender, RoutedEventArgs e)
 {
     if (_adam != null)
     {
         var model = new AnalogConfigModel();
         //启动添加用户控件的窗口
         AddAnalog win = new AddAnalog(model);
         win.ShowDialog();
         model = win.GetMode;
         //将用户控件添加到串口中
         if (model != null)
         {
             var control = new AnalogModelControl(_data, model);     //用户控件初始化
             control.DestroyEvent += DestroyAnalogControl;           //注册销毁控件事件
             view_AnalogContent.Children.Add(control);               //添加控件
             _data.AnalogConfigModels.Add(model.ID, control);        //控件注册
         }
     }
     else
     {
         MessageBox.Show("请先打开串口");
     }
 }
コード例 #4
0
 private void btn_Close(object sender, RoutedEventArgs e)
 {
     _data             = null;
     this.DialogResult = false;
     Close();
 }