public void Launch() { if (DeckPath == null) return; try { Deck = new MetaDeck(DeckPath); var win = new DeckBuilderWindow(Deck,true); Application.Current.MainWindow = win; win.Show(); } catch (UserMessageException e) { TopMostMessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk); this.Shutdown = true; } }
internal static void Start() { Application.Current.MainWindow = new Window(); KillOtherOctgn(); bool isUpdate = RunUpdateChecker(); if (isUpdate) { KillOtherOctgn(true); UpdateManager.Instance.UpdateAndRestart(); return; } Log.Info("Ping back"); System.Threading.Tasks.Task.Factory.StartNew(pingOB); bool tableOnlyFailed = false; int? hostport = null; Guid? gameid = null; var os = new Mono.Options.OptionSet() { { "t|table", x => TableOnly = true }, { "g|game=",x=> gameid=Guid.Parse(x)}, { "d|deck",x=>DeckEditorOnly = true} }; try { os.Parse(Environment.GetCommandLineArgs()); } catch (Exception e) { Log.Warn("Parse args exception: " +String.Join(",",Environment.GetCommandLineArgs()),e); } if (TableOnly) { try { new GameTableLauncher().Launch(hostport,gameid); } catch (Exception e) { Log.Warn("Couldn't host/join table mode",e); tableOnlyFailed = true; Program.Exit(); } } if (DeckEditorOnly) { var win = new DeckBuilderWindow(); Application.Current.MainWindow = win; win.Show(); } if ((!TableOnly || tableOnlyFailed) && !DeckEditorOnly) { Log.Info("Creating main window..."); WindowManager.Main = new Main(); Log.Info("Main window Created, Launching it."); Application.Current.MainWindow = WindowManager.Main; Log.Info("Main window set."); Log.Info("Launching Main Window"); WindowManager.Main.Show(); Log.Info("Main Window Launched"); } }