Aspose.Tasks.Examples.CSharp.Articles.ImplementCustomBarStyleWriting.ImplementCustomBarSytle C# (CSharp) Method

ImplementCustomBarSytle() static private method

static private ImplementCustomBarSytle ( ) : void
return void
        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.");
            }
        }