// Status logic. private string GetStatus(GanttChartItem item) { if (GanttChartView.HasChildren(item) || item.IsMilestone) { return(string.Empty); } var itemStart = GanttChartView.GetNextWorkingTime(item.Start); var itemFinish = GanttChartView.GetPreviousNonworkingTime(item.Finish); if (itemFinish < itemStart) { return(string.Empty); } var itemCompletedFinish = item.CompletedFinish; if (itemCompletedFinish < itemStart) { itemCompletedFinish = itemStart; } if (itemCompletedFinish >= itemFinish) { return("Completed"); } DateTime now = GanttChartView.CurrentTime; if (itemCompletedFinish < now) { return("Behind schedule"); } if (itemCompletedFinish > itemStart) { return("In progress"); } return("To do"); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // ExStart:SetTimeScaleCount Project project = new Project(); // Init Gantt Chart View GanttChartView view = new GanttChartView(); // Set Time Scale count view.BottomTimescaleTier.Count = 2; view.BottomTimescaleTier.ShowTicks = false; view.MiddleTimescaleTier.Count = 2; view.MiddleTimescaleTier.ShowTicks = false; // Add Gantt Chart View to project project.Views.Add(view); // Add some test data to project Task task1 = project.RootTask.Children.Add("Task 1"); Task task2 = project.RootTask.Children.Add("Task 2"); task1.Set(Tsk.Duration, task1.ParentProject.GetDuration(24, TimeUnitType.Hour)); task2.Set(Tsk.Duration, task1.ParentProject.GetDuration(40, TimeUnitType.Hour)); project.Save(dataDir + "SetTimeScaleCount_out.pdf", SaveFileFormat.PDF); // ExEnd:SetTimeScaleCount }
public void SaveToStreamWithOptionsAndCatchException() { // ExStart // ExFor: BitmapInvalidSizeException // ExFor: BitmapInvalidSizeException.#ctor(SerializationInfo,StreamingContext) // ExSummary: Shows how to save project as an image and catch invalid size exception. try { var project = new Project(DataDir + "Blank2010.mpp"); GanttChartView view = (GanttChartView)project.Views.ToList()[0]; var options = new ImageSaveOptions(SaveFileFormat.PNG) { Timescale = Timescale.DefinedInView }; view.MiddleTimescaleTier.Unit = TimescaleUnit.Minutes; view.MiddleTimescaleTier.Count = 1; project.Save(OutDir + "SaveToStreamAndCatchException_out.mpp", options); } catch (BitmapInvalidSizeException ex) { Console.WriteLine(ex.Message); } // ExEnd }
// ExStart:ImplementCustomBarStyleWriting static void ImplementCustomBarSytle() { try { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); Project project = new Project(dataDir + "Blank2010.mpp"); project.RootTask.Children.Add("Task"); GanttChartView view = project.DefaultView as GanttChartView; GanttBarStyle custom = GetCustomBarStyle(); // Add the custom bar style to the custom bar collection of the project view view.CustomBarStyles.Add(custom); string file = "ImplementCustomBarStyleWriting_out.mpp"; MPPSaveOptions options = new MPPSaveOptions(); options.WriteViewData = true; project.Save(dataDir + file, options); } catch (NotSupportedException ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx."); } }
public void WorkWithTimescaleTier() { // ExStart // ExFor: SaveOptions.Timescale // ExFor: GanttChartView.MiddleTimescaleTier // ExFor: GanttChartView.BottomTimescaleTier // ExSummary: Shows how to work with timescale tiers through save options. var project = new Project(DataDir + "CreateProject2.mpp"); GanttChartView ganttChartView = (GanttChartView)project.Views.ToList()[0]; // set the timescale tiers of the Gantt Chart view ganttChartView.MiddleTimescaleTier.Unit = TimescaleUnit.Months; ganttChartView.MiddleTimescaleTier.Count = 1; ganttChartView.MiddleTimescaleTier.Label = DateLabel.MonthMmmm; ganttChartView.BottomTimescaleTier.Unit = TimescaleUnit.Days; ganttChartView.BottomTimescaleTier.Count = 1; ganttChartView.BottomTimescaleTier.Label = DateLabel.DayDddDd; // ... var options = new ImageSaveOptions(SaveFileFormat.PNG) { Timescale = Timescale.DefinedInView }; // ... // save the project as an image project.Save(OutDir + "WorkWithTimescaleTier_out.png", options); // ExEnd }
public void WorkWithView() { // ExStart:WorkWithView // ExFor: View // ExFor: View.#ctor // ExFor: View.PageInfo // ExFor: View.Filter // ExFor: View.Group // ExFor: View.Name // ExFor: View.ParentProject // ExFor: View.Screen // ExFor: View.HighlightFilter // ExFor: View.ShowInMenu // ExFor: View.Table // ExFor: View.Type // ExFor: View.Uid // ExFor: ViewScreen // ExSummary: Shows how to work with MS Project views. // create an empty project without views var project = new Project(); project.Set(Prj.Name, "Test View Project"); // create a standard Gantt chart view View view = new GanttChartView(); // set some view properties // set a value indicating whether Microsoft Project shows the single view name in the View or the Other Views drop-down lists in the Ribbon view.ShowInMenu = true; // set a value indicating whether Microsoft Project highlights the filter for a single view view.HighlightFilter = true; // the writing of the next properties is not supported // sets the filter used in a single view view.Filter = null; // sets the group of the single view view.Group = null; // sets the table of the single view view.Table = null; // lets tune some view settings // set the number of first columns to be printed on all pages view.PageInfo.PageViewSettings.FirstColumnsCount = 4; // set a value indicating whether to print a specified number of first columns on all pages view.PageInfo.PageViewSettings.PrintFirstColumnsCountOnAllPages = true; // add the view to the our project project.Views.Add(view); // lets check some properties of the newly added view // print the unique identifier of a view Console.WriteLine("View Uid: " + view.Uid); // print the screen type for the single view Console.WriteLine("View Screen: " + view.Screen); Console.WriteLine("View Type: " + view.Type); Console.WriteLine("Parent Project of the view: " + view.ParentProject.Get(Prj.Name)); // ExEnd:WorkWithView }
public void WorkWithTimescaleTier() { // ExStart:WorkWithTimescaleTier // ExFor: GanttChartView // ExFor: GanttChartView.#ctor // ExFor: GanttChartView.TopTimescaleTier // ExFor: GanttChartView.MiddleTimescaleTier // ExFor: GanttChartView.BottomTimescaleTier // ExFor: SaveOptions.Timescale // ExSummary: Shows how to modify timescale tiers. var project = new Project(); // Init Gantt Chart View var view = new GanttChartView { TopTimescaleTier = new TimescaleTier(), MiddleTimescaleTier = new TimescaleTier(), BottomTimescaleTier = new TimescaleTier() }; // set Time Scale count view.TopTimescaleTier.Count = 2; view.TopTimescaleTier.Unit = TimescaleUnit.Quarters; view.TopTimescaleTier.Label = DateLabel.QuarterQQyy; view.TopTimescaleTier.ShowTicks = false; view.MiddleTimescaleTier.Count = 2; view.MiddleTimescaleTier.Unit = TimescaleUnit.Weeks; view.MiddleTimescaleTier.Label = DateLabel.WeekDddDd; view.MiddleTimescaleTier.ShowTicks = false; view.BottomTimescaleTier.Unit = TimescaleUnit.Days; view.BottomTimescaleTier.Label = DateLabel.DayDdd; view.BottomTimescaleTier.Count = 2; view.BottomTimescaleTier.ShowTicks = false; // add Gantt Chart View to project project.Views.Add(view); // add some test data to project var task1 = project.RootTask.Children.Add("Task 1"); var task2 = project.RootTask.Children.Add("Task 2"); task1.Set(Tsk.Duration, task1.ParentProject.GetDuration(24, TimeUnitType.Hour)); task2.Set(Tsk.Duration, task1.ParentProject.GetDuration(40, TimeUnitType.Hour)); // Use 'Timescale.DefinedInView' option to render timescales using timescale settings which we have set (view.TopTimescaleTier, view.MiddleTimescaleTier, view.BottomTimescaleTier). var pdfSaveOptions = new PdfSaveOptions { Timescale = Timescale.DefinedInView, StartDate = DateTime.Now.AddDays(-30), EndDate = DateTime.Now.AddDays(30) }; project.Save(OutDir + "WorkWithTimescaleTier_out.pdf", pdfSaveOptions); // ExEnd:WorkWithTimescaleTier }
public void DeleteItemButton_Click(object sender, EventArgs e) { var item = GanttChartView.SelectedItem; if (item == null) { return; } GanttChartView.RemoveItem(item); }
public void MoveItemUpImageButon_Click(object sender, ImageClickEventArgs e) { var item = GanttChartView.SelectedItem; if (item == null) { return; } GanttChartView.MoveItemUp(item, true, true); }
// Define user command methods. public void AddNewItemButton_Click(object sender, EventArgs e) { var item = new GanttChartItem { Content = "New task", Start = new DateTime(year, month, 2, 8, 0, 0), Finish = new DateTime(year, month, 4, 16, 0, 0) }; GanttChartView.AddItem(item); GanttChartView.SelectedItem = item; GanttChartView.ScrollTo(item); GanttChartView.ScrollTo(new DateTime(year, month, 1)); }
public void DecreaseItemIndentationButton_Click(object sender, EventArgs e) { var item = GanttChartView.SelectedItem; if (item == null) { return; } GanttChartView.DecreaseItemIndentation(item); GanttChartView.ScrollTo(item); }
// Control area commands. private void SetColorButton_Click(object sender, RoutedEventArgs e) { GanttChartItem item1 = ScheduleChartView.Items[0].GanttChartItems[1]; GanttChartView.SetStandardBarFill(item1, Resources["CustomStandardBarFill"] as Brush); GanttChartView.SetStandardBarStroke(item1, Resources["CustomStandardBarStroke"] as Brush); GanttChartItem item2 = ScheduleChartView.Items[1].GanttChartItems[0]; GanttChartView.SetStandardBarFill(item2, Resources["CustomStandardBarFill"] as Brush); GanttChartView.SetStandardBarStroke(item2, Resources["CustomStandardBarStroke"] as Brush); }
public void ShowNetworkDiagramButton_Click(object sender, EventArgs e) { NetworkDiagramViewContainer.Visible = true; GanttChartViewContainer.Style[HtmlTextWriterStyle.Display] = "none"; // Initialize Network Diagram. var items = GanttChartView.GetNetworkDiagramItems(); NetworkDiagramView.Items = items; NetworkDiagramView.InitializingClientCode = @" initializePertChartTheme(control.settings, theme); initializePertChartTemplates(control.settings, theme)"; }
private void SetCriticalPathHighlighting(GanttChartItem item, bool isHighlighted) { if (!item.IsMilestone) { GanttChartView.SetStandardBarFill(item, isHighlighted ? Resources["CustomStandardBarFill"] as Brush : GanttChartDataGrid.StandardBarFill); GanttChartView.SetStandardBarStroke(item, isHighlighted ? Resources["CustomStandardBarStroke"] as Brush : GanttChartDataGrid.StandardBarStroke); } else { GanttChartView.SetMilestoneBarFill(item, isHighlighted ? Resources["CustomStandardBarFill"] as Brush : GanttChartDataGrid.MilestoneBarFill); GanttChartView.SetMilestoneBarStroke(item, isHighlighted ? Resources["CustomStandardBarStroke"] as Brush : GanttChartDataGrid.MilestoneBarStroke); } }
public void ShowLoadChartButton_Click(object sender, EventArgs e) { LoadChartViewContainer.Visible = true; GanttChartViewContainer.Style[HtmlTextWriterStyle.Display] = "none"; // Initialize Load Chart. var items = GanttChartView.GetLoadChartItems(); LoadChartView.Items = items; LoadChartView.CurrentTime = new DateTime(year, month, 2, 12, 0, 0); LoadChartView.InitializingClientCode = @" initializeLoadChartTheme(control.settings, theme);"; }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:ReadCustomBarStyle //ExFor: GanttChartView.CustomBarStyles //ExSummary: Shows how to read custom bar styles of Gantt Chart project view. Project project = new Project(dataDir + "CustomBarStyle.mpp"); GanttChartView view = (GanttChartView)project.DefaultView; Console.WriteLine("Custom bar styles count: {0}", view.CustomBarStyles.Count); GanttBarStyle style1 = view.CustomBarStyles[0]; Console.WriteLine("Style1.LeftField is TaskDurationText : {0}", style1.LeftField.Equals(Field.TaskDurationText)); Console.WriteLine("Style1.RightField is TaskResourceNames : {0}", style1.RightField.Equals(Field.TaskResourceNames)); Console.WriteLine("Style1.TopField is TaskACWP: {0}", style1.TopField.Equals(Field.TaskACWP)); Console.WriteLine("Style1.BottomField is Undefined : {0}", style1.BottomField.Equals(Field.Undefined)); Console.WriteLine("Style1.InsideField is Undefined : {0}", style1.InsideField.Equals(Field.Undefined)); GanttBarStyle style2 = view.CustomBarStyles[1]; Console.WriteLine("Style2.LeftField is TaskActualWork : {0}", style2.LeftField.Equals(Field.TaskActualWork)); Console.WriteLine("Style2.RightField is TaskActualCost : {0}", style2.RightField.Equals(Field.TaskActualCost)); Console.WriteLine("Style2.TopField is Undefined : {0}", style2.TopField.Equals(Field.Undefined)); Console.WriteLine("Style2.BottomField is Undefined : {0}", style2.BottomField.Equals(Field.Undefined)); Console.WriteLine("Style2.InsideField is Undefined : {0}", style2.InsideField.Equals(Field.Undefined)); GanttBarStyle style3 = view.CustomBarStyles[2]; Console.WriteLine("Style3.LeftField is TaskPercentComplete : {0}", style3.LeftField.Equals(Field.TaskPercentComplete)); Console.WriteLine("Style3.RightField is TaskPercentWorkComplete : {0}", style3.RightField.Equals(Field.TaskPercentWorkComplete)); Console.WriteLine("Style3.TopField is Field.TaskActive : {0}", style3.TopField.Equals(Field.TaskActive)); Console.WriteLine("Style3.BottomField is TaskActualCost : {0}", style3.BottomField.Equals(Field.TaskActualCost)); Console.WriteLine("Style3.InsideField is Field.TaskActualDuration : {0}", style3.InsideField.Equals(Field.TaskActualDuration)); Console.WriteLine("Style3.StartShape is HouseDown : {0}", style3.StartShape.Equals(GanttBarEndShape.HouseDown)); Console.WriteLine("Style3.StartShapeType is Framed : {0}", style3.StartShapeType.Equals(GanttBarType.Framed)); Console.WriteLine("Style3.StartShapeColor is Red : {0}", style3.StartShapeColor.Equals(Color.FromArgb(Color.Red.ToArgb()))); Console.WriteLine("Style3.EndShape is CircleDiamond : {0}", style3.EndShape.Equals(GanttBarEndShape.CircleDiamond)); Console.WriteLine("Style3.EndShapeType is Solid : {0}", style3.EndShapeType.Equals(GanttBarType.Solid)); Console.WriteLine("Style3.EndShapeColor is Yellow : {0}", style3.EndShapeColor.Equals(Color.FromArgb(Color.Yellow.ToArgb()))); Console.WriteLine("Style3.MiddleShape is RectangleTop : {0}", style3.MiddleShape.Equals(GanttBarMiddleShape.RectangleTop)); Console.WriteLine("Style3.MiddleFillPattern is SolidFill : {0}", style3.MiddleFillPattern.Equals(GanttBarFillPattern.SolidFill)); Console.WriteLine("Style3.EndShapeColor is Red : {0}", style3.MiddleShapeColor.Equals(Color.FromArgb(Color.Red.ToArgb()))); //ExEnd:ReadCustomBarStyle }
public void InsertNewItemButton_Click(object sender, EventArgs e) { if (GanttChartView.SelectedItem == null) { return; } var item = new GanttChartItem { Content = "New task", Start = new DateTime(year, month, 2, 8, 0, 0), Finish = new DateTime(year, month, 4, 16, 0, 0) }; GanttChartView.InsertItem(GanttChartView.SelectedIndex, item); GanttChartView.SelectedItem = item; GanttChartView.ScrollTo(item); GanttChartView.ScrollTo(new DateTime(year, month, 1)); }
// Clear items in case they were previously critical, and set up red as bar stroke and fill properties for current critical items in the project. public void InitializeCritialPathButton_Click(object sender, EventArgs e) { foreach (GanttChartItem item in GanttChartView.Items) { item.BarStroke = null; item.BarFill = null; item.CompletedBarFill = null; } foreach (var item in GanttChartView.GetCriticalItems()) { item.BarStroke = Color.Red; item.BarFill = Color.Red; item.CompletedBarFill = Color.DarkRed; } }
private void Thumb_DragStarted(object sender, DragStartedEventArgs e) { GanttChartItem dataContext = base.DataContext as GanttChartItem; if (dataContext != null) { GanttChartView ganttChartView = dataContext.GanttChartView as GanttChartView; if (ganttChartView != null) { this.originalHorizontalPosition = e.HorizontalOffset; this.horizontalChange = 0.0; this.originalStartPosition = ganttChartView.GetPosition(dataContext.Start); this.originalFinishPositionDifference = ganttChartView.GetPosition(dataContext.Finish) - this.originalStartPosition; this.originalCompletedFinishPositionDifference = ganttChartView.GetPosition(dataContext.CompletedFinish) - this.originalStartPosition; } } }
private void ExportImageButton_Click(object sender, RoutedEventArgs e) { GanttChartView.Export((Action) delegate { SaveFileDialog saveFileDialog = new SaveFileDialog { Title = "Export Image To", Filter = "PNG image files|*.png" }; if (saveFileDialog.ShowDialog() != true) { return; } BitmapSource bitmapSource = GanttChartView.GetExportBitmapSource(96 * 2); using (Stream stream = saveFileDialog.OpenFile()) { PngBitmapEncoder pngBitmapEncoder = new PngBitmapEncoder(); pngBitmapEncoder.Frames.Add(BitmapFrame.Create(bitmapSource)); pngBitmapEncoder.Save(stream); } }); }
public static void Run() { // ExStart:CustomizeTimescaleTierLabels // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingCreatedProject(); Project project = new Project(dataDir + "Project5.mpp"); // Here is just some test data project.TaskLinks.Add(project.RootTask.Children.Add("Task 1"), project.RootTask.Children.Add("Task 2")); GanttChartView view = (GanttChartView)project.DefaultView; // This code is added for better visualization view.MiddleTimescaleTier.Unit = TimescaleUnit.Months; project.Set(Prj.TimescaleStart, new DateTime(2012, 8, 6)); // Customize middle tier dates view.MiddleTimescaleTier.DateTimeConverter = date => new[] { "Янв.", "Фев.", "Мар.", "Апр.", "Май", "Июнь", "Июль", "Авг.", "Сен.", "Окт.", "Ноя.", "Дек." }[date.Month - 1]; // See the result in the attached screenshot project.Save(dataDir + "Result_out.pdf", SaveFileFormat.PDF); // ExEnd:CustomizeTimescaleTierLabels }
private void SetColorButton_Click(object sender, RoutedEventArgs e) { List <ScheduleChartItem> items = new List <ScheduleChartItem>(); foreach (ScheduleChartItem item in ScheduleChartDataGrid.GetSelectedItems()) { items.Add(item); } if (items.Count <= 0) { MessageBox.Show("Cannot set a custom bar color to the selected item(s) as the selection is empty; select an item first.", "Information", MessageBoxButton.OK); return; } foreach (ScheduleChartItem item in items) { foreach (GanttChartItem ganttChartItem in item.GanttChartItems) { GanttChartView.SetStandardBarFill(ganttChartItem, Resources["CustomStandardBarFill"] as Brush); GanttChartView.SetStandardBarStroke(ganttChartItem, Resources["CustomStandardBarStroke"] as Brush); } } }
public static void Run() { // ExStart:SetTimeScaleCount // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingCreatedProject(); Project project = new Project(); GanttChartView view = new GanttChartView(); view.BottomTimescaleTier.Count = 2; view.BottomTimescaleTier.ShowTicks = false; // Tick lines check box in MSP view.MiddleTimescaleTier.Count = 2; view.MiddleTimescaleTier.ShowTicks = false; project.Views.Add(view); // Add some test data to project Task task1 = project.RootTask.Children.Add("Task 1"); Task task2 = project.RootTask.Children.Add("Task 2"); task1.Set(Tsk.Duration, task1.ParentProject.GetDuration(24, TimeUnitType.Hour)); task2.Set(Tsk.Duration, task1.ParentProject.GetDuration(40, TimeUnitType.Hour)); project.Save(dataDir + "SetTimeScaleCount_out.pdf", SaveFileFormat.PDF); // Result is in attached screenshot // ExEnd:SetTimeScaleCount }
/// <summary> /// Détermine si un lien peut être ajouté. /// Cette implémentation correspond aux vérifications par défaut du contrôle. /// </summary> /// <param name="item">L'élément.</param> /// <param name="predecessor">Le prédécesseur.</param> /// <returns><c>true</c> si le lien peut être ajouté.</returns> private static bool DefaultDependencyCreationValidatorProvider(GanttChartItem item, GanttChartItem predecessor) { GanttChartView ganttChartView = item.GanttChartView as GanttChartView; if (ganttChartView == null || predecessor.GanttChartView != ganttChartView) { return(false); } GanttChartItemCollection managedItems = ganttChartView.ManagedItems; if (managedItems == null) { return(false); } return (predecessor != item && !managedItems.GetAllChildren(predecessor).Contains(item) && !managedItems.GetAllChildren(item).Contains(predecessor) && !predecessor.Predecessors.Any(p => (p.Item == item)) && !item.Predecessors.Any(p => (p.Item == predecessor))); }
//ExStart:ImplementCustomBarStyleWriting //ExFor: GanttChartView.CustomBarStyles //ExSummary: Shows how to set custom bar styles of Gantt Chart project view. private static void ImplementCustomBarStyle(string dataDir) { try { Project project = new Project(dataDir + "Blank2010.mpp"); project.RootTask.Children.Add("Task"); GanttChartView view = (GanttChartView)project.DefaultView; GanttBarStyle custom = GetCustomBarStyle(); // Add the custom bar style to the custom bar collection of the project view view.CustomBarStyles.Add(custom); MPPSaveOptions options = new MPPSaveOptions(); options.WriteViewData = true; project.Save(dataDir + "ImplementCustomBarStyleWriting_out.mpp", options); } catch (NotSupportedException ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx."); } }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:CustomizeTimescaleTierLabels Project project = new Project(dataDir + "Project5.mpp"); // Add task links project.TaskLinks.Add(project.RootTask.Children.Add("Task 1"), project.RootTask.Children.Add("Task 2")); GanttChartView view = (GanttChartView)project.DefaultView; // This code is added for better visualization view.MiddleTimescaleTier.Unit = TimescaleUnit.Months; project.Set(Prj.TimescaleStart, new DateTime(2012, 8, 6)); // Customize middle tier dates view.MiddleTimescaleTier.DateTimeConverter = date => new[] { "Янв.", "Фев.", "Мар.", "Апр.", "Май", "Июнь", "Июль", "Авг.", "Сен.", "Окт.", "Ноя.", "Дек." }[date.Month - 1]; project.Save(dataDir + "CustomizeTimescaleTierLabels_out.pdf", SaveFileFormat.PDF); //ExEnd:CustomizeTimescaleTierLabels }
private void SetColorButton_Click(object sender, RoutedEventArgs e) { List <GanttChartItem> items = new List <GanttChartItem>(); foreach (GanttChartItem item in GanttChartDataGrid.GetSelectedItems()) { items.Add(item); } if (items.Count <= 0) { MessageBox.Show("Cannot set a custom bar color to the selected item(s) as the selection is empty; select an item first.", "Information", MessageBoxButton.OK); return; } foreach (GanttChartItem item in items) { GanttChartView.SetStandardBarFill(item, Resources["CustomStandardBarFill"] as Brush); GanttChartView.SetStandardBarStroke(item, Resources["CustomStandardBarStroke"] as Brush); if (item.HasChildren || item.IsMilestone) { MessageBox.Show(string.Format("The custom bar color was set to {0}, but its appearance won't change until it becomes a standard task (currently it is a {1} task).", item, item.HasChildren ? "summary" : "milestone"), "Information", MessageBoxButton.OK); continue; } } }
private void PrintButton_Click(object sender, RoutedEventArgs e) { GanttChartView.Print("GanttChartView Sample Document"); }
public void LoadProjectXmlSubmitButton_Click(object sender, EventArgs e) { GanttChartView.LoadProjectXml(LoadProjectXmlFileUpload.FileContent); LoadProjectXmlPanel.Visible = false; }
public void SaveProjectXmlButton_Click(object sender, EventArgs e) { Session["DownloadContent"] = GanttChartView.GetProjectXml(); ScriptManager.RegisterClientScriptBlock(this, typeof(Index), "Download", "window.open('Download.aspx?ContentType=text/xml&Filename=Project.xml', '_blank');", true); }