public override void ShowCruiseWizardDialog() { DAL tempfile = ApplicationController.GetNewOrUnfinishedCruise(); if (tempfile != null) { SaleDO sale; if (this.ShowWizardDialog(tempfile, out sale)) { var destPath = AskSavePath(sale); if (destPath == null) { return; } else { tempfile.Dispose(); if (System.IO.File.Exists(destPath)) { System.IO.File.Replace(tempfile.Path, destPath, null); } else { System.IO.File.Move(tempfile.Path, destPath); } this.ApplicationController.Database = new DAL(destPath); } this.ShowCruiseLandingLayout(); } else { tempfile.Dispose(); } } }
static void Main() { //just trying out an alternative to the default trace listener //System.Diagnostics.Trace.Listeners.Add( // new System.Diagnostics.XmlWriterTraceListener("CSMLog.xml") // ); /*side note about Trace Listeners: * Tracing is a feature built into .net applications to allow * applications to make logs and can be configured using the app.config * file. */ System.Diagnostics.Trace.TraceInformation("Application Started @{0}", DateTime.Now); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //read command line arguments var args = Environment.GetCommandLineArgs(); string dalPath = null; if (args.Length > 1) { dalPath = args[1]; } //Provide event handlers to catch any uncaught exceptions //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //FMSC.Utility.ErrorHandling.ErrorHandlers.SendToAddress = "*****@*****.**"; //AppDomain.CurrentDomain.UnhandledException += FMSC.Utility.ErrorHandling.ErrorHandlers.UnhandledException; //Application.ThreadException += FMSC.Utility.ErrorHandling.ErrorHandlers.ThreadException; //#if !DEBUG NBug.Settings.UIMode = NBug.Enums.UIMode.Full; NBug.Settings.StoragePath = NBug.Enums.StoragePath.WindowsTemp; NBug.Settings.Destinations.Add(new NBug.Core.Submission.Tracker.Redmine() { ApiKey = "6cf4343091c7509dbf27d6afd84a267189b9d3b9", CustomSubject = "CrashReport", Url = "http://fmsc-projects.herokuapp.com/projects/csm/", ProjectId = "csm", TrackerId = "5", PriorityId = "1", StatusId = "1" }); NBug.Settings.ReleaseMode = true;//only create error reports if debugger not attached NBug.Settings.StopReportingAfter = 60; AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException; Application.ThreadException += NBug.Handler.ThreadException; //#endif ApplicationControllerBase applicationController = new ApplicationController( new ViewModule(), new CruiseManagerWinformsModule()); if (dalPath != null) { applicationController.OpenFile(dalPath); } applicationController.Start(); applicationController.Dispose(); //WindowPresenter.Instance.Run(); //WindowPresenter.Instance.Dispose(); System.Diagnostics.Trace.TraceInformation("Application Ended @{0}", DateTime.Now); System.Diagnostics.Trace.Close(); }