/// <summary>The only constructor</summary> /// <param name="commandBindingCollection">Linked CommandBindingCollection</param> /// <exception cref="commandBindingCollection">Thrown when null</exception> public RoutedCommandBindingCollection(CommandBindingCollection commandBindingCollection) { CommandBindingCollection = commandBindingCollection ?? throw new ArgumentNullException(nameof(commandBindingCollection)); INotifyCollectionChanged notifyCollection = this; notifyCollection.CollectionChanged += CollectionChanged; }
public WindowMetRibbon() { InitializeComponent(); LeesMRU(); if (Properties.Settings.Default.qat != null) { System.Collections.Specialized.StringCollection qatlijst = WindowMetRibbonControl.Properties.Settings.Default.qat; int lijnnr = 0; while (lijnnr < qatlijst.Count) { String commando = qatlijst[lijnnr]; String png = qatlijst[lijnnr + 1]; RibbonButton nieuweKnop = new RibbonButton(); BitmapImage icon = new BitmapImage(); icon.BeginInit(); icon.UriSource = new Uri(png); icon.EndInit(); nieuweKnop.SmallImageSource = icon; CommandBindingCollection ccol = this.CommandBindings; foreach (CommandBinding cb in ccol) { RoutedUICommand rcb = (RoutedUICommand)cb.Command; if (rcb.Text == commando) { nieuweKnop.Command = rcb; } } Qat.Items.Add(nieuweKnop); lijnnr += 2; } } }
public MainViewModel() { this.settings = Settings.Load(); if (IsInDesignMode) { this.Assemblies.Add(new TestAssemblyViewModel(new AssemblyAndConfigFile(@"C:\Code\TestAssembly.dll", null))); } CommandBindings = CreateCommandBindings(); this.testUtil = new Xunit.Runner.Wpf.Impl.RemoteTestUtil(Dispatcher.CurrentDispatcher); this.TestCasesCaption = "Test Cases (0)"; this.FilteredTestCases = new FilteredCollectionView <TestCaseViewModel, SearchQuery>( allTestCases, TestCaseMatches, searchQuery, TestComparer.Instance); this.FilteredTestCases.CollectionChanged += TestCases_CollectionChanged; this.ExitCommand = new RelayCommand(OnExecuteExit); this.WindowLoadedCommand = new RelayCommand(OnExecuteWindowLoaded); this.WindowClosingCommand = new RelayCommand <CancelEventArgs>(OnExecuteWindowClosing); this.RunAllCommand = new RelayCommand(OnExecuteRunAll, CanExecuteRunAll); this.RunSelectedCommand = new RelayCommand(OnExecuteRunSelected, CanExecuteRunSelected); this.CancelCommand = new RelayCommand(OnExecuteCancel, CanExecuteCancel); this.TraitCheckedChangedCommand = new RelayCommand <TraitViewModel>(OnExecuteTraitCheckedChanged); this.TraitsClearCommand = new RelayCommand(OnExecuteTraitsClear); this.AssemblyReloadCommand = new RelayCommand(OnExecuteAssemblyReload, CanExecuteAssemblyReload); this.AssemblyReloadAllCommand = new RelayCommand(OnExecuteAssemblyReloadAll); this.AssemblyRemoveCommand = new RelayCommand(OnExecuteAssemblyRemove, CanExecuteAssemblyRemove); this.AssemblyRemoveAllCommand = new RelayCommand(OnExecuteAssemblyRemoveAll); RebuildRecentAssembliesMenu(); }
public MainViewModel() { Login = new LoginViewModel(); Models = new ModelsViewModel(); Parameters = new ParametersViewModel(); Reports = new ReportsViewModel(); Entry = new EntryViewModel(); Years = new ObservableCollection <int>(); AddYearCommand = new RoutedUICommand("AddYear", "AddYear", typeof(MainViewModel)); BackupCommand = new RoutedUICommand("Backup", "Backup", typeof(MainViewModel)); DeleteYearCommand = new RoutedUICommand("DeleteYear", "DeleteYear", typeof(MainViewModel)); LoginCommand = new RoutedUICommand("Login", "Login", typeof(MainViewModel)); RefreshCommand = new RoutedUICommand("Refresh", "Refresh", typeof(MainViewModel)); HelpCommand = new RoutedUICommand("Help", "Help", typeof(MainViewModel)); Bindings = new CommandBindingCollection() { new CommandBinding(AddYearCommand, AddYearExecuted, AddYearCanExecute), new CommandBinding(BackupCommand, BackupExecuted, BackupCanExecute), new CommandBinding(DeleteYearCommand, DeleteYearExecuted, DeleteYearCanExecute), new CommandBinding(LoginCommand, LoginExecuted), new CommandBinding(RefreshCommand, RefreshExecuted), new CommandBinding(HelpCommand, HelpExecuted), }; LoadYears(); }
public PageItem( int index, int totalItems, CommandBindingCollection commandBindings, HelpConfiguration helpScreen, HelpConfiguration helpScreen2, IconBase icon, string title, string description) { Index = index; var angleStep = 360d / totalItems; var angleStart = AngleStart + index * angleStep; if (totalItems == 1) { angleStep = 180d; } Angle = angleStart; StartAngle = Normalize(angleStart - angleStep / 2d); EndAngle = Normalize(angleStart + angleStep / 2d); CommandBindings = commandBindings; HelpScreen = helpScreen; HelpScreen2 = helpScreen2; Icon = icon; Title = title; Description = description; }
// Token: 0x06003505 RID: 13573 RVA: 0x000EFEC0 File Offset: 0x000EE0C0 internal void DetachRubberbandSelector() { this.ClearSelection(); if (this._scope != null) { this._scope.MouseLeftButtonDown -= this.OnLeftMouseDown; this._scope.MouseLeftButtonUp -= this.OnLeftMouseUp; this._scope.MouseMove -= this.OnMouseMove; this._scope.QueryCursor -= this.OnQueryCursor; this._scope = null; } if (this._uiScope != null) { CommandBindingCollection commandBindings = this._uiScope.CommandBindings; foreach (object obj in commandBindings) { CommandBinding commandBinding = (CommandBinding)obj; if (commandBinding.Command == ApplicationCommands.Copy) { commandBinding.Executed -= this.OnCopy; commandBinding.CanExecute -= this.QueryCopy; } } this._uiScope = null; } }
protected virtual void OnBindCommands(CommandBindingCollection bindings) { DebugHelper.AssertUIThread(); if (bindings != null) { ICommand cmd = FindResource("KinectStudioPlugin.ShowSettingsCommand") as ICommand; if (cmd != null) { bindings.Add(new CommandBinding(cmd, (source2, e2) => { DebugHelper.AssertUIThread(); this.ShowSettings(); e2.Handled = true; }, (source2, e2) => { e2.Handled = true; e2.CanExecute = true; })); } } }
public static void SetRegistration(UIElement element, CommandBindingCollection value) { if (element != null) { element.SetValue(Registration, value); } }
/// <summary> /// Adds the commands used by SearchPanel to the given CommandBindingCollection. /// </summary> public void RegisterCommands(CommandBindingCollection commandBindings) { if (handler != null) { handler.RegisterGlobalCommands(commandBindings); } }
/// <summary>持っているコマンドを登録する。</summary> public void ResetCommandBindings(UIElement cTrgView, UIElement cTrgMenu = null) { try { var cBinds = new CommandBindingCollection(); foreach (var item in cmdList) { //Exeがあるものを処理する。 ExecutedRoutedEventHandler exeh = GetExecute(item.Key); if (exeh != null) { foreach (var cTrg in new List <UIElement> { cTrgView, cTrgMenu }.OfType <UIElement>()) { //古いものは削除 var delList = cTrg.CommandBindings.OfType <CommandBinding>().Where(bind => bind.Command == item.Key).ToList(); delList.ForEach(delItem => cTrg.CommandBindings.Remove(delItem)); cTrg.CommandBindings.Add(new CommandBinding(item.Key, exeh, GetCanExecute(item.Key))); } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static void SetRegisterCommandBindings(UIElement element, CommandBindingCollection value) { if (element != null) { element.SetValue(RegisterCommandBindingsProperty, value); } }
CommandBindingCollection BindingCommandHandler() { var srv = App.Server; CommandBindingCollection CommandBindings = new CommandBindingCollection(); return(CommandBindings); }
public StatComparisonDocumentVM(StatComparisonDocumentService service, CommandBindingCollection commandBindings, string persistentInfo) { _isInitializing = true; _commandBindings = commandBindings; this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo, () => new StatComparisonDocumentPersistentInfo(), this.GetLogger()); this.StatsManager = new StatsManagerVM(this); this.TanksManager = new TanksManagerVM(this); this.InitializeGrid(); if (this.Title == null) { service.PromptForTitle() .ContinueWith(t => this.Title = string.IsNullOrWhiteSpace(t.Result) ? this.L("stat_comparison", "new_comparison_default_title") : t.Result); } this.UpdateStatsValueMode(); this.DropHandler = new DropHandlerImpl(this); this.InitializeCommands(); _isInitializing = false; }
private void SetCommandBindings() { CommandBindingCollection cmdbindcol = new CommandBindingCollection() { new CommandBinding(SaveAs, mmFileSaveAs_Click), new CommandBinding(Redo, mmEditRedo_Click), new CommandBinding(GoTo, mmEditGoTo_Click), new CommandBinding(FindNext, mmEditFindNext_Click), new CommandBinding(FindBack, mmEditFindBack_Click), new CommandBinding(TimeAndDate, mmEditTimeAndData_Click), new CommandBinding(DefaultScale, mmViewScaleDefault_Click), new CommandBinding(ScalePlusCmd, mmViewScalePlus_Click), new CommandBinding(ScaleMinusCmd, mmViewScaleMinus_Click) }; this.CommandBindings.AddRange(cmdbindcol); mmFileSaveAs.Command = SaveAs; mmEditRedo.Command = Redo; mmEditGoTo.Command = GoTo; mmEditFindNext.Command = FindNext; mmEditFindBack.Command = FindBack; mmEditTimeAndData.Command = TimeAndDate; mmViewScaleDefault.Command = DefaultScale; mmViewScalePlus.Command = ScalePlusCmd; mmViewScaleMinus.Command = ScaleMinusCmd; }
public FlowDocumentVMBase(CommandBindingCollection commandBindings) { commandBindings.Add(new CommandBinding(WpfApplicationCommands.SaveAs, this.ExecuteSaveAs)); commandBindings.Add(new CommandBinding(FlowDocumentCommands.ExportXps, this.ExecuteExportXps)); commandBindings.Add(new CommandBinding(FlowDocumentCommands.ExportRtf, this.ExecuteExportRtf)); commandBindings.Add(new CommandBinding(FlowDocumentCommands.ExportTxt, this.ExecuteExportTxt)); }
public AccessoryViewModel(CommandBindingCollection commandBindings, Accessory accessory, TankViewModelBase owner) : base(commandBindings, owner) { this.Accessory = accessory; this.Price = new PriceViewModel(accessory.Price, accessory.CurrencyType); this.Icon = "gui" + accessory.Icon.Substring(2); }
/// <summary> /// Removes rubberband selector from its scope -- gets out of rubberband selection mode /// </summary> internal void DetachRubberbandSelector() { ClearSelection(); if (_scope != null) { _scope.MouseLeftButtonDown -= new MouseButtonEventHandler(OnLeftMouseDown); _scope.MouseLeftButtonUp -= new MouseButtonEventHandler(OnLeftMouseUp); _scope.MouseMove -= new MouseEventHandler(OnMouseMove); _scope.QueryCursor -= new QueryCursorEventHandler(OnQueryCursor); _scope = null; } if (_uiScope != null) { CommandBindingCollection commandBindings = _uiScope.CommandBindings; foreach (CommandBinding binding in commandBindings) { if (binding.Command == ApplicationCommands.Copy) { binding.Executed -= new ExecutedRoutedEventHandler(OnCopy); binding.CanExecute -= new CanExecuteRoutedEventHandler(QueryCopy); } } _uiScope = null; } }
internal NationalTechTreeNodeViewModel(CommandBindingCollection commandBindings, Tank tank, int row, int column, IEnumerable <string> unlockeTanks) : base(commandBindings, tank) { this.Column = column; this.Row = row; this.UnlockTanks = unlockeTanks; }
public static void AddCommandExecutedHandler(this CommandBindingCollection collection, RoutedCommand command, ExecutedRoutedEventHandler handler) { CommandBinding binding = GetOrCreateBinding(collection, command); // Remove the handler if it already exist binding.Executed -= handler; binding.Executed += handler; }
public static ShellViewModel CreateShell(CommandBindingCollection commandBindings, IShell shell, GunViewModel gun) { if (shell is BenchmarkShell) { return(new BenchmarkShellViewModel(commandBindings, (BenchmarkShell)shell, gun)); } return(new ShellViewModel(commandBindings, shell, gun)); }
public static Menu FromConfig(MenuConfiguration config, IActionFactory actionFactory) { return(new Menu( CommandBindingCollection.FromCollection(config.CommandBindings, actionFactory), config.Pages.Select((p, i) => MenuPage.FromConfig(p, i, actionFactory)), config.Help, config.Help2)); }
public static void AddCommandPreviewCanExecuteHandler(this CommandBindingCollection collection, RoutedCommand command, CanExecuteRoutedEventHandler handler) { CommandBinding binding = GetOrCreateBinding(collection, command); // Remove the handler if it already exist binding.PreviewCanExecute -= handler; binding.PreviewCanExecute += handler; }
public static void AddCommand(CommandBindingCollection CommandBindings) { CommandBindings.Add(new CommandBinding(Commands.New_File, delegate { MessageBox.Show("新規ファイルの作成"); })); CommandBindings.Add(new CommandBinding(Commands.New_Project, delegate { MessageBox.Show("新規プロジェクトの作成"); })); CommandBindings.Add(new CommandBinding(Commands.View_NetWork, delegate { })); }
public TankModuleTreeDocumentVM(TankModuleTreeDocumentService service, CommandBindingCollection commandBindings, TankInstance tankInstance, string persistentInfo) { this.TankInstance = tankInstance; Task.Factory.StartNew(this.AnalyseUnlocks); }
public ArmorDocumentVM(ArmorDocumentService modelDocumentService, CommandBindingCollection commandBindings, TankInstance tank, string persistentInfo) : base(commandBindings, tank, persistentInfo) { this.ModelDocumentService = modelDocumentService; this.Capture = new CaptureVM(this); }
public MenuController(RootConfiguration config, IActionFactoryFactory factory) { var actionFactory = factory.Create(this); MenuCollection = new MenuCollection(config.Menus.ToDictionary(m => m.Name, m => Menu.FromConfig(m, actionFactory))); GlobalBindings = CommandBindingCollection.FromCollection(config.Bindings, actionFactory); menuStack = new Stack <MenuState>(); Placement = config.Placement; }
public ShellVM(CommandBindingCollection commandBindings) { _commandBindings = commandBindings; this.MainMenu = new MainMenuVM(this); this.MainDockingView = new MainDockingViewVM(this, commandBindings); this.Status = new StatusVM(this); this.ApplicationSettings = new ApplicationSettingsVM(this); }
public SearchResultItemViewModel(CommandBindingCollection commandBindings, ITankInfo tankInfo, HangarViewModel owner) { _commandBindings = commandBindings; this.Tank = tankInfo; this.Owner = owner; this.SelectTankCommand = new RelayCommand(() => owner.SelectSearchResultTank(this.Tank)); this.SelectAsReferenceTankCommand = new RelayCommand(() => owner.SelectSearchResultTankAsReferenceTank(this.Tank)); }
public static void SetCommandBindings(UIElement target, CommandBindingCollection value) { if (target == null) { throw new ArgumentNullException("target"); } target.SetValue(CommandBindingsProperty, value); }
private void PageLoaded(object sender, RoutedEventArgs e) { // TODO: read from history FocusedExplorer = expLeft; //димина коллекция вотчеров не использую т.к. пока работает некорректно //_fileSystem.Watchers.DefaultChanged += OnChanged; //_fileSystem.Watchers.DefaultCreated += OnChanged; //_fileSystem.Watchers.DefaultDeleted += OnChanged; //_fileSystem.Watchers.DefaultRenamed += OnRenamed; //expLeft.Tag = _fileSystem.Watchers.Add(UcCurrentDirectory); //expRight.Tag = _fileSystem.Watchers.Add(UcCurrentDirectory); var watch = new FileSystemWatcher(); expLeft.Tag = watch; InitializeWatcher(watch, UcCurrentDirectory); watch = new FileSystemWatcher(); expRight.Tag = watch; InitializeWatcher(watch, UcCurrentDirectory); expLeft.CurrentPath = UcCurrentDirectory; expRight.CurrentPath = UcCurrentDirectory; var cmdBindCollection = new CommandBindingCollection { new CommandBinding( NavigationCommands.Refresh, RefreshOnExecute, RefreshCanExecute ), new CommandBinding( ApplicationCommands.Copy, CopyOnExecute, CopyCanExecute ), new CommandBinding( ApplicationCommands.Delete, DeleteOnExecute, DeleteCanExecute ) }; //cmdBindCollection.Add(new CommandBinding( // ApplicationCommands.Cut, // CutCanExecute, // CutOnExecute // expLeft.GridCommandBindings.AddRange(cmdBindCollection); expRight.GridCommandBindings.AddRange(cmdBindCollection); Application.Current.SessionEnding += ApplicationOnSessionEnding; }
/// <summary> /// Gets the CommandBindings property. Here we initialize the collection and set the Owner property. /// </summary> /// <param name="d">The dependency object.</param> /// <returns> /// The command bindings. /// </returns> /// <exception cref="System.InvalidOperationException">The dependency object trying to attach to is set to null</exception> public static CommandBindingCollection GetCommandBindings(DependencyObject d) { if (d == null) { throw new InvalidOperationException("The dependency object trying to attach to is set to null"); } CommandBindingCollection collection = d.GetValue(EventCommand.CommandBindingsProperty) as CommandBindingCollection; if (collection == null) { collection = new CommandBindingCollection(); collection.Owner = d; SetCommandBindings(d, collection); } return collection; }
/// <summary> /// Provides a secure method for setting the CommandBindings property. /// </summary> /// <param name="d">The dependency object.</param> /// <param name="value">The command binding collection value.</param> private static void SetCommandBindings(DependencyObject d, CommandBindingCollection value) { d.SetValue(CommandBindingsPropertyKey, value); INotifyCollectionChanged collection = (INotifyCollectionChanged)value; collection.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChanged); }