Ejemplo n.º 1
0
        public void Attach(TextArea textArea, TextEditor editor)
        {
            if (textArea == null)
            {
                throw new ArgumentNullException("textArea");
            }

            _editor          = editor;
            _textArea        = textArea;
            _currentDocument = textArea.Document;
            _renderer        = new SearchResultBackgroundRenderer {
                MarkerBrush = new SolidColorBrush(Colors.Yellow)
            };
            _searchTextBox.TextChanged += new TextChangedEventHandler(_searchTextBox_TextChanged);

            _adorner = new SearchPanelAdorner(textArea, this);

            if (_currentDocument != null)
            {
                _currentDocument.TextChanged += new EventHandler(_currentDocument_TextChanged);
            }

            _textArea.DocumentChanged += new EventHandler(_textArea_DocumentChanged);
            _textArea.PreviewKeyDown  += new KeyEventHandler(_textArea_PreviewKeyDown);
            _searchTextBox.LostFocus  += new RoutedEventHandler(_searchTextBox_LostFocus);
            _replaceTextBox.LostFocus += new RoutedEventHandler(_replaceTextBox_LostFocus);
            _searchTextBox.GotFocus   += new RoutedEventHandler(_searchTextBox_GotFocus);
            _replaceTextBox.GotFocus  += new RoutedEventHandler(_replaceTextBox_GotFocus);
            KeyDown += new KeyEventHandler(_searchPanel_KeyDown);

            CommandBindings.Add(new CommandBinding(Find, (sender, e) => Open()));
            CommandBindings.Add(new CommandBinding(SearchCommands.FindNext, (sender, e) => FindNext()));
            CommandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, (sender, e) => FindPrevious()));
            CommandBindings.Add(new CommandBinding(SearchCommands.CloseSearchPanel, (sender, e) => Close()));

            textArea.CommandBindings.Add(new CommandBinding(SearchCommands.FindNext, (sender, e) => FindNext()));
            textArea.CommandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, (sender, e) => FindPrevious()));
            textArea.CommandBindings.Add(new CommandBinding(SearchCommands.CloseSearchPanel, (sender, e) => Close()));
            IsClosed = true;
        }
Ejemplo n.º 2
0
        private void Init()
        {
            try
            {
                ListBoxVoiceServers.ItemsSource = mListVoiceItems;
                ListBoxChannels.ItemsSource     = mListChannelItems;

                CommandBindings.Add(new CommandBinding(ItemClickCommand, ItemClickCommand_Executed,
                                                       (s, e) => e.CanExecute = true));

                if (PageParent != null)
                {
                    PageParent.SetBusy(true, string.Empty);
                }
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    LoadVoiceObjects();
                    LoadChannelObjects();
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();
                    if (PageParent != null)
                    {
                        PageParent.SetBusy(false, string.Empty);
                    }

                    InitVoiceItems();
                    InitVoiceItemState();

                    ChangeLanguage();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 3
0
        protected override void Init()
        {
            try
            {
                PageName  = "DashboardMainView";
                StylePath = "UMPS1206/DashboardMainView.xaml";

                ListBoxLeftWidgets.ItemsSource   = mListLeftWidgetItems;
                ListBoxCenterWidgets.ItemsSource = mListCenterWidgetItems;

                CommandBindings.Add(new CommandBinding(UCWidgetView.ToolBtnCommand, ToolBtnCommand_Executed,
                                                       (s, ce) => ce.CanExecute = true));

                base.Init();

                SetBusy(true, string.Format("Loading basic informations..."));
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    InitToolButtonItems();
                    LoadBasicDataInfos();
                    LoadWidgetInfos();
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();
                    SetBusy(false, string.Empty);

                    CurrentApp.SendLoadedMessage();

                    CreateToolBtnItems();
                    CreateWidgetItems();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        public ConnectionStringBuilder()
        {
            _typeFactory = this.GetTypeFactory();
#pragma warning disable IDISP001 // Dispose created.
            var serviceLocator = this.GetServiceLocator();
#pragma warning restore IDISP001 // Dispose created.

            _uiVisualizerService = serviceLocator.ResolveType <IUIVisualizerService>();

            var editCommandBinding = new CommandBinding {
                Command = EditCommand
            };
            editCommandBinding.Executed += OnEditCommandExecuted;
            CommandBindings.Add(editCommandBinding);

            var clearCommandBinding = new CommandBinding {
                Command = ClearCommand
            };
            clearCommandBinding.Executed   += OnClearCommandExecuted;
            clearCommandBinding.CanExecute += CanClearCommandExecute;
            CommandBindings.Add(clearCommandBinding);
        }
        public MainWindow()
        {
#if DEBUG
            this.InputBindings.Add(new KeyBinding(DebugCommands.GarbageCollectCommand, new KeyGesture(Key.G, ModifierKeys.Control)));
#endif
            InitializeComponent();
            CommandBindings.Add(new CommandBinding(System.Windows.Input.NavigationCommands.BrowseBack, new ExecutedRoutedEventHandler(OnNavigationCommandExecuted), new CanExecuteRoutedEventHandler(OnNavigationCommandCanExecute)));
            CommandBindings.Add(new CommandBinding(System.Windows.Input.NavigationCommands.BrowseForward, new ExecutedRoutedEventHandler(OnNavigationCommandExecuted), new CanExecuteRoutedEventHandler(OnNavigationCommandCanExecute)));
            CommandBindings.Add(new CommandBinding(System.Windows.Input.ComponentCommands.ScrollPageUp, new ExecutedRoutedEventHandler(OnNavigationCommandExecuted), new CanExecuteRoutedEventHandler(OnNavigationCommandCanExecute)));
            CommandBindings.Add(new CommandBinding(System.Windows.Input.ComponentCommands.ScrollPageDown, new ExecutedRoutedEventHandler(OnNavigationCommandExecuted), new CanExecuteRoutedEventHandler(OnNavigationCommandCanExecute)));

            // If journal navigation on input is disabled, all navigation keys, such as Backspace, etc. will be consumed as next/previous navigation.
            // Application authors may want to preserve some keys for journal navigation even though by and large input gestures are disabled for
            // this feature. In the handler for BrowseBack/Forward commands it is not possible to tell whether the command came from a
            // key gesture or not, or which key caused it. To override specific keys, MainWindow exposes a navigationKeyOverrideCommand member,
            // and binds certain keys to it. Presently this is done for the Backspace key
            if (!MsdnReaderSettings.EnableJournalNavigationOnInput)
            {
                CommandBindings.Add(new CommandBinding(this.backNavigationKeyOverrideCommand, new ExecutedRoutedEventHandler(OnJournalBackNavigationKeyOverride)));
                InputBindings.Add(new InputBinding(this.backNavigationKeyOverrideCommand, new KeyGesture(Key.Back)));
            }
        }
Ejemplo n.º 6
0
        public SkinWindow()
        {
            var chrome = new WindowChrome
            {
                GlassFrameThickness   = new Thickness(1),
                ResizeBorderThickness = new Thickness(4)
            };

            WindowChrome.SetWindowChrome(this, chrome);

            //将标题栏高度绑定给Chrome
            BindingOperations.SetBinding(chrome, WindowChrome.CaptionHeightProperty,
                                         new Binding(CaptionHeightProperty.Name)
            {
                Source = this
            });

            #region 绑定系统Command
            CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (sender, e) =>
            {
                WindowState = WindowState.Minimized;
            }));

            CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (sender, e) =>
            {
                WindowState = WindowState.Maximized;
            }));

            CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (sender, e) =>
            {
                WindowState = WindowState.Normal;
            }));

            CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (sender, e) =>
            {
                Close();
            }));
            #endregion
        }
Ejemplo n.º 7
0
        //private Point mousePoint = new Point();
        //private readonly int cornerWidth = 1;
        //private readonly int customBorderThickness = 1;
        public MainWindow()
        {
            InitializeComponent();
            //SourceInitialized += MainWindow_SourceInitialized;
            //StateChanged += MainWindow_StateChanged;
            //titleGrid.MouseDown += titleGrid_MouseDown;
            //TV.SelectedItemChanged += TV_SelectedItemChanged;
            //TV.MouseUp += TV_Selected_1;
            var binding = new CommandBinding(NavigationCommands.Refresh, ExecutedRefresh);

            CommandBindings.Add(binding);
            var binding1 = new CommandBinding(NavigationCommands.Zoom, ExecuteFullScreenCommand);

            CommandBindings.Add(binding1);
            MessageObserver.CreateInstance.DoAction += CreateInstance_DoAction;
            Loaded += MainWindow_Loaded;
            //默认启动项
            //PluginService.Run("1", "10011");
            this.KeyDown             += MainWindow_KeyDown;
            this.RightImg.MouseEnter += Overlay_MouseEnter;
            this.RightImg.MouseLeave += Overlay_MouseLeave;
        }
Ejemplo n.º 8
0
        public NumericUpDown()
        {
            CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) =>
            {
                Value        += Increment;
                _textBox.Text = CurrentText;
                _textBox.Select(_textBox.Text.Length, 0);
            }));
            CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) =>
            {
                Value        -= Increment;
                _textBox.Text = CurrentText;
                _textBox.Select(_textBox.Text.Length, 0);
            }));
            CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) =>
            {
                SetCurrentValue(ValueProperty, 0d);
                _textBox.Text = string.Empty;
            }));

            Loaded += (s, e) => OnApplyTemplate();
        }
Ejemplo n.º 9
0
        void AddPrintMenuItems(MenuItem itemFile)
        {
            // Page Setup command
            MenuItem itemSetup = new MenuItem()
            {
                Header = "Page Set_up..."
            };

            itemSetup.Click += PageSetupOnClick;
            itemFile.Items.Add(itemSetup);

            // Print command
            MenuItem itemPrint = new MenuItem()
            {
                Header  = "_Print...",
                Command = ApplicationCommands.Print
            };

            itemFile.Items.Add(itemPrint);
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Print, PrintOnExecuted));
        }
        public QueryTool(User user, ToolsPlugin owner)
        {
            CommandBindings.Add(new CommandBinding(AddCriteria, ExecutedAddCriteria, CanExecuteAddCriteria));
            CommandBindings.Add(new CommandBinding(RemoveCriteria, ExecutedRemoveCriteria, CanExecuteRemoveCriteria));
            CommandBindings.Add(new CommandBinding(RemoveAllCriteria, ExecutedRemoveAllCriteria, CanExecuteRemoveAllCriteria));
            CommandBindings.Add(new CommandBinding(MoveCriteriaUp, ExecutedMoveCriteriaUp, CanExecuteMoveCriteriaUp));
            CommandBindings.Add(new CommandBinding(MoveCriteriaDown, ExecutedMoveCriteriaDown, CanExecuteMoveCriteriaDown));
            CommandBindings.Add(new CommandBinding(NewQuery, ExecutedNewQuery, CanExecuteNewQuery));
            CommandBindings.Add(new CommandBinding(OpenQuery, ExecutedOpenQuery, CanExecuteOpenQuery));
            CommandBindings.Add(new CommandBinding(SaveQuery, ExecutedSaveQuery, CanExecuteSaveQuery));
            CommandBindings.Add(new CommandBinding(ShowSQL, ExecutedShowSQL, CanExecuteShowSQL));
            CommandBindings.Add(new CommandBinding(ExecuteQuery, ExecutedExecuteQuery, CanExecuteExecuteQuery));

            ExecuteQuery.InputGestures.Add(new KeyGesture(Key.F5, ModifierKeys.Control));

            InitializeComponent();
            User  = user;
            Owner = owner;

            var service = new SupportService(user);

            _fields = service.GetFieldMappings();
            lvwFields.ItemsSource = _fields;

            var myView           = (CollectionView)CollectionViewSource.GetDefaultView(lvwFields.ItemsSource);
            var groupDescription = new PropertyGroupDescription("Category");

            if (myView.GroupDescriptions != null)
            {
                myView.GroupDescriptions.Add(groupDescription);
            }

            _model = new ObservableCollection <QueryCriteria>();
            criteriaGrid.ItemsSource = _model;

            var sortItems = new List <String>(new[] { CriteriaSortConverter.NOT_SORTED, "Ascending", "Descending" });

            sortColumn.ItemsSource = sortItems;
        }
Ejemplo n.º 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            CommandBindings.Add(new CommandBinding(ItemCloseAction, ItemClose));

            var tabs = Template.FindName(TabsTemplatePartName, this) as TabControl;

            foreach (var plates in this.platesItems.Keys)
            {
                var viewParent = ((FrameworkElement)plates).Parent as TabControl;
                if (viewParent != null)
                {
                    viewParent.Items.Clear();
                }
                tabs.Items.Add(plates);

                if (platesItems[plates].Any(i => i == this.Items.CurrentItem))
                {
                    tabs.SelectedItem = plates;
                }
            }
        }
Ejemplo n.º 12
0
        public MenuScreen([NotNull] IUnityContainer container) : base(container)
        {
            IsActiveChanged += OnIsActiveChanged;

            //this.IsActive = true;

            ClientCommands.ShowSaveGameDialog.RegisterCommand(SaveGameCommand);

            CommandBindings.Add(
                new CommandBinding(
                    LoadGameCommand,
                    delegate
            {
                NavigationCommands.ActivateScreen.Execute(StandardGameScreens.MenuScreen);
                ServiceLocator.Current.GetInstance <LoadGameDialog>().ShowDialog();
            },
                    (s, e) => e.CanExecute = ClientCommands.LoadGame.CanExecute(null)));

            CommandBindings.Add(
                new CommandBinding(
                    SaveGameCommand,
                    delegate
            {
                NavigationCommands.ActivateScreen.Execute(StandardGameScreens.MenuScreen);
                ServiceLocator.Current.GetInstance <SaveGameDialog>().ShowDialog();
            },
                    (s, e) => e.CanExecute = ClientCommands.SaveGame.CanExecute(null)));

            CommandBindings.Add(
                new CommandBinding(
                    MultiplayerCommand,
                    delegate
            {
                NavigationCommands.ActivateScreen.Execute(StandardGameScreens.MenuScreen);
                ServiceLocator.Current.GetInstance <MultiplayerSetupScreen>().Show();
            },
                    (s, e) => e.CanExecute = ClientCommands.JoinMultiplayerGame.CanExecute(null)));
            _MenuAnimation = new AsteroidsView();
        }
Ejemplo n.º 13
0
        private void SetCommandBindings()
        {
            CommandBinding cmdBindingNew = new CommandBinding(ApplicationCommands.New);

            cmdBindingNew.Executed += NewCommandHandler;
            CommandBindings.Add(cmdBindingNew);

            CommandBinding cmdBindingOpen = new CommandBinding(ApplicationCommands.Open);

            cmdBindingOpen.Executed += OpenCommandHandler;
            CommandBindings.Add(cmdBindingOpen);

            CommandBinding cmdBindingSave = new CommandBinding(ApplicationCommands.Save);

            cmdBindingSave.Executed += SaveCommandHandler;
            CommandBindings.Add(cmdBindingSave);

            CommandBinding cmdBindingSaveAs = new CommandBinding(ApplicationCommands.SaveAs);

            cmdBindingSaveAs.Executed += SaveAsCommandHandler;
            CommandBindings.Add(cmdBindingSaveAs);
        }
Ejemplo n.º 14
0
        public CompareExperiments(int eID1, int eID2, SqlConnection sql)
        {
            InitializeComponent();
            this.eID1 = eID1;
            this.eID2 = eID2;
            this.sql  = sql;

            Title = "Comparison: " + eID1.ToString() + " vs. " + eID2.ToString();

            GetMetaData();

            SqlDataAdapter da = new SqlDataAdapter(mk_query(""), sql);

            DataSet ds = new DataSet();

            da.Fill(ds, "Data");
            dataGrid.ItemsSource = ds.Tables[0].DefaultView;

            CommandBinding ccb = new CommandBinding(CopyFilename, showCopyFilename, canShowCopyFilename);

            CommandBindings.Add(ccb);
        }
Ejemplo n.º 15
0
        public PpsMessageDialog()
        {
            InitializeComponent();

            CommandBindings.Add(new CommandBinding(
                                    ApplicationCommands.Close,
                                    (sender, e) => Close()
                                    ));

            CommandBindings.Add(new CommandBinding(
                                    ApplicationCommands.Properties,
                                    (sender, e) =>
            {
                DialogResult = true;
                Close();
            }
                                    ));

            DetailsVisible = false;

            DataContext = this;
        }         // ctor
Ejemplo n.º 16
0
        public ColorPickerDialog()
        {
            InitializeComponent();
            SelectedColors.ItemsSource = __SavedColors;
            CommandBinding cb = new CommandBinding(ColorPicker.AddToSelected);

            cb.Executed   += new ExecutedRoutedEventHandler(AddToSelected);
            cb.CanExecute += new CanExecuteRoutedEventHandler(CanAddToSelected);
            CommandBindings.Add(cb);

            cb             = new CommandBinding(ColorPickerDialog.RemoveColorCommand);
            cb.Executed   += new ExecutedRoutedEventHandler(RemoveColor);
            cb.CanExecute += new CanExecuteRoutedEventHandler(CanExecuteAlways);
            CommandBindings.Add(cb);

            cb             = new CommandBinding(ColorPickerDialog.RemoveAllColorsCommand);
            cb.Executed   += new ExecutedRoutedEventHandler(RemoveAllColors);
            cb.CanExecute += new CanExecuteRoutedEventHandler(CanExecuteAlways);
            CommandBindings.Add(cb);

            SelectedColors.Focus();
        }
Ejemplo n.º 17
0
        public About()
        {
            InitializeComponent();

            //if we push enter we presume we pushed button "ok"
            RoutedCommand firstSettings = new RoutedCommand();

            firstSettings.InputGestures.Add(new KeyGesture(Key.Enter, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(firstSettings, Button_Click_OK));
            RoutedCommand SecondSettings = new RoutedCommand();

            SecondSettings.InputGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(SecondSettings, Button_Click_OK));

            Globals.MultilangManager.TranslateUIComponent(this);

            Loaded += Backend.StyleManager.RuntimeSkinning_Loaded;

            this.Owner = App.Current.MainWindow;
            this.Left  = this.Owner.Left + this.Owner.Width / 2 - this.Width / 2;
            this.Top   = this.Owner.Top + this.Owner.Height / 2 - this.Height / 2;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 加载相关实现
        /// </summary>
        public void LoadedImplementation()
        {
            // check to make sure we have a ScrollViewer
            if (this.ScrollViewer != null)
            {
                isLoadedImplementation = true;
            }
            else
            {
                return;
            }

            // 将滚动条缩放视角绑定到方法
            CommandBindings.Add(new CommandBinding(TimelineZoomScrollBar.ZoomViewportCommand, ZoomViewportCommandExecute));

            // initialize the tick collection
            TickCollection.ViewportOffset = ScrollViewer.HorizontalOffset;
            TickCollection.ViewportExtent = ScrollViewer.ViewportWidth;

            // initialize zoom percent
            targetRightSeconds = (this.End - this.Start).TotalSeconds;  // try to force it to the right
        }
Ejemplo n.º 19
0
        public MainWindow()
        {
            InitializeComponent();

            // initialize client
            client = new SyncServiceClient(this);

            // create default project at start-up
            CreateNewPorject();

            // bind commands
            CommandBindings.Add(new CommandBinding(ApplicationCommands.New, New_Executed));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, Open_Executed));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, Save_Executed));

            Closing += MainWindow_Closing;

#if DEBUG_ON
            // display console to help debug
            CMDConsole.ConsoleManager.Show();
#endif
        }
        public MarkdownEditor()
        {
            InitializeComponent();
            NameScope.SetNameScope(EditorContextMenu, NameScope.GetNameScope(this));

            Editor.TextArea.SelectionChanged += SelectionChanged;
            Editor.PreviewMouseLeftButtonUp  += HandleMouseUp;
            Editor.MouseMove += HandleEditorMouseMove;
            Editor.PreviewMouseLeftButtonDown += HandleEditorPreviewMouseLeftButtonDown;

            Editor.MouseMove             += (s, e) => e.Handled = true;
            Editor.TextArea.TextEntering += TextAreaTextEntering;

            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleBold, (x, y) => ToggleBold(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleItalic, (x, y) => ToggleItalic(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCode, (x, y) => ToggleCode(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCodeBlock, (x, y) => ToggleCodeBlock(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.SetHyperlink, (x, y) => SetHyperlink(), CanEditDocument));

            var overtypeMode         = new OvertypeMode();
            var autoPairedCharacters = new AutoPairedCharacters();

            editorPreviewKeyDownHandlers = new IHandle <EditorPreviewKeyDownEvent>[] {
                new CopyLeadingWhitespaceOnNewLine(),
                new PasteImageIntoDocument(),
                new PasteURLIntoDocument(),
                new ControlRightTweakedForMarkdown(),
                new HardLineBreak(),
                overtypeMode,
                new AutoContinueLists(),
                new IndentLists(() => IndentType),
                autoPairedCharacters
            };
            editorTextEnteringHandlers = new IHandle <EditorTextEnteringEvent>[] {
                overtypeMode,
                autoPairedCharacters
            };
        }
Ejemplo n.º 21
0
        private void InitializeCommandBindings()
        {
            CommandBindings.Add(new CommandBinding(OptionsCommand, OptionsExecute));
            CommandBindings.Add(new CommandBinding(StartStopCommand, StartStopExecute));
            CommandBindings.Add(new CommandBinding(HelpCommand, HelpExecute));
            CommandBindings.Add(new CommandBinding(NewInstanceCommand, NewInstanceExecute));
            CommandBindings.Add(new CommandBinding(TracerouteCommand, TracerouteExecute));
            CommandBindings.Add(new CommandBinding(FloodHostCommand, FloodHostExecute));
            CommandBindings.Add(new CommandBinding(AddProbeCommand, AddProbeExecute));
            CommandBindings.Add(new CommandBinding(MultiInputCommand, MultiInputWindowExecute));

            var kgOptions     = new KeyGesture(Key.F10);
            var kgStartStop   = new KeyGesture(Key.F5);
            var kgHelp        = new KeyGesture(Key.F1);
            var kgNewInstance = new KeyGesture(Key.N, ModifierKeys.Control);
            var kgTraceroute  = new KeyGesture(Key.T, ModifierKeys.Control);
            var kgFloodHost   = new KeyGesture(Key.F, ModifierKeys.Control);
            var kgAddProbe    = new KeyGesture(Key.A, ModifierKeys.Control);
            var kgMultiInput  = new KeyGesture(Key.F2);

            InputBindings.Add(new InputBinding(OptionsCommand, kgOptions));
            InputBindings.Add(new InputBinding(StartStopCommand, kgStartStop));
            InputBindings.Add(new InputBinding(HelpCommand, kgHelp));
            InputBindings.Add(new InputBinding(NewInstanceCommand, kgNewInstance));
            InputBindings.Add(new InputBinding(TracerouteCommand, kgTraceroute));
            InputBindings.Add(new InputBinding(FloodHostCommand, kgFloodHost));
            InputBindings.Add(new InputBinding(AddProbeCommand, kgAddProbe));
            InputBindings.Add(new InputBinding(MultiInputCommand, kgMultiInput));

            OptionsMenu.Command     = OptionsCommand;
            StartStopMenu.Command   = StartStopCommand;
            HelpMenu.Command        = HelpCommand;
            NewInstanceMenu.Command = NewInstanceCommand;
            TracerouteMenu.Command  = TracerouteCommand;
            FloodHostMenu.Command   = FloodHostCommand;
            AddProbeMenu.Command    = AddProbeCommand;
            MultiInputMenu.Command  = MultiInputCommand;
        }
Ejemplo n.º 22
0
        void AddFileToolBar(ToolBarTray tray, int band, int index)
        {
            ToolBar toolbar = new ToolBar();

            toolbar.Band      = band;
            toolbar.BandIndex = index;
            tray.ToolBars.Add(toolbar);

            RoutedUICommand[] comm =
            {
                ApplicationCommands.New, ApplicationCommands.Open, ApplicationCommands.Save
            };

            string[] strImages =
            {
                "NewDocumentHS.png", "OpenHS.png", "SaveHS.png"
            };

            for (int i = 0; i < 3; i++)
            {
                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);
                string fileName = Path.Combine(Directory.GetCurrentDirectory(), strImages[i]);
                Image  img      = new Image();
                img.Source  = new BitmapImage(new Uri(fileName));
                img.Stretch = Stretch.None;
                btn.Content = img;

                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;
            }

            CommandBindings.Add(new CommandBinding(ApplicationCommands.New, OnNew));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, OnOpen));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, OnSave));
        }
Ejemplo n.º 23
0
        public BasePopup() : base()
        {
            BasePopup.Current = this;
            All.Add(this);

            //InitializeComponent();

            // bind cancel
            CommandCancel = new RoutedCommand("CommandCancel", typeof(BasePopup));
            var binding = new CommandBinding();

            binding.Command     = CommandCancel;
            binding.Executed   += PopupHide;
            binding.CanExecute += CanExecuteTrue;
            CommandBindings.Add(binding);

            // bind confirm button
            CommandConfirm = new RoutedCommand("CommandConfirm", typeof(BasePopup));
            var binding2 = new CommandBinding();

            binding2.Command     = CommandConfirm;
            binding2.Executed   += ConfirmAction;
            binding2.CanExecute += CanExecuteTrue;
            CommandBindings.Add(binding2);

            // bind anim
            //AnimationCompleted = new RoutedCommand("AnimationCompleted", typeof(WPopupTimer));
            //var binding2 = new CommandBinding();
            //binding2.Command = AnimationCompleted;
            //binding2.Executed += AnimComplete;
            //binding2.CanExecute += CanExecuteTrue;
            //CommandBindings.Add(binding2);

            //var a=new System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames();
            //a.Completed += lolz;

            DoPopupAlignment();
        }
Ejemplo n.º 24
0
        void SetCommandBindings()
        {
            CommandBinding newBinding = new CommandBinding(ApplicationCommands.New);

            newBinding.CanExecute += new CanExecuteRoutedEventHandler(newBinding_CanExecute);
            newBinding.Executed   += new ExecutedRoutedEventHandler(newBinding_Executed);
            CommandBindings.Add(newBinding);

            CommandBinding closeBinding = new CommandBinding(ApplicationCommands.Close);

            closeBinding.CanExecute += new CanExecuteRoutedEventHandler(closeBinding_CanExecute);
            closeBinding.Executed   += new ExecutedRoutedEventHandler(closeBinding_Executed);
            CommandBindings.Add(closeBinding);

            CommandBinding openBinding = new CommandBinding(ApplicationCommands.Open);

            openBinding.CanExecute += new CanExecuteRoutedEventHandler(openBinding_CanExecute);
            openBinding.Executed   += new ExecutedRoutedEventHandler(openBinding_Executed);
            CommandBindings.Add(openBinding);

            CommandBinding saveBinding = new CommandBinding(ApplicationCommands.Save);

            saveBinding.CanExecute += new CanExecuteRoutedEventHandler(saveBinding_CanExecute);
            saveBinding.Executed   += new ExecutedRoutedEventHandler(saveBinding_Executed);
            CommandBindings.Add(saveBinding);

            CommandBinding saveAsBinding = new CommandBinding(ApplicationCommands.SaveAs);

            saveAsBinding.CanExecute += new CanExecuteRoutedEventHandler(saveAsBinding_CanExecute);
            saveAsBinding.Executed   += new ExecutedRoutedEventHandler(saveAsBinding_Executed);
            CommandBindings.Add(saveAsBinding);

            CommandBinding tilesetBinding = new CommandBinding(ApplicationCommands.CorrectionList);

            tilesetBinding.CanExecute += new CanExecuteRoutedEventHandler(tilesetBinding_CanExecute);
            tilesetBinding.Executed   += new ExecutedRoutedEventHandler(tilesetBinding_Executed);
            CommandBindings.Add(tilesetBinding);
        }
Ejemplo n.º 25
0
        public ruleWindow(grammarRule gr, CanvasProperty canvasProperties,
                          string filename, string title)
        {
            /* the following is common to all GS window types. */
            InitializeComponent();
            Owner = main;
            graphCanvasK.ScrollOwner = scrollViewerK;
            graphCanvasL.ScrollOwner = scrollViewerL;
            graphCanvasR.ScrollOwner = scrollViewerR;
            ShowInTaskbar            = false;
            foreach (CommandBinding cb in main.CommandBindings)
            {
                CommandBindings.Add(cb);
                graphCanvasK.CommandBindings.Add(cb);
                graphCanvasL.CommandBindings.Add(cb);
                graphCanvasR.CommandBindings.Add(cb);
            }
            foreach (InputBinding ib in main.InputBindings)
            {
                InputBindings.Add(ib);
                graphCanvasK.InputBindings.Add(ib);
                graphCanvasL.InputBindings.Add(ib);
                graphCanvasR.InputBindings.Add(ib);
            }
            /***************************************************/

            rule          = gr;
            this.filename = !string.IsNullOrEmpty(filename) ? filename : "Untitled";
            Title         = !string.IsNullOrEmpty(title) ? title : Path.GetFileNameWithoutExtension(this.filename);

            canvasProps = canvasProperties;
            canvasProps.AddGUIToControl(graphCanvasK);
            canvasProps.AddGUIToControl(graphCanvasL);
            canvasProps.AddGUIToControl(graphCanvasR);
            AdoptWindowWideCanvasProperties();

            InitDrawRule();
        }
Ejemplo n.º 26
0
        public ItemInfoView()
        {
            InitializeComponent();

            var allBranchKeys = FilterPolishConfig.TierableEconomySections;

            CurrentBranchKey = allBranchKeys.First();
            this.BranchKeyDisplaySelection.ItemsSource   = allBranchKeys;
            this.BranchKeyDisplaySelection.SelectedIndex = 0;

//            this.AllAspectList.ItemsSource = Aspects; // todo

            this.DataContext    = this;
            InnerView.BranchKey = CurrentBranchKey;

            this.EventGridFacade = EventGridFacade.GetInstance();
            this.EventGridFacade.FilterChangeEvent += EventGridFacade_FilterChangeEvent;

            RoutedCommand firstSettings = new RoutedCommand();

            firstSettings.InputGestures.Add(new KeyGesture(Key.M, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(firstSettings, MetaHotkey));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow" /> class.
        /// </summary>
        public MainWindow()
        {
            DisplayName = "Default";
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (sender1, args) => this.Close()));

            SelectPresetCommand        = new RelayCommand <CameraPreset>(SelectPreset);
            ExecuteExportPluginCommand = new RelayCommand <IExportPlugin>(ExecuteExportPlugin);
            ExecuteToolPluginCommand   = new RelayCommand <IToolPlugin>(ExecuteToolPlugin);
            InitializeComponent();
            if (!string.IsNullOrEmpty(ServiceProvider.Branding.ApplicationTitle))
            {
                Title = ServiceProvider.Branding.ApplicationTitle;
            }
            if (!string.IsNullOrEmpty(ServiceProvider.Branding.LogoImage) && File.Exists(ServiceProvider.Branding.LogoImage))
            {
                BitmapImage bi = new BitmapImage();
                // BitmapImage.UriSource must be in a BeginInit/EndInit block.
                bi.BeginInit();
                bi.UriSource = new Uri(ServiceProvider.Branding.LogoImage);
                bi.EndInit();
                Icon = bi;
            }
        }
Ejemplo n.º 28
0
        }         // proc CommitValue

        #region ---- UI interaction -----------------------------------------------------

        private void AddClearCommand()
        {
            CommandBindings.Add(
                new CommandBinding(ClearFilterCommand,
                                   (sender, e) =>
            {
                ClearFilter();
                e.Handled = true;
            },
                                   (sender, e) => e.CanExecute = !String.IsNullOrEmpty(FilterText)
                                   )
                );
            CommandBindings.Add(
                new CommandBinding(ClearValueCommand,
                                   (sender, e) =>
            {
                SelectedValue = null;
                e.Handled     = true;
            },
                                   (sender, e) => e.CanExecute = IsNullable && SelectedValue != null
                                   )
                );
        }         // proc AddClearCommand
Ejemplo n.º 29
0
 private MessageBox()
 {
     CommandBindings.Add(new CommandBinding(ControlCommands.Confirm, (s, e) =>
     {
         _messageBoxResult = MessageBoxResult.OK;
         Close();
     }, (s, e) => e.CanExecute = _showOk));
     CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, (s, e) =>
     {
         _messageBoxResult = MessageBoxResult.Cancel;
         Close();
     }, (s, e) => e.CanExecute = _showCancel));
     CommandBindings.Add(new CommandBinding(ControlCommands.Yes, (s, e) =>
     {
         _messageBoxResult = MessageBoxResult.Yes;
         Close();
     }, (s, e) => e.CanExecute = _showYes));
     CommandBindings.Add(new CommandBinding(ControlCommands.No, (s, e) =>
     {
         _messageBoxResult = MessageBoxResult.No;
         Close();
     }, (s, e) => e.CanExecute = _showNo));
 }
 public UserDataGridFormatConfigurationView(string dataGridName)
 {
     InitializeComponent();
     this.DataContext           = new UserDataGridFormatConfigurationViewModel(dataGridName);
     this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
     CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (send, e) => { this.Close(); }));
     CommandBindings.Add(new CommandBinding(ApplicationCommands.Help, (send, e) =>
     {
         if (this.WindowState == WindowState.Normal)
         {
             this.WindowState = WindowState.Maximized;
         }
         else if (WindowState == WindowState.Maximized)
         {
             this.WindowState = WindowState.Normal;
         }
     }));
     this.MouseLeftButtonDown += (sender, e) => { if (e.LeftButton == MouseButtonState.Pressed)
                                                  {
                                                      this.DragMove();
                                                  }
     };
 }