private void ValueIn_MatDataInput(object sender, MatDataInputEventArgs e)
 {
     if (e.NewValue.DataType == typeof(double))
         Name = ((double)e.NewValue.DataValue).ToString("f6");
     else
         Name = e.NewValue.DataValue.ToString();
 }
        private void CommandIn_MatDataInput(object sender, MatDataInputEventArgs e)
        {
            if (!IsLogging)
                return;

            Dispatcher.BeginInvoke((Action)(() =>
            {
                DUALSHOCK3 data = (DUALSHOCK3)e.NewValue.DataValue;
                Log.Add(data);
                view.SetAnalogStick(data);

                List<DUALSHOCK3Buttons> list = data.GetPressedButtons();

                if (Log.Count == 1)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        DUALSHOCK3Button btn = new DUALSHOCK3Button(list[i], data.Time);
                        pressingButtons.Add(btn);
                    }
                }
                else
                {
                    List<DUALSHOCK3Button> removeList = new List<DUALSHOCK3Button>();

                    for (int i = 0; i < list.Count; i++)
                    {
                        bool exist = false;
                        DUALSHOCK3Button btn = new DUALSHOCK3Button(list[i], data.Time);

                        for (int c = 0; c < pressingButtons.Count; c++)
                        {
                            if (list[i] == pressingButtons[c].Button)
                            {
                                exist = true;
                                pressingButtons[c].EndTime = data.Time;
                                view.SetEndTime(data.Time);
                                CurrentTime = data.Time;
                            }
                        }

                        if (!exist)
                        {
                            pressingButtons.Add(btn);
                            view.SetButton(btn);
                            CurrentTime = data.Time;
                        }

                        view.SetTimeBar(CurrentTime);
                    }

                    for (int i = 0; i < pressingButtons.Count; i++)
                    {
                        bool exist = false;

                        for (int c = 0; c < list.Count; c++)
                        {
                            if (pressingButtons[i].Button == list[c])
                                exist = true;
                        }

                        if (!exist)
                        {
                            removeList.Add(pressingButtons[i]);
                        }
                    }

                    for (int i = 0; i < removeList.Count; i++)
                    {
                        pressingButtons.Remove(removeList[i]);
                    }
                }
            }));
        }
Exemple #3
0
 private void DataIn_MatDataInput(object sender, MatDataInputEventArgs e)
 {
 }
Exemple #4
0
 protected void RaiseMatDataInput(MatDataInputEventArgs e)
 {
     MatDataInput?.Invoke(this, e);
 }
Exemple #5
0
 private void DutyIn_MatDataInput(object sender, MatDataInputEventArgs e)
 {
     SendCommand((int)MotorCommand.DutyIn_DL_Value, (double)DutyIn.Value.DataValue);
 }
Exemple #6
0
 private void CommandIn_MatDataInput(object sender, MatDataInputEventArgs e)
 {
     SendCommand((int)BluetoothCommand.CommandIn_DL_Value, (DUALSHOCK3)CommandIn.Value.DataValue);
 }