Esempio n. 1
0
        public MainWindow()
        {
            // init component
            InitializeComponent();

            // Log Console Message
            lLog.Items.Insert(0, "Starting Application...");

            cmdPro     = new ViewCommandProperties();
            listSigPro = new List <ViewSignalProperties>();

            listSend = new List <SendCmd_>();
            util     = new Utility_();
            check    = new ReadAndCheckData();

            bool result = check.CheckCommand(util.LoadJson_());

            lLog.Items.Insert(0, "Read and check all command from data. result =" + result);

            arrCmdJson = JsonConvert.DeserializeObject <CommandJson_[]>(util.LoadJson_());

            // Binding data
            DataContext = this;
            lLog.Items.Insert(0, "Bindind data ..");

            // init all data
            thread.Start();
        }
Esempio n. 2
0
        private void cbRawVal_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cb = sender as ComboBox;

            if (cb.SelectedIndex == -1)
            {
                return;
            }
            if (arrview[selectedCmdIdx].properties.sigList.ToArray() != null)
            {
                arrview[selectedCmdIdx].properties.sigList.ToArray()[selectedSigIdx].rawVal = int.Parse(cb.SelectedValue.ToString());
            }
            ViewCommandProperties temp = cmdPro;

            TranferData(arrview[selectedCmdIdx].properties, ref temp);

            // TODO:
            // incase send preodic data.
            // if you change data value. We need rebuild and update data.
            //if (String.Equals("SENDING..", arrview[selectedCmdIdx].properties.sentStatus, StringComparison.CurrentCulture))
            //{
            //    listSend.Clear();
            //    listSend = util.creatSendList_(arrview);
            //    // Rebuild send cycle data
            //    // And push + update data
            //    string json = util.CreateFileJson_(listSend.ToArray(), "send_periodic.json");
            //    check.CheckSendMessage(json);
            //    lLog.Items.Insert(0, "Call ide compiler to gen file send_periodic.json");
            //    //Process.Start("ide_compiler_send_preodic.bat").WaitForExit();
            //    util.ide_compiler_send_preodic();
            //    lLog.Items.Insert(0, "build to trunk code and PAUSE send command with preodic");
            //}
        }
Esempio n. 3
0
        private void cbChanel_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // TODO:
            ComboBox cb = sender as ComboBox;

            if (cb.SelectedIndex == -1)
            {
                return;
            }
            Console.WriteLine("cbChanel_SelectionChanged item = {0}", cb.SelectedValue);
            // update chanel
            arrview[selectedCmdIdx].properties.chanelSelectedIdx = cb.SelectedIndex;

            ViewCommandProperties temp = cmdPro;

            TranferData(arrview[selectedCmdIdx].properties, ref temp);
        }
Esempio n. 4
0
        private void cbTriger_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cb = sender as ComboBox;

            if (cb.SelectedIndex == -1)
            {
                return;
            }
            lLog.Items.Insert(0, "cbTriger_SelectionChanged item = " + cb.SelectedValue);
            //// update triger and send status view
            //arrview[selectedCmdIdx].properties.trigerSelectedIdx = cb.SelectedIndex;
            //arrview[selectedCmdIdx].properties.isCycle = arrview[selectedCmdIdx].properties.trigerSelectedIdx == 1 ? true : false; /* 0: manual 1: cycle*/
            if (!arrview[selectedCmdIdx].properties.isCycle)
            {
                // SENDING -> END
                if (String.Equals("SENDING..", arrview[selectedCmdIdx].properties.sentStatus, StringComparison.CurrentCulture))
                {
                    // Stop it
                    lLog.Items.Insert(0, "ADD: PAUSE send preodic cmdID = " + arrview[selectedCmdIdx].properties.id);
                    arrview[selectedCmdIdx].properties.sentStatus = "SEND";
                    listSend = util.creatSendList_(arrview);
                    // Creat json.
                    string json = util.CreateFileJson_(listSend.ToArray(), "send_periodic.json");
                    check.CheckSendMessage(json);
                    lLog.Items.Insert(0, "Call ide compiler to gen file send_periodic.json");
                    util.ide_compiler_send_preodic();
                    lLog.Items.Insert(0, "build to trunk code and PAUSE send command with preodic");
                }
                arrview[selectedCmdIdx].properties.sentStatus = "SEND";
            }
            else
            {
                if (String.Equals("SEND", arrview[selectedCmdIdx].properties.sentStatus, StringComparison.CurrentCulture))
                {
                    arrview[selectedCmdIdx].properties.sentStatus = "START";
                }
            }
            ViewCommandProperties temp = cmdPro;

            TranferData(arrview[selectedCmdIdx].properties, ref temp);
        }
Esempio n. 5
0
        private void cbType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // TODO:
            ComboBox cb = sender as ComboBox;

            if (cb.SelectedIndex == -1)
            {
                return;
            }
            Console.WriteLine("cbType_SelectionChanged item = {0}", cb.SelectedValue);
            string type = "CAN FD";
            bool   brs  = String.Equals(type, cmdPro.typeList[cb.SelectedIndex], StringComparison.CurrentCulture);

            // update type
            arrview[selectedCmdIdx].properties.typeSelectedIdx = cb.SelectedIndex;
            arrview[selectedCmdIdx].properties.brs             = brs;

            ViewCommandProperties temp = cmdPro;

            TranferData(arrview[selectedCmdIdx].properties, ref temp);
        }
Esempio n. 6
0
        private void listCmd_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lCmd.SelectedIndex == -1)
            {
                return;
            }
            // select index
            selectedCmdIdx = lCmd.SelectedIndex;
            if (arrview == null)
            {
                Console.WriteLine("not view !");
                lLog.Items.Insert(0, "ERR: not view");
                lSig.ItemsSource = null;
                // update data
                spProperties.IsEnabled = false;
                return;
            }
            spProperties.IsEnabled = true;

            for (var i = 0; i < arrview.Length; i++)
            {
                if (i == lCmd.SelectedIndex)
                {
                    //lLog.Items.Insert(0, "Sellect command name = " + arrview[i].properties.name);
                    arrview[i].isSellectedCommand = true;
                    // update data
                    ViewCommandProperties temp = cmdPro;
                    TranferData(arrview[i].properties, ref temp);
                }
                else
                {
                    arrview[i].isSellectedCommand = false;
                }
            }
            listSigPro = arrview[selectedCmdIdx].properties.sigList;
            // update data
            lSig.ItemsSource = listSigPro;
        }