Beispiel #1
0
        //private bool namePanel1Visibility = true;
        //public bool NamePanel1Visibility
        //{
        //    get => namePanel1Visibility;
        //    set => SetProperty(ref namePanel1Visibility, value);
        //}

        //public bool NamePanel2Visibility => !NamePanel1Visibility;

        //private string headerString1;
        //public string HeaderString1
        //{
        //    get => headerString1;
        //    set => SetProperty(ref headerString1, value);
        //}

        //private string headerString2;
        //public string HeaderString2
        //{
        //    get => headerString2;
        //    set => SetProperty(ref headerString2, $" {value}");
        //}

        //private string headerSubstring;
        //public string HeaderSubstring
        //{
        //    get => headerSubstring;
        //    set => SetProperty(ref headerSubstring, value);
        //}

        public void TextBox_MsgTimeChanged(object sender, TextChangedEventArgs e)
        {
            if (sender is TextBox textBox)
            {
                FormControl formControl = _formControlsList.Find(x => textBox.Name == x.InputControl.Name);

                if (formControl == null || !CheckTimeFormat(formControl))
                {
                    return;
                }

                // Create event time changed
                //EventHandler<FormEventArgs> OnMsgTimeChange = EventMsgTimeChanged;
                FormEventArgs formEventArgs = new FormEventArgs()
                {
                    SubjectLine = textBox.Text
                };
                EventMsgTimeChanged?.Invoke(this, formEventArgs);
            }
        }
Beispiel #2
0
        protected override void ScanControls(DependencyObject panelName, FrameworkElement formUserControl = null)
        {
            int count = VisualTreeHelper.GetChildrenCount(panelName);

            for (int i = 0; i < count; i++)
            {
                DependencyObject control = VisualTreeHelper.GetChild(panelName, i);

                switch (control)
                {
                case StackPanel _:
                case Grid _:
                case Border _:
                case RelativePanel _:
                    ScanControls(control, formUserControl);
                    break;

                case TextBox textBox:
                    FormControl formControl = new FormControl((FrameworkElement)control, formUserControl);
                    if (textBox.IsReadOnly)
                    {
                        formControl.BaseBorderColor = WhiteBrush;
                    }
                    else
                    {
                        textBox.BorderBrush = RootPanel.Resources["TextControlBorderBrush"] as Brush;
                        //textBox.BorderThickness = (Thickness)RootPanel.Resources["TextControlBorderThemeThickness"];
                        //textBox.BorderThickness = RootPanel.Resources["TextControlBorderThemeThickness"] as Thickness;
                        //formControl.BaseBorderColor = textBox.BorderBrush;
                        CornerRadius cornerRadius = textBox.CornerRadius;
                    }
                    _formControlsList.Add(formControl);
                    break;

                case ComboBox comboBox:
                    formControl = new FormControl((FrameworkElement)control, formUserControl)
                    {
                        BaseBorderColor = comboBox.BorderBrush
                    };
                    _formControlsList.Add(formControl);
                    break;

                case CheckBox _:
                case RadioButtons _:
                case RichTextBlock _:
                    formControl = new FormControl((FrameworkElement)control, formUserControl);
                    _formControlsList.Add(formControl);
                    break;

                case AutoSuggestBox autoSuggestBox:
                    formControl = new FormControl((FrameworkElement)control, formUserControl)
                    {
                        BaseBorderColor = TextBoxBorderBrush
                    };
                    if (formControl.UserControl is AutoSuggestTextBoxUserControl)
                    {
                        autoSuggestBox.Name = formControl.UserControl.Name;
                        autoSuggestBox.Tag  = formControl.UserControl.Tag;
                    }
                    _formControlsList.Add(formControl);
                    break;

                case AutoSuggestTextBoxUserControl _:
                    ScanControls((control as AutoSuggestTextBoxUserControl).Panel, control as FrameworkElement);
                    break;
                }
            }
        }