public override void LoadModule(RoutedCommands commands) { if (commands == null) { throw new ArgumentNullException("sink"); } commands.AddCommand(GlobalCommands.BrowseBack, OnBrowseBack, CanBrowseBack); commands.AddCommand(GlobalCommands.BrowseForward, OnBrowseForward, CanBrowseForward); }
private static bool ConfigureDelayedProcessing(DependencyObject depObj, RoutedCommands routedCommands) { var isDelayed = false; var elem = new CommonElement(depObj); if (elem.IsValid && !elem.IsLoaded) { RoutedEventHandler handler = null; handler = delegate { elem.Loaded -= handler; ProcessRoutedCommandsChanged(depObj, routedCommands); }; elem.Loaded += handler; isDelayed = true; } return isDelayed; }
public static void SetRoutedCommands(DependencyObject obj, RoutedCommands value) { obj.SetValue(RoutedCommandsProperty, value); }
private static void ProcessRoutedCommandsChanged(DependencyObject depObj, RoutedCommands commands) { var cmdBindings = GetCommandBindings(depObj); if (cmdBindings == null) { throw new ArgumentException( "The RoutedBinding.RoutedCommands attached property was set " + "on an element that does not support CommandBindings."); } foreach (CommandBinding cmdBinding in cmdBindings) { var csb = cmdBinding as RoutedBinding; if (csb != null && csb.RoutedCommands == null) { csb.RoutedCommands = commands; } } }
private void InitRoutedCommands() { RoutedCommands = new RoutedCommands(); //todo get module from container var modules = new ICommandModule[] { new ProfessorHandlers(_professorRepository), new ProfessorNavigation(this), new PublicationHandlers(_publicationRepository), new PublicationNavigation(this), new ConferenceHandlers(_conferenceRepository), new ConferenceNavigation(this), new ExhibitionHandlers(_exhibitionRepository), new ExhibitionNavigation(this), new BookHandlers(_bookRepository), new BookNavigation(this), new DissertationHandlers(_dissertationRepository), new DissertationNavigation(this), new InventiveApplicationHandlers(_inventiveApplicationRepository), new InventiveApplicationNavigation(this), new EfficiencyProposalHandlers(_efficiencyProposalRepository), new EfficiencyProposalNavigation(this), new CouncilParticipationHandlers(_councilParticipationRepository), new CouncilParticipationNavigation(this), new ScienceRankHandlers(_scienceRankRepository, _scienceRankMetricRepository), new ScienceRankNavigation(this, _scienceRankMetricDefinitionRepository), new ResearchHandlers(_researchRepository), new ResearchNavigation(this), new NavigationHistory(this), new ReportingHandlers(_cathedraRepository, _professorRepository, _excelReportingService, _reportGenerator) }; modules.ForEach(m => m.LoadModule(RoutedCommands)); }
public void LoadModule(RoutedCommands commands) { commands.AddCommand(GlobalCommands.GenerateReport, GenerateReport); }
public abstract void LoadModule(RoutedCommands commands);