Beispiel #1
0
        public ParsedInput(INPUT_SOURCE source, string unparsedInput)
        {
            Source = source;
            Action = ACTION_ENUM.NONE;
            String = unparsedInput;

            char[] delimiters = { ' ' };
            string strInput   = unparsedInput.ToLower();

            Words = strInput.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

            if (Words.Length == 0)
            {
                return;
            }

            int nDirection = Statics.DirectionToInt(Words[0]);

            if (nDirection != -1)
            {
                // hack - replace first word with integer direction
                Words[0] = nDirection.ToString();
                Action   = ACTION_ENUM.MOVE_BASIC;
            }
            else
            {
                ACTION_ENUM action;
                if (StringToAction.TryGetValue(Words[0], out action))
                {
                    Action = action;
                }
            }
        }
        private void index2Cmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            INPUT_SOURCE inputSource = (INPUT_SOURCE)index2Cmb.SelectedItem;

            if (INPUT_SOURCE.Always_Off == inputSource || INPUT_SOURCE.Always_On == inputSource)
            {
                categorySource2cmb.IsEnabled = false;
                inverted2.IsEnabled          = false;
            }
            else if (INPUT_SOURCE.Analog_Input == inputSource)
            {
                categorySource2cmb.IsEnabled = true;
                inverted2.IsEnabled          = true;
                var items = ecu.analogList.Select(o => o.Header.ToString()).ToList();
                categorySource2cmb.ItemsSource = items;
                try
                {
                    categorySource2cmb.SelectedItem = items[CombineInput.InputIndex2];
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    CombineInput.InputIndex1        = 0;
                    categorySource2cmb.SelectedItem = items[CombineInput.InputIndex2];
                }
            }
            else if (INPUT_SOURCE.Ext_Input == inputSource)
            {
                categorySource2cmb.IsEnabled = true;
                inverted2.IsEnabled          = true;
                var items = ecu.externalList.Select(o => o.Header.ToString()).ToList();
                categorySource2cmb.ItemsSource = items;
                try
                {
                    categorySource2cmb.SelectedItem = items[CombineInput.InputIndex2];
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    CombineInput.InputIndex1        = 0;
                    categorySource2cmb.SelectedItem = items[CombineInput.InputIndex2];
                }
            }
        }