public FsmTreeView() { InitializeComponent(); vm = new FsmTreeViewModel(); vm.UIAction = (s) => this.Dispatcher.BeginInvoke(s, null); this.DataContext = vm; }
public TreeDiffControlViewModel(FsmTreeViewModel l, FsmTreeViewModel r) { leftFsmTree = l; rightFsmTree = r; CommandBinding matchScrollingBinding = new CommandBinding(MatchScrolling, new ExecutedRoutedEventHandler(MatchScrollingCommandBinding_Executed), new CanExecuteRoutedEventHandler(MatchScrollingCommandBinding_CanExecute)); CommandManager.RegisterClassCommandBinding(typeof(TreeDiffControl), matchScrollingBinding); loadFileWorker.DoWork += new DoWorkEventHandler(loadFileWorker_DoWork); loadFileWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(loadFileWorker_RunWorkerCompleted); loadFileWorker2.DoWork += new DoWorkEventHandler(loadFileWorker_DoWork); loadFileWorker2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(loadFileWorker_RunWorkerCompleted); SaveCommand = new RelayCommand(SaveCommandBinding_Executed); MergeToolCommand = new RelayCommand(MergeToolCommand_Executed); SearchCommand = new RelayCommand(SearchCommandBinding_Executed, new Predicate<object>((s) => LeftFsmTree != null)); OpenCommand = new RelayCommand(OpenCommandBinding_Executed); NextDifferenceCommand = new RelayCommand(NextDifferenceCommandBinding_Executed, (s) => LeftFsmTree != null && RightFsmTree != null); }