private void SetData() { try { ManualMenuCheckboxWorking = true; foreach (var chkbox in IsManualChkBox) { chkbox.IsChecked = info.IsManualAssign.Contains((CtxmCode)chkbox.Tag); } ManualMenuCheckboxWorking = false; checkBox_IsManualMenuCode_Checked(null, null); checkBox_NoMessageKeyGesture.IsChecked = info.NoMessageKeyGesture; checkBox_NoMessageDeleteAll.IsChecked = info.NoMessageDeleteAll; checkBox_NoMessageDelete2.IsChecked = info.NoMessageDelete2; checkBox_NoMessageAdjustRes.IsChecked = info.NoMessageAdjustRes; checkBox_CancelAutoAddOff.IsChecked = info.CancelAutoAddOff; checkBox_AutoAddFazySerach.IsChecked = info.AutoAddFazySerach; checkBox_AutoAddSerachToolTip.IsChecked = info.AutoAddSerachToolTip; checkBox_EpgKeyword_Trim.IsChecked = info.Keyword_Trim; checkBox_CopyTitle_Trim.IsChecked = info.CopyTitle_Trim; checkBox_CopyContentBasic.IsChecked = info.CopyContentBasic; checkBox_SearchTtile_Trim.IsChecked = info.SearchTitle_Trim; textBox_SearchURI.Text = info.SearchURI; checkBox_NoMessageNotKEY.IsChecked = info.NoMessageNotKEY; checkBox_OpenParentFolder.IsChecked = info.OpenParentFolder; defaultMenu = mm.GetDefaultCtxmSettingForEditor(); editMenu = info.ManualMenuItems.Clone(); for (int i = 0; i < SettingTable.Count; i++) { if (SettingTable[i].Count == 0) { continue; } MenuSettingData.CmdSaveData src = info.EasyMenuItems.Find(item => item.GetCommand() == SettingTable[i][0]); stackItems_menu[i].IsChecked = src.IsMenuEnabled; stackItems_ges1[i].IsChecked = src.IsGestureEnabled; stackItems_ges2[i].IsChecked = !src.IsGesNeedMenu; stackItems_ges1[i].Content = MenuBinds.GetInputGestureText(src.GetGestuers()) ?? ""; stackItems_ges2[i].Content = "使用する"; stackItems_ges1[i].Visibility = string.IsNullOrEmpty(stackItems_ges1[i].Content as string) ? Visibility.Hidden : Visibility.Visible; stackItems_ges2[i].Visibility = stackItems_ges1[i].Visibility; } this.listBox_Default.ItemsSource = null; this.listBox_Setting.ItemsSource = null; //初期化ボタンでSetData()使うとき用のリセット。 this.comboBoxViewSelect.ItemsSource = MenuCodeToTitle; this.comboBoxViewSelect.SelectedIndex = -1; //初期化ボタンでSetData()使うとき用のリセット。 this.comboBoxViewSelect.SelectedIndex = 7; //これでSelectionChanged発生する } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void SetData(Control ow, ListBox listbox, LVDMHelper helper, MenuBinds mbinds = null) { try { Owner = ow; listBox = listbox; hlp = helper; MenuBinds mBinds = mbinds ?? new MenuBinds(); //マウスイベント関係 this.listBox.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(listBox_PreviewMouseLeftButtonUp); this.listBox.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(listBox_PreviewMouseLeftButtonDown); ViewUtil.ResetItemContainerStyle(listbox); listbox.ItemContainerStyle.Setters.Add(new EventSetter(Mouse.MouseEnterEvent, new MouseEventHandler(listBoxItem_MouseEnter))); //移動などのアクションはBoxExchangeEditorのものをそのまま使用する。 bx = new BoxExchangeEditor { TargetBox = listBox }; this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.TopItem, (sender, e) => ItemsAction(() => bx.button_Top_Click(null, null)))); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.UpItem, (sender, e) => ItemsAction(() => bx.button_Up_Click(null, null)))); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.DownItem, (sender, e) => ItemsAction(() => bx.button_Down_Click(null, null)))); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.BottomItem, (sender, e) => ItemsAction(() => bx.button_Bottom_Click(null, null)))); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.SaveOrder, SaveOrder_handler, (sender, e) => e.CanExecute = NotSaved == true)); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.RestoreOrder, (sender, e) => hlp.RestoreOrder(), (sender, e) => e.CanExecute = NotSaved == true)); this.Owner.CommandBindings.Add(new CommandBinding(EpgCmds.DragCancel, (sender, e) => DragRelease())); mBinds.SetCommandToButton(button_top, EpgCmds.TopItem); mBinds.SetCommandToButton(button_up, EpgCmds.UpItem); mBinds.SetCommandToButton(button_down, EpgCmds.DownItem); mBinds.SetCommandToButton(button_bottom, EpgCmds.BottomItem); mBinds.SetCommandToButton(button_saveItemOrder, EpgCmds.SaveOrder); mBinds.SetCommandToButton(button_reloadItem, EpgCmds.RestoreOrder); mBinds.AddInputCommand(EpgCmds.DragCancel);//アイテムのドラッグキャンセル if (mbinds == null) { mBinds.ResetInputBindings(this.Owner, this.listBox); } //コマンドだと、DragCancelしない場合に、CanExecuteを割り当てても、Handled=falseにしても、 //Keygestureが先へ伝搬してくれないので、対処療法的だけど先に処理してしまうことにする。コマンドの意味無い‥。 listBox.PreviewKeyDown += new KeyEventHandler((sender, e) => { if (e.Handled == false && e.Key == Key.Escape && e.IsRepeat == false && _onDrag == true) { EpgCmds.DragCancel.Execute(null, this); //this.listBox.Items.Refresh();//壊したバインディングを修復する。モタツキ感があるので放置する。 e.Handled = true; } }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public AddReserveEpgWindow() { InitializeComponent(); //コマンドの登録 this.CommandBindings.Add(new CommandBinding(EpgCmds.Cancel, (sender, e) => DialogResult = false)); this.CommandBindings.Add(new CommandBinding(EpgCmds.AddInDialog, button_add_reserve_Click)); //ボタンの設定 var mBinds = new MenuBinds(); mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel); mBinds.SetCommandToButton(button_add_reserve, EpgCmds.AddInDialog); //ショートカットの登録 mBinds.ResetInputBindings(this); }
private void CtxmConvertToMenuItems(List <CtxmItemData> src, ItemCollection dest, CtxmCode code, bool shortcutTextforListType) { dest.Clear(); src.ForEach(data => { Control item; if (data.Command == EpgCmdsEx.Separator) { item = new Separator(); } else { var menu = new MenuItem(); menu.Header = data.Header; menu.Command = (EpgCmdsEx.IsDummyCmd(data.Command) ? null : data.Command); if (menu.Command != null) { if ((shortcutTextforListType == true || (MC.WorkCmdOptions[data.Command].GesTrg & MenuCmds.GestureTrg.ToView) == MenuCmds.GestureTrg.ToView) && (MC.WorkCmdOptions.ContainsKey(data.Command) == false || MC.WorkCmdOptions[data.Command].IsGestureEnabled == true) && data.ID == 0) { menu.InputGestureText = MenuBinds.GetInputGestureText(data.Command); } } menu.CommandParameter = new EpgCmdParam(typeof(MenuItem), code, data.ID); if (data.Items.Count != 0) { CtxmConvertToMenuItems(data.Items, menu.Items, code, shortcutTextforListType); } item = menu; } item.Tag = data.Command; item.ToolTip = GetCtxmTooltip(data.Command); ToolTipService.SetShowOnDisabled(item, true); dest.Add(item); }); }