Exemple #1
0
        public void reloadDisplay()
        {
            MessageTreeView.Nodes.Clear();
            List <CANMessage> msgList = config.GetMessage();

            foreach (CANMessage msg in msgList)
            {
                TreeNode tnMessage = new TreeNode()
                {
                    Text             = msg.ToString(),
                    Tag              = msg,
                    ContextMenuStrip = ctxmMessage,
                    ImageKey         = "Message",
                    SelectedImageKey = "Message",
                };
                List <CANSignal> lstSignals = msg.GetSignalList();
                foreach (CANSignal signal in lstSignals)
                {
                    string imageKey;
                    switch (signal.sType)
                    {
                    case SignalType.Continuous:
                        imageKey = "Signal";
                        break;

                    case SignalType.Discrete:
                        imageKey = "Discrete";
                        break;

                    case SignalType.DM1FaultCode:
                        imageKey = "DM1";
                        break;

                    case SignalType.Switch:
                        imageKey = "Switch";
                        break;

                    case SignalType.UserDefined:
                        imageKey = "UserDefined";
                        break;

                    default:
                        imageKey = "Signal";
                        break;
                    }
                    tnMessage.Nodes.Add(new TreeNode()
                    {
                        Text             = signal.ToString(),
                        Tag              = signal,
                        ContextMenuStrip = ctxmSignal,
                        ImageKey         = imageKey,
                        SelectedImageKey = imageKey
                    });
                }
                tnMessage.Expand();
                MessageTreeView.Nodes.Add(tnMessage);
            }
        }
Exemple #2
0
 //向列表中追加配置
 private void appendConfigures(ConfigureFile configs)
 {
     foreach (CANMessage config in configs.GetMessage())
     {
         try {
             mteMain.configure.AppendMessage(config);
         } catch { }
     }
     mteMain.reloadDisplay();
 }
 public void loadConfigure(ConfigureFile cfIn)
 {
     canView.Dispatcher.BeginInvoke(new Action(() => {
         foreach (TreeViewItem tvi in canView.Items)
         {
             tvi.Items.Clear();
         }
         CANDecoder = new Dictionary <int, Dictionary <CANSignal, TreeViewItem> >();
         foreach (CANMessage cMsg in cfIn.GetMessage())
         {
             CANDecoder.Add(cMsg.ID, new Dictionary <CANSignal, TreeViewItem>());
             foreach (CANSignal cs in cMsg.GetSignalList())
             {
                 CANDecoder[cMsg.ID].Add(cs, new TreeViewItem()
                 {
                     Header = NOT_ADDED
                 });
             }
         }
     }));
 }