Пример #1
0
        public SetContextMenuWindow(Visual owner = null, MenuSettingData data = null)
        {
            InitializeComponent();
            try
            {
                this.Owner = CommonUtil.GetTopWindow(owner);
                if (data != null)
                {
                    info = data.DeepClone();
                }

                //共通設定画面用の設定
                Action <StackPanel, StackPanel> CopyStackItem = (src, trg) =>
                {
                    foreach (var item in src.Children.OfType <Control>().Where(i => i is Label != true))
                    {
                        var newItem = (Control)Activator.CreateInstance(item.GetType());
                        newItem.Style = item.Style;
                        if (item is CheckBox)
                        {
                            newItem.Visibility = Visibility.Hidden;
                        }
                        trg.Children.Add(newItem);
                    }
                };
                CopyStackItem(stackPanel_menu, stackPanel_gesture);
                CopyStackItem(stackPanel_menu, stackPanel_gesture2);

                stackItems_menu = stackPanel_menu.Children.OfType <CheckBox>().ToList();
                stackItems_ges1 = stackPanel_gesture.Children.OfType <CheckBox>().ToList();
                stackItems_ges2 = stackPanel_gesture2.Children.OfType <CheckBox>().ToList();

                //個別設定画面用の設定
                var bx = new BoxExchangeEditor(this.listBox_Default, this.listBox_Setting, true, true, true, true);
                bx.AllowDuplication(StringItem.Items(EpgCmdsEx.SeparatorString), StringItem.Cloner, StringItem.Comparator);
                button_reset.Click  += new RoutedEventHandler(bx.button_Reset_Click);
                button_add.Click    += new RoutedEventHandler(bx.button_Add_Click);
                button_ins.Click    += new RoutedEventHandler(bx.button_Insert_Click);
                button_del.Click    += new RoutedEventHandler(bx.button_Delete_Click);
                button_delAll.Click += new RoutedEventHandler(bx.button_DeleteAll_Click);
                button_top.Click    += new RoutedEventHandler(bx.button_Top_Click);
                button_up.Click     += new RoutedEventHandler(bx.button_Up_Click);
                button_down.Click   += new RoutedEventHandler(bx.button_Down_Click);
                button_bottom.Click += new RoutedEventHandler(bx.button_Bottom_Click);

                //その他画面用の設定
                foreach (var item in MenuCodeToTitle.Where(i => i.Key != CtxmCode.EditChgMenu))
                {
                    var chkbox = new CheckBox();
                    chkbox.Tag        = item.Key;
                    chkbox.Content    = item.Value;
                    chkbox.Checked   += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked);
                    chkbox.Unchecked += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked);
                    wrapPanel_IsManualMenu.Children.Add(chkbox);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
Пример #2
0
        public SetContextMenuWindow(Visual owner = null, MenuSettingData data = null)
        {
            InitializeComponent();
            try
            {
                this.Owner = CommonUtil.GetTopWindow(owner);
                if (data != null)
                {
                    info = data.DeepClone();
                }

                //共通設定画面用の設定
                Action <StackPanel, StackPanel> CopyStackItem = (src, trg) =>
                {
                    foreach (var item in src.Children.OfType <Control>().Where(i => i is Label != true))
                    {
                        var newItem = (Control)Activator.CreateInstance(item.GetType());
                        newItem.Style = item.Style;
                        if (item is CheckBox)
                        {
                            newItem.Visibility = Visibility.Hidden;
                        }
                        trg.Children.Add(newItem);
                    }
                };
                CopyStackItem(stackPanel_menu, stackPanel_gesture);
                CopyStackItem(stackPanel_menu, stackPanel_gesture2);

                stackItems_menu = stackPanel_menu.Children.OfType <CheckBox>().ToList();
                stackItems_ges1 = stackPanel_gesture.Children.OfType <CheckBox>().ToList();
                stackItems_ges2 = stackPanel_gesture2.Children.OfType <CheckBox>().ToList();

                //個別設定画面用の設定
                this.comboBoxViewSelect.DisplayMemberPath = CommonUtil.NameOf(() => new ComboItem().Value);
                this.comboBoxViewSelect.SelectedValuePath = CommonUtil.NameOf(() => new ComboItem().Key);
                var bx = new BoxExchangeEditor(this.listBox_Default, this.listBox_Setting, true, true, true, true);
                bx.AllowDuplication(StringItem.Items(EpgCmdsEx.SeparatorString), StringItem.Cloner, StringItem.Comparator);
                button_reset.Click  += new RoutedEventHandler(bx.button_Reset_Click);
                button_add.Click    += new RoutedEventHandler(bx.button_Add_Click);
                button_ins.Click    += new RoutedEventHandler(bx.button_Insert_Click);
                button_del.Click    += new RoutedEventHandler(bx.button_Delete_Click);
                button_delAll.Click += new RoutedEventHandler(bx.button_DeleteAll_Click);
                button_top.Click    += new RoutedEventHandler(bx.button_Top_Click);
                button_up.Click     += new RoutedEventHandler(bx.button_Up_Click);
                button_down.Click   += new RoutedEventHandler(bx.button_Down_Click);
                button_bottom.Click += new RoutedEventHandler(bx.button_Bottom_Click);

                //その他画面用の設定
                foreach (var item in MenuCodeToTitle.Where(i => i.Key != CtxmCode.EditChgMenu))
                {
                    var chkbox = new CheckBox();
                    chkbox.Tag        = item.Key;
                    chkbox.Content    = item.Value;
                    chkbox.Checked   += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked);
                    chkbox.Unchecked += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked);
                    wrapPanel_IsManualMenu.Children.Add(chkbox);
                }

                //細かいオプションの設定
                checkBox_NoMessageKeyGesture.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageKeyGesture));
                checkBox_NoMessageDeleteAll.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageDeleteAll));
                checkBox_NoMessageDelete2.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageDelete2));
                checkBox_NoMessageAdjustRes.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageAdjustRes));
                checkBox_SetJunreToAutoAdd.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SetJunreToAutoAdd));
                checkBox_SetJunreContentToAutoAdd.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SetJunreContentToAutoAdd));
                checkBox_CancelAutoAddOff.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CancelAutoAddOff));
                checkBox_AutoAddFazySearch.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddFazySearch));
                checkBox_AutoAddSearchToolTip.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddSearchToolTip));
                checkBox_AutoAddSearchSkipSubMenu.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddSearchSkipSubMenu));
                checkBox_ReserveSearchToolTip.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.ReserveSearchToolTip));
                checkBox_EpgKeyword_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.Keyword_Trim));
                checkBox_CopyTitle_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CopyTitle_Trim));
                checkBox_CopyContentBasic.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CopyContentBasic));
                checkBox_InfoSearchTtile_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.InfoSearchTitle_Trim));
                checkBox_SearchTtile_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SearchTitle_Trim));
                textBox_SearchURI.SetBinding(TextBox.TextProperty, CommonUtil.NameOf(() => info.SearchURI));
                checkBox_NoMessageNotKEY.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageNotKEY));
                checkBox_OpenParentFolder.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.OpenParentFolder));
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }