private void Step() { ViewFactory factory = new ViewFactory(); ViewInfrastructure infrastructure = factory.Create(); infrastructure.View.DataContext = infrastructure.ViewModel; infrastructure.View.ShowsNavigationUI(); }
/// <summary> /// Start up /// </summary> /// <param name="e">arguments</param> protected override async void OnStartup(StartupEventArgs e) { #region Catch All Unhandled Exceptions // Following code found on stackoverflow.com // http://stackoverflow.com/questions/10202987/in-c-sharp-how-to-collect-stack-trace-of-program-crash AppDomain currentDomain = default; currentDomain = AppDomain.CurrentDomain; // Handler for unhandled exceptions. currentDomain.UnhandledException += GlobalUnhandledExceptionHandler; // Handler for exceptions in thread behind forms. Current.DispatcherUnhandledException += GlobalThreadExceptionHandler; #endregion #region Create LocalApplication Folders. if (!Directory.Exists(MyCommons.LogFileFolderPath)) { Directory.CreateDirectory(MyCommons.LogFileFolderPath); } if (!Directory.Exists(MyCommons.CrashFileFolderPath)) { Directory.CreateDirectory(MyCommons.CrashFileFolderPath); } #endregion #region Error Logging. //// Trace is empty. //MyCommons.isTraceEmpty = true; //// Add textwriter for console. //TextWriterTraceListener consoleOut = // new TextWriterTraceListener(System.Console.Out); //Debug.Listeners.Add(consoleOut); //TextWriterTraceListener fileOut = // new TextWriterTraceListener(MyCommons.CrashFileNameWithPath);//File.CreateText(MyCommons.CrashFileNameWithPath)); //Debug.Listeners.Add(fileOut); // Set the Trace to track errors. // moving all tracing to the ErrorHandler module. // ErrorHandler.Tracer(); #endregion #region Application Starts Here. base.OnStartup(e); //// Verify none of the Omicron modules running, //// without it unexpected behaviors would occur. DispatchService.Invoke(() => { IStartProcessInterface spi = new ProcessFiles(); spi.KillOmicronProcesses(); }); ViewFactory factory = new ViewFactory(); ViewInfrastructure infrastructure = factory.Create(); infrastructure.View.DataContext = infrastructure.ViewModel; #if DEBUG MyCommons.MyViewModel.ReplaceWithTextBoxText = MyResources.Strings_Debug_TextBoxReplace; MyCommons.MyViewModel.FindWhatTextBoxText = MyResources.Strings_Debug_TextBoxFind; #endif MyCommons.MyViewModel.FileSideCoverText = MyResources.Strings_FormStartTest; MyCommons.MyViewModel.ModuleSideCoverText = MyResources.Strings_FormStartModuleTest; MyCommons.MyViewModel.Editable = true; // check for the updates await Task.Run(async() => { // log application update message Debug.WriteLine("Checking for updates", "Informative"); // await for application update await CheckForUpdates(); }); infrastructure.View.Show(); #endregion }