예제 #1
0
        private void GanttChartDataGrid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Point controlPosition = e.GetPosition(GanttChartDataGrid);
            Point contentPosition = e.GetPosition(GanttChartDataGrid.ChartContentElement);

            DateTime       dateTime = GanttChartDataGrid.GetDateTime(contentPosition.X);
            GanttChartItem itemRow  = GanttChartDataGrid.GetItemAt(contentPosition.Y);

            GanttChartItem   item             = null;
            PredecessorItem  predecessorItem  = null;
            FrameworkElement frameworkElement = e.OriginalSource as FrameworkElement;

            if (frameworkElement != null)
            {
                item = frameworkElement.DataContext as GanttChartItem;
                DependencyArrowLine.LineSegment dependencyLine = frameworkElement.DataContext as DependencyArrowLine.LineSegment;
                if (dependencyLine != null)
                {
                    predecessorItem = dependencyLine.Parent.DataContext as PredecessorItem;
                }
            }

            if (controlPosition.X < GanttChartDataGrid.ActualWidth - GanttChartDataGrid.GanttChartView.ActualWidth)
            {
                return;
            }
            string message = String.Empty;

            if (controlPosition.Y < GanttChartDataGrid.HeaderHeight)
            {
                message = string.Format("You have clicked the chart scale header at date and time {0:g}.", dateTime);
            }
            else if (item != null && item.HasChildren)
            {
                message = string.Format("You have clicked the summary task item '{0}' at date and time {1:g}.", item, dateTime < item.Start ? item.Start : (dateTime > item.Finish ? item.Finish : dateTime));
            }
            else if (item != null && item.IsMilestone)
            {
                message = string.Format("You have clicked the milestone task item '{0}' at date and time {1:g}.", item, item.Start);
            }
            else if (item != null)
            {
                message = string.Format("You have clicked the standard task item '{0}' at date and time {1:g}.", item, dateTime > item.Finish ? item.Finish : dateTime);
            }
            else if (predecessorItem != null)
            {
                message = string.Format("You have clicked the task dependency line between '{0}' and '{1}'.", predecessorItem.DependentItem, predecessorItem.Item);
            }
            else if (itemRow != null)
            {
                message = string.Format("You have clicked at date and time {0:g} within the row of item '{1}'.", dateTime, itemRow);
            }
            else
            {
                message = string.Format("You have clicked at date and time {0:g} within an empty area of the chart.", dateTime);
            }

            NotificationsTextBox.AppendText(string.Format("{0}{1}", NotificationsTextBox.Text.Length > 0 ? "\n" : string.Empty, message));
            NotificationsTextBox.ScrollToEnd();
        }
        private void SetDependencyColorButton_Click(object sender, RoutedEventArgs e)
        {
            PredecessorItem predecessorItem = PertChartView.Items[2].Predecessors[0];

            DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyLineStroke(predecessorItem, Resources["CustomDependencyLineStroke"] as Brush);
            DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyTextForeground(predecessorItem, Resources["CustomDependencyLineStroke"] as Brush);
        }
 private void SetCriticalPathHighlighting(PredecessorItem predecessorItem, bool isHighlighted)
 {
     DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyLineStroke(predecessorItem, isHighlighted ? Resources["CustomDependencyLineStroke"] as Brush : PertChartView.DependencyLineStroke);
     DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyTextForeground(predecessorItem, isHighlighted ? Resources["CustomDependencyLineStroke"] as Brush : PertChartView.DependencyTextForeground);
 }
예제 #4
0
 /// <summary>
 /// Supprime un prédecesseur de l'élément.
 /// </summary>
 /// <param name="item">Le <see cref="PredecessorItem"/>.</param>
 private void DeletePredecessorItem(PredecessorItem item)
 {
     _currentUpdatingPredecessors = item.DependentItem.Predecessors;
     item.DependentItem.Predecessors.Remove(item);
     _currentUpdatingPredecessors = null;
 }