Пример #1
0
        private void Input_OnMouseLeave(object sender, MouseEventArgs e)
        {
            var Box        = sender as InputBox;
            var TempString = Box.Text;

            if (String.IsNullOrEmpty(TempString))
            {
                Box.BorderThickness = new Thickness(0);
                Box.Text            = "example: 1;2 2;2 5;3";
                Box.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#90a4ae"));
            }
            else
            {
                if (inputParser.isCorrect(TempString))
                {
                    Box.BorderThickness = new Thickness(0);
                    if (Box == InputFirstSignal)
                    {
                        FirstSignal = DictionaryWorker.Sort(inputParser.Parse(TempString));
                        Box.Text    = DictionaryWorker.ToString(FirstSignal);
                    }
                    else
                    {
                        SecondSignal = DictionaryWorker.Sort(inputParser.Parse(TempString));
                        Box.Text     = DictionaryWorker.ToString(SecondSignal);
                    }
                }
                else
                {
                    Box.BorderThickness = new Thickness(1);
                    Box.BorderBrush     = Brushes.Red;
                }
            }
        }
Пример #2
0
        private void Input_OnMouseLeave(object sender, MouseEventArgs e)
        {
            var Box        = sender as TextBox;
            var TempString = Box.Text;

            if (String.IsNullOrEmpty(TempString) || TempString == "example: 1;2 2;2 5;3")
            {
                Box.BorderThickness = new Thickness(0);
                Box.Text            = "example: 1;2 2;2 5;3";
                Box.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#90a4ae"));
            }
            else
            {
                IsBuilded = false;
                if (inputParser.isCorrect(TempString))
                {
                    Box.BorderThickness = new Thickness(0);
                    var res = DictionaryWorker.Sort(inputParser.Parse(TempString));
                    Signal   = MyConverter.DictionaryToList(res);
                    Box.Text = DictionaryWorker.ToString(res);
                }
                else
                {
                    Box.BorderThickness = new Thickness(1);
                    Box.BorderBrush     = Brushes.Red;
                }
            }
        }