public override void Run() { DockPanel mainWindowDockPanel = WorkbenchSingleton.MainWindow.FindName("dockPanel") as DockPanel; // Find the insertion index - under the toolbar int insertionIndex = 1; for (int i = 0; i < mainWindowDockPanel.Children.Count; i++) { if (mainWindowDockPanel.Children[i] is System.Windows.Controls.ToolBar) { insertionIndex = i + 1; break; } } _toolbar = new ToolBar(); DockPanel.SetDock(_toolbar, Dock.Top); mainWindowDockPanel.Children.Insert(insertionIndex, _toolbar); CustomDialog dialog = new HP.Utt.UttDialog.CustomDialog("UserDefinedToolbarAddin.SelectorDialog"); List <string> usedCommands = dialog.PersistenceData.GetValue <List <string> >("", ShowSelectorDialogCommand.UsedCommandsListKey, new List <string>()); List <SearchItem> items = SearchItemBuilder.BuildSearchItems(); CommandsSelectorViewModel viewModel = new CommandsSelectorViewModel(items, usedCommands); UpdateToolbar(viewModel.GetUsedSearchItems()); dialog.Close(); }
public override void Run() { CustomDialog dialog = new HP.Utt.UttDialog.CustomDialog("UserDefinedToolbarAddin.SelectorDialog"); dialog.Content = new CommandsSelector(); List<string> usedCommands = dialog.PersistenceData.GetValue<List<string>>("", UsedCommandsListKey, new List<string>()); List<SearchItem> items = SearchItemBuilder.BuildSearchItems(); CommandsSelectorViewModel viewModel = new CommandsSelectorViewModel(items, usedCommands); dialog.DataContext = viewModel; dialog.MinWidth = dialog.MaxWidth = 800; dialog.MinHeight = dialog.MaxHeight = 400; dialog.ResizeMode = System.Windows.ResizeMode.NoResize; dialog.AddOkCancelButtons(new Action<CustomDialog>(OnOkPressed)); dialog.AddButton("Clear", OnClearPressed); if (dialog.ShowDialog() == CustomDialogResult.Ok) { AutostartCommand.UpdateToolbar(viewModel.GetUsedSearchItems()); } }
public override void Run() { CustomDialog dialog = new HP.Utt.UttDialog.CustomDialog("UserDefinedToolbarAddin.SelectorDialog"); dialog.Content = new CommandsSelector(); List <string> usedCommands = dialog.PersistenceData.GetValue <List <string> >("", UsedCommandsListKey, new List <string>()); List <SearchItem> items = SearchItemBuilder.BuildSearchItems(); CommandsSelectorViewModel viewModel = new CommandsSelectorViewModel(items, usedCommands); dialog.DataContext = viewModel; dialog.MinWidth = dialog.MaxWidth = 800; dialog.MinHeight = dialog.MaxHeight = 400; dialog.ResizeMode = System.Windows.ResizeMode.NoResize; dialog.AddOkCancelButtons(new Action <CustomDialog>(OnOkPressed)); dialog.AddButton("Clear", OnClearPressed); if (dialog.ShowDialog() == CustomDialogResult.Ok) { AutostartCommand.UpdateToolbar(viewModel.GetUsedSearchItems()); } }
public override void Run() { DockPanel mainWindowDockPanel = WorkbenchSingleton.MainWindow.FindName("dockPanel") as DockPanel; // Find the insertion index - under the toolbar int insertionIndex = 1; for (int i = 0; i < mainWindowDockPanel.Children.Count; i++) { if (mainWindowDockPanel.Children[i] is System.Windows.Controls.ToolBar) { insertionIndex = i + 1; break; } } _toolbar = new ToolBar(); DockPanel.SetDock(_toolbar, Dock.Top); mainWindowDockPanel.Children.Insert(insertionIndex, _toolbar); CustomDialog dialog = new HP.Utt.UttDialog.CustomDialog("UserDefinedToolbarAddin.SelectorDialog"); List<string> usedCommands = dialog.PersistenceData.GetValue<List<string>>("", ShowSelectorDialogCommand.UsedCommandsListKey, new List<string>()); List<SearchItem> items = SearchItemBuilder.BuildSearchItems(); CommandsSelectorViewModel viewModel = new CommandsSelectorViewModel(items, usedCommands); UpdateToolbar(viewModel.GetUsedSearchItems()); dialog.Close(); }