Esempio n. 1
0
 /// <summary>
 ///  切换选中行事件——通讯
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tlCommunication_RowClick(object sender, DevExpress.XtraTreeList.RowClickEventArgs e)
 {
     try
     {
         DeviceClickEventArgs args = new DeviceClickEventArgs();
         args.Key   = e.Node.Tag == null ? "" : e.Node.Tag.ToString().Trim();
         args.Param = e.Node.GetDisplayText(tlCommunication.Columns[0]);
         SelectedNodeChanged(args, true);
     }
     catch (Exception ex)
     {
         ErrorLog.Error(ex.StackTrace.ToString());
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 选中的节点发生改变时切换界面
        /// </summary>
        /// <param name="args"></param>
        /// <param name="hasParam">是否带参数</param>
        private void SelectedNodeChanged(DeviceClickEventArgs args, bool hasParam = false)
        {
            PluginInfo p = Program.devicePluginManager.GetPlugin(args.Key.Trim());

            args.SetupUI = p != null ? p.SetupUI : null;
            if (hasParam)
            {
                if (p != null && p.SetupUI != null && p.SetupUI is ucPluginBase)
                {
                    (p.SetupUI as ucPluginBase).Params = args.Param;
                }
            }
            if (DeviceClick != null)
            {
                DeviceClick(this, args);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 初始化通讯列表(可用于刷新)
 /// </summary>
 /// <param name="IsRightControlsRefresh">右侧控件是否需要同步刷新</param>
 /// <param name="isFirst">true:右侧列表显示第一个,false:显示最后一个</param>
 private void InitComList(bool IsRightControlsRefresh = false, bool isFirst = true)
 {
     tlCommunication.Nodes.Clear();
     ResultDataViewModel.VM.Execute(new List <object> {
         ResultDataViewModel.ExecuteCommand.ec_QueryCommunicationInfo
     });
     if (ResultDataViewModel.VM.QueryCommunicationEntities == null || ResultDataViewModel.VM.QueryCommunicationEntities.Count == 0)
     {
         return;
     }
     for (int i = 0; i < ResultDataViewModel.VM.QueryCommunicationEntities.Count; i++)
     {
         try
         {
             DTCommunicationInfo dt = (DTCommunicationInfo)ResultDataViewModel.VM.QueryCommunicationEntities[i];
             tlCommunication.AppendNode(new object[] { dt.Name.Value.ToString() }, -1, CheckState.Unchecked, dt.ComType.Value.ToString());
         }
         catch
         {
         }
     }
     //右侧列表是否需要刷新
     if (IsRightControlsRefresh)
     {
         try
         {
             int n = ResultDataViewModel.VM.QueryCommunicationEntities.Count - 1;
             DeviceClickEventArgs args = new DeviceClickEventArgs();
             args.Key   = tlCommunication.Nodes[isFirst ? 0 : n].Tag == null ? "" : tlCommunication.Nodes[isFirst ? 0 : n].Tag.ToString().Trim();
             args.Param = tlCommunication.Nodes[isFirst ? 0 : n].GetDisplayText(tlCommunication.Columns[0]);
             SelectedNodeChanged(args, true);
         }
         catch (Exception ex)
         {
             ErrorLog.Error(ex.StackTrace.ToString());
         }
     }
 }
Esempio n. 4
0
 private void tcList_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
 {
     if (tcList.SelectedTabPageIndex == 0)
     {
         DeviceClickEventArgs args = new DeviceClickEventArgs();
         if (tlDeviceDebug.FocusedNode == null)
         {
             return;
         }
         args.Key = tlDeviceDebug.FocusedNode.Tag == null ? "" : tlDeviceDebug.FocusedNode.Tag.ToString();
         SelectedNodeChanged(args, true);
     }
     else
     {
         DeviceClickEventArgs args = new DeviceClickEventArgs();
         if (tlCommunication.FocusedNode == null)
         {
             return;
         }
         args.Key   = tlCommunication.FocusedNode.Tag == null ? "" : tlCommunication.FocusedNode.Tag.ToString().Trim();
         args.Param = tlCommunication.FocusedNode.GetDisplayText(tlCommunication.Columns[0]);
         SelectedNodeChanged(args, true);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 切换选中行事件——设备
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tlDevice_RowClick(object sender, DevExpress.XtraTreeList.RowClickEventArgs e)
 {
     try
     {
         DeviceClickEventArgs args = new DeviceClickEventArgs();
         args.Key = e.Node.Tag == null ? "" : e.Node.Tag.ToString().Split('|')[0];
         if (args.Key.Contains("Analysis"))
         {
             args.Param = e.Node.Tag.ToString().Split('|')[1];
             SelectedNodeChanged(args, true);
             return;
         }
         PluginInfo p = Program.devicePluginManager.GetPlugin(args.Key);
         args.SetupUI = p != null ? p.SetupUI : null;
         if (DeviceClick != null)
         {
             DeviceClick(this, args);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.Error(ex.StackTrace.ToString());
     }
 }