Beispiel #1
0
        private void NetworkDiagramButton_Click(object sender, RoutedEventArgs e)
        {
            // Optionally, specify a maximum indentation level to consider when generating network items as a parameter to the GetNetworkDiagramItems method call.
            networkDiagramItems = GanttChartDataGrid.GetNetworkDiagramItems();
            var networkDiagramView = new DlhSoft.Windows.Controls.Pert.NetworkDiagramView {
                Items = networkDiagramItems
            };
            ChildWindow networkDiagramWindow =
                new ChildWindow
            {
                Title   = "Network Diagram", Width = 960, Height = 600,
                Content = networkDiagramView
            };

            networkDiagramView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, reposition start and finish milestones between the first and second rows of the view.
                networkDiagramView.RepositionEnds();
                // Optionally, highlight the critical path.
                Brush redBrush = new SolidColorBrush(Colors.Red);
                foreach (var item in networkDiagramView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetShapeStroke(item, redBrush);
                }
                foreach (var predecessorItem in networkDiagramView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetDependencyLineStroke(predecessorItem, redBrush);
                }
            };
            networkDiagramWindow.Closed += NetworkDiagramWindow_Closed;
            networkDiagramWindow.Show();
        }
        private void NetworkDiagramButton_Click(object sender, RoutedEventArgs e)
        {
            double originalOpacity = Opacity;

            Opacity = 0.5;
            // Optionally, specify a maximum indentation level to consider when generating network items as a parameter to the GetNetworkDiagramItems method call.
            ObservableCollection <DlhSoft.Windows.Controls.Pert.NetworkDiagramItem> networkDiagramItems = GanttChartDataGrid.GetNetworkDiagramItems();

            DlhSoft.Windows.Controls.Pert.NetworkDiagramView networkDiagramView = new DlhSoft.Windows.Controls.Pert.NetworkDiagramView {
                Items = networkDiagramItems
            };
            Window networkDiagramWindow =
                new Window
            {
                Owner   = Application.Current.MainWindow, Title = "Network Diagram", WindowStartupLocation = WindowStartupLocation.CenterOwner, Width = 960, Height = 600, ResizeMode = ResizeMode.CanResize,
                Content = networkDiagramView
            };

            networkDiagramView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, reposition start and finish milestones between the first and second rows of the view.
                networkDiagramView.RepositionEnds();
                // Optionally, highlight the critical path.
                foreach (var item in networkDiagramView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetShapeStroke(item, Brushes.Red);
                }
                foreach (var predecessorItem in networkDiagramView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetDependencyLineStroke(predecessorItem, Brushes.Red);
                }
            };
            if (themeResourceDictionary != null)
            {
                (networkDiagramWindow.Content as FrameworkElement).Resources.MergedDictionaries.Add(themeResourceDictionary);
            }
            networkDiagramWindow.ShowDialog();
            GanttChartDataGrid.DisposeNetworkDiagramItems(networkDiagramItems);
            Opacity = originalOpacity;
        }