private void InvokeMethod(object sender, RoutedEventArgs e) { if (MessageBox.Show( "Warning, invoke method crash current system! Do you want to continue?", "Warinig", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { var button = sender as Button; if (button != null) { var method = button.DataContext as MethodNode; if (method != null) { var obj = method.Invoke(); if (obj != null) { var vm = new DomViewerViewModel(obj); var win = new DomViewerWindow(vm) { Title = obj.ToString() }; win.ShowDialog(); } else { MessageBox.Show("Null", "Result", MessageBoxButton.OK, MessageBoxImage.Information); } } } } }
protected override void ExecuteCore(AnalysisApplication context) { var vm = new DomViewerViewModel(context); var win = new DomViewerWindow(vm) { Title = context.ToString() }; win.Show(); }
public DomViewerWindow(DomViewerViewModel vm) { InitializeComponent(); this.DataContext = vm; }