Beispiel #1
0
        private void PertChartButton_Click(object sender, RoutedEventArgs e)
        {
            // Optionally, specify a maximum indentation level to consider when generating PERT items as a parameter to the GetPertChartItems method call.
            pertChartItems = GanttChartDataGrid.GetPertChartItems();
            var pertChartView = new DlhSoft.Windows.Controls.Pert.PertChartView {
                Items = pertChartItems, PredecessorToolTipTemplate = Resources["PertChartPredecessorToolTipTemplate"] as DataTemplate
            };
            ChildWindow pertChartWindow =
                new ChildWindow
            {
                Title   = "PERT Chart", Width = 640, Height = 480,
                Content = pertChartView
            };

            pertChartView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, highlight the critical path.
                Brush redBrush = new SolidColorBrush(Colors.Red);
                foreach (var item in pertChartView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetShapeStroke(item, redBrush);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetTextForeground(item, redBrush);
                }
                foreach (var predecessorItem in pertChartView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyLineStroke(predecessorItem, redBrush);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyTextForeground(predecessorItem, redBrush);
                }
            };
            pertChartWindow.Closed += PertChartWindow_Closed;
            pertChartWindow.Show();
        }
        private void PertChartButton_Click(object sender, RoutedEventArgs e)
        {
            double originalOpacity = Opacity;

            Opacity = 0.5;
            // Optionally, specify a maximum indentation level to consider when generating PERT items as a parameter to the GetPertChartItems method call.
            ObservableCollection <DlhSoft.Windows.Controls.Pert.PertChartItem> pertChartItems = GanttChartDataGrid.GetPertChartItems();
            var pertChartView = new DlhSoft.Windows.Controls.Pert.PertChartView {
                Items = pertChartItems, PredecessorToolTipTemplate = Resources["PertChartPredecessorToolTipTemplate"] as DataTemplate
            };
            Window pertChartWindow =
                new Window
            {
                Owner   = Application.Current.MainWindow, Title = "PERT Chart", WindowStartupLocation = WindowStartupLocation.CenterOwner, Width = 640, Height = 480, ResizeMode = ResizeMode.CanResize,
                Content = pertChartView
            };

            pertChartView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, highlight the critical path.
                foreach (var item in pertChartView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetShapeStroke(item, Brushes.Red);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetTextForeground(item, Brushes.Red);
                }
                foreach (var predecessorItem in pertChartView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyLineStroke(predecessorItem, Brushes.Red);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyTextForeground(predecessorItem, Brushes.Red);
                }
            };
            if (themeResourceDictionary != null)
            {
                (pertChartWindow.Content as FrameworkElement).Resources.MergedDictionaries.Add(themeResourceDictionary);
            }
            pertChartWindow.ShowDialog();
            GanttChartDataGrid.DisposePertChartItems(pertChartItems);
            Opacity = originalOpacity;
        }