protected override void InvokeCommand(object obj) { // Find the navigation tree item for this relationship SyncRelationshipNodeViewModel relatonshipNavItem = App.Current.MainWindowsViewModel.NavigationItems.OfType <SyncRelationshipNodeViewModel>().FirstOrDefault( n => n.Item == this.relationship); Debug.Assert(relatonshipNavItem != null, "relatonshipNavItem != null"); // Check if an Analyze item is already present under this relationship NavigationNodeViewModel analyzeItem = relatonshipNavItem.Children.OfType <AnalyzeJobNodeViewModel>().FirstOrDefault(); // An analyze item is not present, so add a new one. if (analyzeItem == null) { AnalyzeJobPanelViewModel viewModel = new AnalyzeJobPanelViewModel(this.relationship); analyzeItem = new AnalyzeJobNodeViewModel(relatonshipNavItem, viewModel); relatonshipNavItem.Children.Add(analyzeItem); } analyzeItem.IsSelected = true; AnalyzeJobPanelViewModel analyzeJobViewModel = (AnalyzeJobPanelViewModel)analyzeItem.Item; if (analyzeJobViewModel.BeginAnalyzeCommand.CanExecute(null)) { analyzeJobViewModel.BeginAnalyzeCommand.Execute(null); } }
public AnalyzeJobNodeViewModel(NavigationNodeViewModel parent, AnalyzeJobPanelViewModel viewModel) : base(parent, viewModel) { this.Name = "Analyze"; this.IconImageSource = "/SyncPro.UI;component/Resources/Graphics/select_invert_16.png"; this.ClosePanelCommand = new ClosePanelMenuCommand(viewModel.Relationship, this); this.MenuCommands.Add(new ReanalyzeMenuCommand(viewModel)); this.MenuCommands.Add(new SynchronzieNowMenuCommand(viewModel)); this.MenuCommands.Add(new CancelOperationMenuCommand(viewModel)); }
public ReanalyzeMenuCommand(AnalyzeJobPanelViewModel analyzeJobPanel) : base("RE-ANALYZE", "/SyncPro.UI;component/Resources/Graphics/select_invert_16.png") { this.analyzeJobPanel = analyzeJobPanel; }
public SynchronzieNowMenuCommand(AnalyzeJobPanelViewModel analyzeJobPanel) : base("SYNCHRONIZE NOW", "/SyncPro.UI;component/Resources/Graphics/refresh_update_16.png") { this.analyzeJobPanel = analyzeJobPanel; }