public static void process(XamlOptions options, string input) { if (!input.EndsWith(".xaml")) { Console.WriteLine("Input filenames must end in .xaml"); return; } if (Environment.Version.Major < 2 && options.Partial) { Console.WriteLine("This runtime version does not support partial classes"); return; } if (options.OutputFile == null) { options.OutputFile = input + ".out"; } ICodeGenerator generator = getGenerator(options.OutputLanguage); XmlTextReader xr = new XmlTextReader(input); try { string result = ParserToCode.Parse(xr, generator, options.Partial); TextWriter tw = new StreamWriter(options.OutputFile); tw.Write(result); tw.Close(); } catch (Exception ex) { Console.WriteLine("Line " + xr.LineNumber + ", Column " + xr.LinePosition); throw ex; } }
/// <summary> /// Registers services necessary for Xaml-based /// environments. /// </summary> /// <param name="config">CslaConfiguration object</param> /// <param name="options">XamlOptions action</param> /// <returns></returns> public static CslaOptions AddXaml(this CslaOptions config, Action <XamlOptions> options) { var xamlOptions = new XamlOptions(); options?.Invoke(xamlOptions); // use correct mode for raising PropertyChanged events ApplicationContext.PropertyChangedMode = ApplicationContext.PropertyChangedModes.Xaml; config.Services.TryAddTransient(typeof(ViewModel <>), typeof(ViewModel <>)); return(config); }
public static void Main(string[] args) { XamlOptions options = new XamlOptions(); options.ProcessArgs(args); if (options.RemainingArguments.Length != 1) { Console.WriteLine("Need exactly one input file"); return; } process(options, options.RemainingArguments[0]); }
/// <summary> /// Registers services necessary for Xaml-based /// environments. /// </summary> /// <param name="config">CslaConfiguration object</param> /// <param name="options">XamlOptions action</param> /// <returns></returns> public static ICslaConfiguration AddXaml(this ICslaConfiguration config, Action <XamlOptions> options) { var xamlOptions = new XamlOptions(); options?.Invoke(xamlOptions); // use correct mode for raising PropertyChanged events ConfigurationManager.AppSettings["CslaPropertyChangedMode"] = Csla.ApplicationContext.PropertyChangedModes.Xaml.ToString(); config.Services.TryAddTransient(typeof(ViewModel <>), typeof(ViewModel <>)); return(config); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // ExStart:RenderXAMLWithOptions Project project = new Project(dataDir + "Project2.mpp"); const string resultFile = "RenderXAMLWithOptions_out.xaml"; SaveOptions options = new XamlOptions(); options.FitContent = true; options.LegendOnEachPage = false; options.Timescale = Timescale.ThirdsOfMonths; project.Save(dataDir + resultFile, options); // ExEnd:RenderXAMLWithOptions }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // ExStart:RenderDifferentPresentationFormatsToXAML Project project = new Project(dataDir + "Project2.mpp"); PresentationFormat presentationFormat = PresentationFormat.GanttChart; string resultFile = "RenderDifferentPresentationFormatsToXAML_" + presentationFormat + "_out.xaml"; SaveOptions options = new XamlOptions(); options.PresentationFormat = presentationFormat; project.Save(dataDir + resultFile, options); // ExEnd:RenderDifferentPresentationFormatsToXAML }
public void RenderXAMLWithOptions() { // ExStart:RenderXAMLWithOptions // ExFor: XamlOptions // ExFor: XamlOptions.#ctor // ExSummary: Shows how to save a project in XAML format by using save options. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new XamlOptions(); options.FitContent = true; options.LegendOnEachPage = false; options.Timescale = Timescale.ThirdsOfMonths; project.Save(OutDir + "RenderXAMLWithOptions_out.xaml", options); // ExEnd:RenderXAMLWithOptions }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // ExStart:ChangeGanttBarsColorGradient Project project = new Project(dataDir + "Project2.mpp"); SaveOptions options = new XamlOptions(); options.UseGradientBrush = false; project.Save(dataDir + "ChangeGanttBarsColorGradient_Solid_out.xaml", options); options.UseGradientBrush = true; project.Save(dataDir + "ChangeGanttBarsColorGradient_Gradient_out.xaml", options); // ExEnd:ChangeGanttBarsColorGradient }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:RenderDifferentPresentationFormatsToXAML //ExFor: SaveOptions.PresentationFormat //ExSummary: Shows how to set the presentation format to be rendered to XAML output file. Project project = new Project(dataDir + "Project2.mpp"); SaveOptions options = new XamlOptions(); options.PresentationFormat = PresentationFormat.GanttChart; project.Save(dataDir + "RenderDifferentPresentationFormatsToXAML_out.xaml", options); //ExEnd:RenderDifferentPresentationFormatsToXAML }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:ChangeGanttBarsColorGradient //ExFor: SaveOptions.UseGradientBrush //ExSummary: shows how to set a value indicating whether gradient brush should be used when rendering Gantt Chart. Project project = new Project(dataDir + "Project2.mpp"); SaveOptions options = new XamlOptions(); options.UseGradientBrush = false; project.Save(dataDir + "ChangeGanttBarsColorGradient_Solid_out.xaml", options); options.UseGradientBrush = true; project.Save(dataDir + "ChangeGanttBarsColorGradient_Gradient_out.xaml", options); //ExEnd:ChangeGanttBarsColorGradient }
public void ChangeGanttBarsColorGradient() { // ExStart:ChangeGanttBarsColorGradient // ExFor: SaveOptions.UseGradientBrush // ExSummary: shows how to set a value indicating whether gradient brush should be used when rendering Gantt Chart. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new XamlOptions { UseGradientBrush = false }; project.Save(OutDir + "ChangeGanttBarsColorGradient_Solid_out.xaml", options); options.UseGradientBrush = true; project.Save(OutDir + "ChangeGanttBarsColorGradient_Gradient_out.xaml", options); // ExEnd:ChangeGanttBarsColorGradient }