1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using FastReport;
- using FastReport.Utils;
- using System.Windows;
- namespace Designer
- {
- public partial class App : Application
- {
- private void Application_Startup(object sender, StartupEventArgs e)
- {
- this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
- Config.DesignerSettings.ShowInTaskbar = true;
- Config.DesignerSettings.EmbeddedPreview = true;
- Config.ReportSettings.ShowPerformance = true;
- #if NETCOREAPP
- // RoslynPad as a code editor (available in net6.0-windows target)
- FastReport.WPF.RoslynPad.SyntaxEditor.Register();
- #endif
- using (var report = new Report())
- {
- string fileName = "";
- bool preview = false;
-
- foreach (var arg in e.Args)
- {
- if (arg.IndexOf("/preview") != -1)
- {
- preview = true;
- }
- else if (arg.IndexOf("/savepath=") != -1)
- {
- int i = arg.IndexOf('=');
- string path = arg.Substring(i + 1).Trim('"');
- Config.SaveFolder = path;
- }
- else
- {
- fileName = arg;
- }
- }
- if (!string.IsNullOrEmpty(fileName))
- report.Load(fileName);
- if (preview)
- {
- //report.Prepare();
- //report.ShowPrepared();
- report.ShowAsync();
- }
- else
- {
- report.Design();
- }
- }
- this.Shutdown();
- }
- }
- }
|