Inheritance: System.Windows.Controls.Control
示例#1
0
        private static void OnSelectedColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ColorComboBox box = d as ColorComboBox;

            if (!box.m_withinChange)
            {
                box.m_withinChange = true;
                if (box.m_colorPicker != null)
                {
                    box.m_colorPicker.SelectedColor = box.SelectedColor;
                }
                box.m_withinChange = false;
            }
        }
示例#2
0
        private static void OnColorPickerSelectedColorChanged(object sender, RoutedPropertyChangedEventArgs <Color> e)
        {
            ColorComboBox box = sender as ColorComboBox;

            if (!box.m_withinChange)
            {
                box.m_withinChange = true;
                if (box.m_colorPicker != null)
                {
                    box.SelectedColor = box.m_colorPicker.SelectedColor;
                }
                box.m_withinChange = false;
            }
        }
示例#3
0
        private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Action        method        = null;
            ColorComboBox colorComboBox = d as ColorComboBox;
            bool          newValue      = (bool)e.NewValue;

            if (colorComboBox.m_toggleButton != null)
            {
                if (method == null)
                {
                    method = () => colorComboBox.m_toggleButton.IsHitTestVisible = !newValue;
                }
                colorComboBox.Dispatcher.BeginInvoke(DispatcherPriority.Normal, method);
            }
        }
示例#4
0
        private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ColorComboBox colorComboBox = d as ColorComboBox;
            bool          newValue      = (bool)e.NewValue;

            // Mask HistTest visibility of toggle button otherwise when pressing it
            // and popup is open the popup is closed (since StaysOpen is false)
            // and reopens immediately
            if (colorComboBox.m_toggleButton != null)
            {
                UIHelper.RunOnUI(
                    new Action(
                        delegate()
                {
                    colorComboBox.m_toggleButton.IsHitTestVisible = !newValue;
                }
                        ));
            }
            //Console.WriteLine("OnIsDropDownOpenChanged - Popup Focused {0} {1}",
            //    colorComboBox.m_popup.IsFocused, colorComboBox.m_popup.IsKeyboardFocused);
        }
示例#5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.tabControl_1 = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.check_aero = ((TiefSee.W.U_switch)(target));
                return;

            case 3:
                this.colorBox_標題列顏色 = ((ColorPicker.ColorComboBox)(target));
                return;

            case 4:
                this.colorBox_背景顏色 = ((ColorPicker.ColorComboBox)(target));
                return;

            case 5:
                this.but_複製顏色 = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.colorBox_外框顏色 = ((ColorPicker.ColorComboBox)(target));
                return;

            case 7:
                this.check_工具列_換頁按鈕 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 8:
                this.check_工具列_換資料夾 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 9:
                this.check_工具列_排序 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 10:
                this.check_工具列_外部程式開啟 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 11:
                this.check_工具列_複製 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 12:
                this.check_工具列_快速拖曳 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 13:
                this.check_工具列_刪除圖片 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 14:
                this.check_工具列_搜圖 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 15:
                this.check_工具列_大量瀏覽模式 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 16:
                this.check_工具列_旋轉 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 17:
                this.check_工具列_放大縮小 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 18:
                this.check_工具列_縮放至視窗大小 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 19:
                this.check_工具列_檢視縮放比例 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 20:
                this.img_大換頁按鈕_不啟用 = ((System.Windows.Controls.Image)(target));
                return;

            case 21:
                this.img_大換頁按鈕_下方2 = ((System.Windows.Controls.Image)(target));
                return;

            case 22:
                this.img_大換頁按鈕_兩側 = ((System.Windows.Controls.Image)(target));
                return;

            case 23:
                this.check_換頁按鈕_下 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 24:
                this.img_大換頁按鈕_下方 = ((System.Windows.Controls.Image)(target));
                return;

            case 25:
                this.but_設定附檔名關聯 = ((System.Windows.Controls.Button)(target));
                return;

            case 26:
                this.but_開啟系統設定 = ((System.Windows.Controls.Button)(target));
                return;

            case 27:
                this.switch_快速啟動 = ((TiefSee.W.U_switch)(target));
                return;

            case 28:
                this.st_快速啟動子選項 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 29:
                this.switch_開機自動啟動 = ((TiefSee.W.U_switch)(target));
                return;

            case 30:
                this.but_開啟_啟動資料夾 = ((System.Windows.Controls.Button)(target));
                return;

            case 31:
                this.switch_快速預覽_空白鍵 = ((TiefSee.W.U_switch)(target));
                return;

            case 32:
                this.switch_快速預覽_滑鼠滾輪 = ((TiefSee.W.U_switch)(target));
                return;

            case 33:
                this.radio_滾輪_縮放圖片 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 34:
                this.radio_滾輪_切換圖片 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 35:
                this.radio_滾輪_上下移動圖片 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 36:
                this.radio_GIF_wpf1_Copy1 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 37:
                this.radio_GIF_wpf1_Copy2 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 38:
                this.radio_GIF_wpf1_Copy3 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 39:
                this.radio_GIF_DGI = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 40:
                this.radio_GIF_wpf = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 41:
                this.radio_高品質成像_1 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 42:
                this.radio_高品質成像_2 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 43:
                this.radio_高品質成像_3 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 44:
                this.radio_高品質成像_4 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 45:
                this.but_清除cookies = ((System.Windows.Controls.Button)(target));
                return;

            case 46:
                this.but_進階設定 = ((System.Windows.Controls.Button)(target));
                return;

            case 47:
                this.text_作者資訊 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 48:
                this.but_檢查更新 = ((System.Windows.Controls.Button)(target));
                return;

            case 49:
                this.but_討論區 = ((System.Windows.Controls.Button)(target));
                return;

            case 50:
                this.but_官網 = ((System.Windows.Controls.Button)(target));
                return;

            case 51:
                this.but_作者小屋 = ((System.Windows.Controls.Button)(target));
                return;

            case 52:
                this.but_下載Pixiv動圖 = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#6
0
 private void AddItem(string name, object value, string bindingName)
 {
     Func<ComboBoxItem, bool> predicate = null;
     Type type = value.GetType();
     Grid element = new Grid {
         Margin = new Thickness(0.0, 0.0, 0.0, 10.0)
     };
     ColumnDefinition definition4 = new ColumnDefinition {
         Width = new GridLength(126.0)
     };
     element.ColumnDefinitions.Add(definition4);
     ColumnDefinition definition5 = new ColumnDefinition {
         Width = new GridLength(1.0, GridUnitType.Star)
     };
     element.ColumnDefinitions.Add(definition5);
     TextBlock block = new TextBlock {
         Text = name,
         Foreground = System.Windows.Media.Brushes.White
     };
     element.Children.Add(block);
     if (((type == typeof(double)) || (type == typeof(int))) || ((type == typeof(float)) || (type == typeof(Thickness))))
     {
         Binding binding = new Binding(bindingName) {
             Mode = BindingMode.TwoWay
         };
         TextBox textBox = new TextBox();
         textBox.TextChanged += delegate (object o, TextChangedEventArgs e) {
             foreach (char ch in textBox.Text)
             {
                 switch (ch)
                 {
                     case ',':
                     case '.':
                         return;
                 }
             }
             textBox.Text = new string((from c in textBox.Text
                 where char.IsDigit(c)
                 select c).ToArray<char>());
             textBox.SelectionStart = textBox.Text.Length;
         };
         textBox.Text = value.ToString();
         Grid.SetColumn(textBox, 1);
         textBox.SetBinding(TextBox.TextProperty, binding);
         element.Children.Add(textBox);
     }
     else if (type == typeof(SolidColorBrush))
     {
         Binding binding2 = new Binding(bindingName) {
             Mode = BindingMode.TwoWay,
             Converter = base.Resources["brushToColorConverter"] as BrushToColorConverter
         };
         ColorComboBox box = new ColorComboBox {
             Margin = new Thickness(0.0, -4.0, 0.0, 4.0)
         };
         Grid.SetColumn(box, 1);
         box.SetBinding(ColorComboBox.SelectedColorProperty, binding2);
         element.Children.Add(box);
     }
     else
     {
         if (type == typeof(string))
         {
             Grid grid2 = new Grid {
                 Margin = new Thickness(0.0, 0.0, 0.0, 10.0)
             };
             ColumnDefinition definition = new ColumnDefinition {
                 Width = new GridLength(0.3, GridUnitType.Star)
             };
             grid2.ColumnDefinitions.Add(definition);
             ColumnDefinition definition2 = new ColumnDefinition {
                 Width = new GridLength(1.0, GridUnitType.Auto)
             };
             grid2.ColumnDefinitions.Add(definition2);
             ColumnDefinition definition3 = new ColumnDefinition {
                 Width = new GridLength(0.3, GridUnitType.Star)
             };
             grid2.ColumnDefinitions.Add(definition3);
             Grid grid3 = new Grid {
                 Height = 1.0,
                 Background = System.Windows.Media.Brushes.White
             };
             Grid.SetColumn(grid3, 0);
             Grid grid4 = new Grid {
                 Height = 1.0,
                 Background = System.Windows.Media.Brushes.White
             };
             Grid.SetColumn(grid4, 2);
             TextBlock block2 = new TextBlock {
                 Text = value.ToString(),
                 Foreground = System.Windows.Media.Brushes.White,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 Margin = new Thickness(5.0, 0.0, 5.0, 0.0)
             };
             Grid.SetColumn(block2, 1);
             grid2.Children.Add(grid3);
             grid2.Children.Add(grid4);
             grid2.Children.Add(block2);
             this.spEditor.Children.Add(grid2);
             return;
         }
         if (type == typeof(System.Windows.Media.FontFamily))
         {
             Binding binding3 = new Binding(bindingName) {
                 Mode = BindingMode.TwoWay
             };
             List<ComboBoxItem> list = (from f in new InstalledFontCollection().Families select new ComboBoxItem { Content = f.Name, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, FontFamily = new System.Windows.Media.FontFamily(f.Name) }).ToList<ComboBoxItem>();
             ComboBox combo = new ComboBox {
                 ItemsSource = list
             };
             combo.SetBinding(Control.FontFamilyProperty, binding3);
             combo.SelectionChanged += delegate (object o, SelectionChangedEventArgs e) {
                 if (combo.SelectedItem != null)
                 {
                     ComboBoxItem selectedItem = (ComboBoxItem) combo.SelectedItem;
                     combo.FontFamily = selectedItem.FontFamily;
                 }
             };
             if (predicate == null)
             {
                 predicate = c => c.FontFamily.ToString() == value.ToString();
             }
             combo.SelectedItem = combo.Items.Cast<ComboBoxItem>().FirstOrDefault<ComboBoxItem>(predicate);
             Grid.SetColumn(combo, 1);
             element.Children.Add(combo);
         }
         else if (type == typeof(FontWeight))
         {
             Binding binding4 = new Binding(bindingName) {
                 Mode = BindingMode.TwoWay
             };
             ComboBox combo = new ComboBox {
                 ItemsSource = base.Resources["fontWeights"] as FontWeight[]
             };
             combo.SetBinding(Control.FontWeightProperty, binding4);
             combo.SelectionChanged += delegate (object o, SelectionChangedEventArgs e) {
                 if (combo.SelectedItem != null)
                 {
                     combo.FontWeight = (FontWeight) combo.SelectedItem;
                 }
             };
             combo.SelectedItem = (FontWeight) value;
             Grid.SetColumn(combo, 1);
             element.Children.Add(combo);
         }
     }
     this.spEditor.Children.Add(element);
 }