Beispiel #1
0
        public static void Add(Grid grid, string label, Binding value, int row, double minimum, double maximum, string labelStyle, string inputStyle, int startColumn)
        {
            var column = startColumn;

            if (label != "")
            {
                var labelElement = new TextBlock
                {
                    Style = App.Instance.Resources[labelStyle] as Style
                };
                labelElement.SetResourceReference(TextBlock.TextProperty, label);
                labelElement.VerticalAlignment = VerticalAlignment.Center;
                labelElement.Margin            = new Thickness(column > 0 ? 5 : 0, 0, 10, 0);

                grid.Children.Add(labelElement);
                Grid.SetColumn(labelElement, column);
                Grid.SetRow(labelElement, row);
                column += 1;
            }

            var inputElement = new System.Windows.Controls.Slider
            {
                Orientation         = Orientation.Horizontal,
                Minimum             = minimum,
                Maximum             = maximum,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Thickness(column > 0 ? 5 : 0, 0, 0, 5)
            };

            if (inputStyle != "")
            {
                var s = App.Instance.Resources[inputStyle] as Style;
                if (s.TargetType == typeof(System.Windows.Controls.Slider))
                {
                    inputElement.Style = s;
                }
            }
            inputElement.SetBinding(System.Windows.Controls.Slider.ValueProperty, value);

            grid.Children.Add(inputElement);
            Grid.SetColumn(inputElement, column);
            Grid.SetRow(inputElement, row);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ColorGradientsListBox = GetTemplateChild("ColorGradientsListBox") as ListBox;
            if (ColorGradientsListBox != null)
            {
                loadColorGradientsListBox();
                ColorGradientsListBox.SelectionChanged += new SelectionChangedEventHandler(onListBoxSelectionChanged);
            }

            CancelButton = GetTemplateChild("CancelButton") as Button;
            if(CancelButton != null)
                CancelButton.Click += new RoutedEventHandler(CancelButton_Click);

            OKButton = GetTemplateChild("OKButton") as Button;
            if(OKButton != null)
                OKButton.Click += new RoutedEventHandler(OkButton_Click);

            IntensitySlider = GetTemplateChild("IntensitySlider") as Slider;
            if (IntensitySlider != null)
            {
                IntensitySlider.SetBinding(Slider.ValueProperty, new Binding()
                {
                    Mode = BindingMode.TwoWay,
                    Source = DataContext,
                    Path = new PropertyPath("Intensity")
                });
            }

            ResolutionSlider = GetTemplateChild("ResolutionSlider") as Slider;
            if (ResolutionSlider != null)
            {
                ResolutionSlider.SetBinding(Slider.ValueProperty, new Binding()
                {
                    Mode = BindingMode.TwoWay,
                    Source = DataContext,
                    Path = new PropertyPath("Resolution")
                });
            }
        }        
        public FrameworkElement CreateView(PropertyInfo property)
        {
            var rangeAttr = property.GetCustomAttributes(typeof(RangeAttribute),
                false).FirstOrDefault() as RangeAttribute;
            if (rangeAttr != null)
            {
                var inputControl = new Grid();

                inputControl.ColumnDefinitions.Add(new ColumnDefinition
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                inputControl.ColumnDefinitions.Add(new ColumnDefinition
                {
                    Width = new GridLength(0, GridUnitType.Auto)
                });

                var slider = new Slider();
                slider.Minimum = Convert.ToDouble(rangeAttr.Minimum);
                slider.Maximum = Convert.ToDouble(rangeAttr.Maximum);

                var binding = new Binding(property.Name);
                binding.Mode = BindingMode.TwoWay;
                slider.SetBinding(Slider.ValueProperty, binding);
                inputControl.Children.Add(slider);

                var tb = new TextBlock();
                slider.ValueChanged += (s, e) =>
                {
                    tb.Text = e.NewValue.ToString(".00");
                };

                inputControl.Children.Add(tb);
                Grid.SetColumn(tb, 1);
                return inputControl;
            }
            else
            {
                return new StringConfigControl().CreateView(property);
            }
        }
Beispiel #4
0
        private void build_gui()
        {
            this.DataContext = spectrum;

            Rectangle rect1 = new Rectangle();
            rect1.Width = 70;
            rect1.Height = 70;
            Binding bind_brush = new Binding("SpectrumBrush");
            rect1.SetBinding(Rectangle.FillProperty, bind_brush);

            StackPanel sp = new StackPanel();
            StackPanel sp1 = this.tb_slider("R", "Red:");
            StackPanel sp2 = this.tb_slider("G", "Green:");
            StackPanel sp3 = this.tb_slider("B", "Blue:");

            sp.Children.Add(sp1);
            sp.Children.Add(sp2);
            sp.Children.Add(sp3);

            Slider rainbow_slider = new Slider();
            rainbow_slider.Width = 300;
            rainbow_slider.Minimum = 0.0;
            rainbow_slider.Maximum = 1.0;
            rainbow_slider.Background = this.spectrum.rainbow_brush(new Point(0.0, 0.5), new Point(1.0, 0.5));
            Binding bind_rainbow = new Binding("RainbowValue");
            rainbow_slider.SetBinding(Slider.ValueProperty, bind_rainbow);

            StackPanel sp_color = new StackPanel();
            sp_color.Orientation = Orientation.Horizontal;
            sp_color.Height = 80;
            sp_color.Children.Add(rect1);
            sp_color.Children.Add(sp);

            StackPanel all = new StackPanel();
            all.Children.Add(sp_color);
            all.Children.Add(rainbow_slider);
            all.Height = 120;
            all.Width = 300;
            this.Content = all;
        }
Beispiel #5
0
        Ctrl.Control ConvertElement(VM.Element vm)
        {
            var t = vm.GetType();

            if (t == typeof(VM.TableView))
            {
                var tv = (VM.TableView)vm;

                var lv = new Ctrl.ListView {
                    DataContext = tv
                };
                lv.SetBinding(Ctrl.ListView.ItemsSourceProperty, tv.Path);

                lv.SetBinding(Ctrl.ListView.VisibilityProperty, new Binding("Items.Count")
                {
                    RelativeSource = RelativeSource.Self,
                    Mode           = BindingMode.OneWay,
                    Converter      = new IntToVisibilityConverter()
                });

                if (tv.ItemType.IsPrimitive != true)
                {
                    var gv = new Ctrl.GridView();

                    var props = tv.ItemType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                    foreach (var xt in props)
                    {
                        gv.Columns.Add(new Ctrl.GridViewColumn
                        {
                            DisplayMemberBinding = new Binding(xt.Name),
                            Header = xt.Name,
                            Width  = Double.NaN,
                        });
                    }
                    lv.View = gv;
                }

                return(lv);
            }

            if (t == typeof(VM.SlideInput))
            {
                var slider = new Ctrl.Slider
                {
                    Name        = vm.Name,
                    DataContext = (VM.SlideInput)vm,
                };
                slider.SetBinding(Ctrl.Slider.ValueProperty, vm.Path);
                return(slider);
            }

            if (t == typeof(VM.EnumInput))
            {
                return(new MechaCtrl.EnumInput
                {
                    Name = vm.Name,
                    ViewModel = (VM.EnumInput)vm
                });
            }

            if (t == typeof(VM.TextView))
            {
                return(new MechaCtrl.TextView
                {
                    Name = vm.Name,
                    ViewModel = (VM.TextView)vm,
                });
            }

            if (t == typeof(VM.CheckBox))
            {
                var chkBox = new Ctrl.CheckBox
                {
                    Name        = vm.Name,
                    DataContext = (VM.CheckBox)vm,
                };
                chkBox.SetBinding(Ctrl.CheckBox.IsCheckedProperty, vm.Path);
                return(chkBox);
            }

            if (t == typeof(VM.DateInput))
            {
                return(new MechaCtrl.DateInput
                {
                    Name = vm.Name,
                    ViewModel = (VM.DateInput)vm,
                });
            }

            if (t == typeof(VM.TextInput))
            {
                return(new MechaCtrl.TextInput
                {
                    Name = vm.Name,
                    ViewModel = (VM.TextInput)vm,
                });
            }

            if (t == typeof(VM.PathInput))
            {
                return(new MechaCtrl.PathInput
                {
                    Name = vm.Name,
                    ViewModel = (VM.PathInput)vm,
                });
            }

            if (t == typeof(VM.PasswordInput))
            {
                return(new MechaCtrl.PasswordInput
                {
                    Name = vm.Name,
                    ViewModel = (VM.PasswordInput)vm,
                });
            }

            if (t == typeof(VM.Button))
            {
                var btn = new Ctrl.Button
                {
                    Name        = vm.Name,
                    DataContext = vm,
                };
                var btnVm = (VM.Button)vm;
                btn.Click += async(o, e) => await TryInvokeButton(btnVm);

                return(btn);
            }

            throw new NotImplementedException();
        }
 private void DoNewControl2(object obj)
 {
     var element = new Slider { Width = 100 };
     element.SetBinding(Slider.ValueProperty, new Binding("InputValue") { Mode = BindingMode.TwoWay });
     element.SetBinding(Slider.IsEnabledProperty, new Binding("IsAuthenticated") { Source = AuthVM });
     SubView = element;
 }
Beispiel #7
0
        public static void Add(Grid grid, string label, Binding value, int row, double minimum, double maximum, string labelStyle, string inputStyle, int startColumn)
        {
            int column = startColumn;
            if (label != "")
            {
                TextBlock labelElement = new TextBlock();
                labelElement.Style = App.Instance.Resources[labelStyle] as Style;
                labelElement.SetResourceReference(TextBlock.TextProperty, label);
                labelElement.VerticalAlignment = VerticalAlignment.Center;
                labelElement.Margin = new Thickness(column > 0 ? 5 : 0, 0, 10, 0);

                grid.Children.Add(labelElement);
                Grid.SetColumn(labelElement, column);
                Grid.SetRow(labelElement, row);
                column += 1;
            }

            System.Windows.Controls.Slider inputElement = new System.Windows.Controls.Slider();
            inputElement.Orientation = Orientation.Horizontal;
            inputElement.Minimum = minimum;
            inputElement.Maximum = maximum;
            inputElement.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputElement.Margin = new Thickness(column > 0 ? 5 : 0, 0, 0, 5);
            if (inputStyle != "")
            {
                Style s = App.Instance.Resources[inputStyle] as Style;
                if (s.TargetType == typeof(System.Windows.Controls.Slider))
                    inputElement.Style = s;
            }
            inputElement.SetBinding(System.Windows.Controls.Slider.ValueProperty, value);

            grid.Children.Add(inputElement);
            Grid.SetColumn(inputElement, column);
            Grid.SetRow(inputElement, row);
        }
        /// <summary>
        /// Creates the slider control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns>
        /// The control.
        /// </returns>
        protected virtual FrameworkElement CreateSliderControl(PropertyItem property)
        {
            var g = new Grid();
            g.ColumnDefinitions.Add(
                new System.Windows.Controls.ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            g.ColumnDefinitions.Add(
                new System.Windows.Controls.ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            var s = new Slider
                {
                    Minimum = property.SliderMinimum,
                    Maximum = property.SliderMaximum,
                    SmallChange = property.SliderSmallChange,
                    LargeChange = property.SliderLargeChange,
                    TickFrequency = property.SliderTickFrequency,
                    IsSnapToTickEnabled = property.SliderSnapToTicks
                };
            s.SetBinding(RangeBase.ValueProperty, property.CreateBinding());
            g.Children.Add(s);

            var trigger = property.AutoUpdateText ? UpdateSourceTrigger.PropertyChanged : UpdateSourceTrigger.Default;
            var c = new TextBoxEx { IsReadOnly = property.Descriptor.IsReadOnly };

            var formatString = property.FormatString;
            if (formatString != null && !formatString.StartsWith("{"))
            {
                formatString = "{0:" + formatString + "}";
            }

            var binding = property.CreateBinding();
            binding.StringFormat = formatString;
            binding.UpdateSourceTrigger = trigger;

            c.SetBinding(TextBox.TextProperty, binding);

            Grid.SetColumn(c, 1);
            g.Children.Add(c);

            return g;
        }
        public VideoDashboard()
        {
            cardCount = 0;
            InitializeComponent();
            mainWPanel = new WrapPanel();
            mainWPanel.Width = 1050;
            rightSPanel = new StackPanel();
            rightSPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            rightSPanel.Orientation = Orientation.Vertical;
            rightSPanel.Width = 180;
            bottom = new GroupBox();
            bottom.Header = "Controls";
            bottom.Content = rightSPanel;
            cards = new List<Card>();
            addCard = new Button { Content = "Add Card", Margin = new Thickness(3) };
            playAll = new Button { Content = "Play All", Margin = new Thickness(3) };
            plusTenMS = new Button { Content = "+10 milliseconds", Margin = new Thickness(10,3,10,3) };
            minusTenMS = new Button { Content = "-10 milliseconds", Margin = new Thickness(10,3,10,3) };
            speedRatioSlider = new Slider { Orientation = Orientation.Vertical, Height = 75, Margin = new Thickness(72, 5, 72, 5), Value = 0 };
            speedRatioSlider.Maximum = 1.2;
            Binding binding_sRatioTooltip = new Binding("Value");
            binding_sRatioTooltip.Source = speedRatioSlider;
            speedRatioSlider.SetBinding(Slider.ToolTipProperty, binding_sRatioTooltip);

            mainStack.CanVerticallyScroll = true;
            mainStack.Children.Add(mainWPanel);
            mainStack.Children.Add(bottom);
            
            addCard.Click += addCard_Click;
            playAll.Click += playAll_Click;
            plusTenMS.Click += (s, e) =>
                {
                    foreach (var p in players)
                    {
                        p.Pause();
                    }
                    playAll.Content = "Play All";
                    foreach (var c in cards)
                    {
                        c.advanceMediaPos(10);
                    }
                };

            minusTenMS.Click += (s, e) =>
                {
                    foreach (var p in players)
                    {
                        p.Pause();
                    }
                    playAll.Content = "Play All";
                    foreach (var c in cards)
                    {
                        c.advanceMediaPos(-10);
                    }
                };


            rightSPanel.Children.Add(addCard);
            rightSPanel.Children.Add(playAll);
            rightSPanel.Children.Add(new GroupBox { Header = "Speed Ratio", Content = speedRatioSlider });
            rightSPanel.Children.Add(plusTenMS);
            rightSPanel.Children.Add(minusTenMS);

            players = new List<MediaUriElement>();
            closeButtons = new List<CustomButton>();
        }
        private StackPanel tb_slider(string property_name, string label, float max)
        {
            TextBlock tb_key = new TextBlock();
            tb_key.Text = label;
            tb_key.Height = 20;
            tb_key.Width = 65;
            tb_key.TextAlignment = TextAlignment.Right;

            Slider slider = new Slider();
            slider.Minimum = 0.0;
            slider.Maximum = max;
            slider.Width = 150;
            Binding bind_slider = new Binding(property_name);
            slider.SetBinding(Slider.ValueProperty, bind_slider);

            TextBox tbox_key = new TextBox();
            tbox_key.Width = 60;
            tbox_key.Height = 20;
            tbox_key.Foreground = Brushes.White;
            tbox_key.CaretBrush = Brushes.White;
            Binding bind_tbox_key = new Binding(property_name);
            tbox_key.SetBinding(TextBox.TextProperty, bind_tbox_key);

            StackPanel sp_key = new StackPanel();
            sp_key.Orientation = Orientation.Horizontal;
            sp_key.Height = 25;
            sp_key.Children.Add(tb_key);
            sp_key.Children.Add(slider);
            sp_key.Children.Add(tbox_key);

            return sp_key;
        }
Beispiel #11
0
        /// <summary>
        /// Populates the settings panel with the settings of a given plugin.
        /// </summary>
        /// <param name="plugin">The plugin whose settings to display</param>
        private void PopulateSettings(Plugin plugin)
        {
            SettingsGrid.RowDefinitions.Clear();
            SettingsGrid.Children.Clear();

            for (int i = 0; i < plugin.Settings.Count; i++)
            {
                Setting s = plugin.Settings[i];

                // add row
                SettingsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

                // create label
                TextBlock tb = new TextBlock()
                {
                    Text = plugin.T(s.ID),
                    Margin = new Thickness(5, 5, 10, 5),
                    VerticalAlignment = VerticalAlignment.Center
                };

                tb.SetBinding(TextBlock.VisibilityProperty, new Binding("IsVisible")
                {
                    Source = s,
                    Mode = BindingMode.OneWay,
                    Converter = new BooleanToVisibilityConverter()
                });

                Grid.SetRow(tb, i);
                Grid.SetColumn(tb, 0);
                SettingsGrid.Children.Add(tb);

                FrameworkElement control = null;

                // create control
                if (s.Type == typeof(Boolean))
                {
                    // checkbox
                    control = new CheckBox() { Height = 15 };
                    control.SetBinding(CheckBox.IsCheckedProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Color))
                {
                    // color selector
                    control = new ColorPicker()
                    {
                        ShowAvailableColors = false,
                        ShowStandardColors = true,
                        Width = 50,
                    };
                    if (s.PossibleValues != null)
                    {
                        ColorConverter converter = new ColorConverter();
                        ((ColorPicker)control).AvailableColors.Clear();
                        foreach (Color c in s.PossibleValues)
                        {
                            System.Windows.Media.Color color = (System.Windows.Media.Color)converter.Convert(c, null, null, null);
                            ((ColorPicker)control).AvailableColors.Add(new ColorItem(color, c.Name));
                        }
                    }
                    control.SetBinding(ColorPicker.SelectedColorProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay,
                        Converter = new ColorConverter()
                    });
                }
                else if (s.PossibleValues != null)
                {
                    // dropdown
                    control = new ComboBox();
                    foreach (Object val in s.PossibleValues)
                    {
                        try
                        {
                            String content = val.ToString();
                            if (s.Type == typeof(String))
                                content = plugin.T(val.ToString());
                            ((ComboBox)control).Items.Add(new ComboBoxItem
                            {
                                Content = content,
                                Name = val.ToString()
                            });
                        }
                        catch (Exception exc)
                        {
                            U.L(LogLevel.Warning, "PLUGIN", "Could not add combobox item in plugin settings: " + exc.Message);
                        }
                    }
                    ((ComboBox)control).SelectedValuePath = "Name";
                    control.SetBinding(ComboBox.SelectedValueProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(String))
                {
                    // text input
                    control = new TextBox()
                    {
                        MaxWidth = 400,
                        MinWidth = 250
                    };
                    control.SetBinding(TextBox.TextProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Int32))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Int32)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                            ((Slider)control).Minimum = (Int32)s.Minimum;
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new IntegerUpDown();
                        control.SetBinding(IntegerUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                }
                else if (s.Type == typeof(Double))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Double)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                            ((Slider)control).Minimum = (Double)s.Minimum;
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new DoubleUpDown();
                        control.SetBinding(DoubleUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                }

                if (control != null)
                {
                    control.Margin = new Thickness(0, 5, 0, 5);
                    control.VerticalAlignment = VerticalAlignment.Center;
                    control.HorizontalAlignment = HorizontalAlignment.Left;

                    control.SetBinding(FrameworkElement.VisibilityProperty, new Binding("IsVisible")
                    {
                        Source = s,
                        Mode = BindingMode.OneWay,
                        Converter = new BooleanToVisibilityConverter()
                    });

                    Grid.SetRow(control, i);
                    Grid.SetColumn(control, 1);
                    SettingsGrid.Children.Add(control);
                }
            }
        }
Beispiel #12
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _dgTrendPens = GetTemplateChild("dgTrendPens") as DataGrid;
            if (_dgTrendPens != null)
            {
                UpdateDgPensColumnsVisibility();
            }

            _gTrendPresenters = (Grid) GetTemplateChild("gTrendPresenters");
            if (_gTrendPresenters != null)
            {
                _gTrendPresenters.MouseLeftButtonDown += GTrendPresentersMouseLeftButtonDown;
                _gTrendPresenters.MouseLeftButtonUp += GTrendPresentersMouseLeftButtonUp;
                _gTrendPresenters.MouseMove += GTrendPresentersMouseMove;
            }

            _gVerticalAxes = (Grid)GetTemplateChild("gVerticalAxes");
            _cVerticalAxes = (Canvas)GetTemplateChild("cVerticalAxes");
            if (_cVerticalAxes != null)
            {
                _cVerticalAxes.SizeChanged += CVerticalAxesSizeChanged;
            }
            _cHorizontalAxes = (Canvas)GetTemplateChild("cHorizontalAxes");
            if (_cHorizontalAxes != null)
            {
                _cHorizontalAxes.SizeChanged += CHorizontalAxesSizeChanged;
            }
            _spHorisontalAxes = (StackPanel)GetTemplateChild("spHorisontalAxes");

            #region Slider

            _slSlider = GetTemplateChild("slSlider") as Slider;
            if (_slSlider != null)
            {
                var sliderBinding = new Binding("CursorPosition") { Source = this, Mode = BindingMode.TwoWay };
                _slSlider.SetBinding(RangeBase.ValueProperty, sliderBinding);
            }

            _cdSliderOffset = (ColumnDefinition)GetTemplateChild("cdSliderOffset");
            _gSlider = (Grid)GetTemplateChild("gSlider");
            if (_gSlider != null)
                _gSlider.SizeChanged += GSliderSizeChanged;
            _cSlider = (Canvas)GetTemplateChild("cSlider");
            if (_cSlider != null)
            {
                var presentersVisibilityBinding = new Binding("ShowCursorPresenters") { Source = this, Converter = new BooleanToVisibilityConverter() };
                _cSlider.SetBinding(VisibilityProperty, presentersVisibilityBinding);
                _cSlider.SizeChanged += CSliderSizeChanged;
            }
            _spSlider = (Panel)GetTemplateChild("spSlider");
            UpdateSliderVisibility();

            #endregion

            #region SetPeriod

            _popupPeriod = GetTemplateChild("popupPeriod") as Popup;
            _tspSetPeriod = GetTemplateChild("tspSetPeriod") as TimeSpanPicker;
            if (_popupPeriod != null && _tspSetPeriod != null)
            {
                _popupPeriod.Opened += PopupPeriodOpened;
                _tspSetPeriod.KeyUp += TspSetPeriodKeyUp;
                var bSetPeriod = GetTemplateChild("bSetPeriod") as Button;
                if (bSetPeriod != null)
                    bSetPeriod.Click += BSetPeriodClick;
            }

            #endregion

            #region SetTime

            _popupTime = GetTemplateChild("popupTime") as Popup;
            _dtpSetTime = GetTemplateChild("dtpSetTime") as DateTimePicker;
            if (_popupTime != null && _dtpSetTime != null)
            {
                _popupTime.Opened += PopupTimeOpened;
                _dtpSetTime.KeyUp += DtpSetTimeKeyUp;
                var bSetTime = GetTemplateChild("bSetTime") as Button;
                if (bSetTime != null)
                {
                    bSetTime.Click += BSetTimeClick;
                }
            }

            #endregion
        }