private void MenuShowSourceCode(object sender, RoutedEventArgs e) { if (e.Source is FrameworkElement) { FrameworkElement item = e.Source as FrameworkElement; Application.Current.Dispatcher.Invoke(new Action(() => { Object windowDataContext = null; if (item.DataContext is SamplingNode) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(SummaryTable.DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (item.DataContext as SamplingNode).Description.Path); } else { if (item.DataContext is EventNode) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(SummaryTable.DataContext as Board <EventBoardItem, EventDescription, EventNode>, (item.DataContext as EventNode).Description.Path); } } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext, Owner = Application.Current.MainWindow }.Show(); } })); } }
private void Row_DoubleClick(object sender, RoutedEventArgs e) { if (!(sender is DataGridRow)) { return; } Object rowDataContext = (sender as DataGridRow).DataContext; Object windowDataContext = null; if (rowDataContext is SamplingBoardItem) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (rowDataContext as SamplingBoardItem).Description.Path); } else if (rowDataContext is EventBoardItem) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(DataContext as Board <EventBoardItem, EventDescription, EventNode>, (rowDataContext as EventBoardItem).Description.Path); } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext }.Show(); } }
private void OnTreeViewItemMouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (e.Source is FrameworkElement) { e.Handled = true; FrameworkElement item = e.Source as FrameworkElement; Application.Current.Dispatcher.Invoke(new Action(() => { Object windowDataContext = null; if (item.DataContext is SamplingNode) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(SummaryTable.DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (item.DataContext as SamplingNode).Description.Path); } else if (item.DataContext is EventNode) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(SummaryTable.DataContext as Board <EventBoardItem, EventDescription, EventNode>, (item.DataContext as EventNode).Description.Path); } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext, Owner = Application.Current.MainWindow }.Show(); } })); } }