private void OnStartup(object sender, StartupEventArgs e) { var v = Assembly.GetExecutingAssembly().GetName().Version; _version = $"TCC v{v.Major}.{v.Minor}.{v.Build}"; InitSplashScreen(); BaseDispatcher = Dispatcher.CurrentDispatcher; TccMessageBox.Create(); //Create it here in STA thread AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler; Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; TryDeleteUpdater(); SplashScreen.SetText("Checking for application updates..."); UpdateManager.CheckAppVersion(); SplashScreen.SetText("Checking for database updates..."); UpdateManager.CheckDatabaseVersion(); SplashScreen.SetText("Loading settings..."); SettingsManager.LoadWindowSettings(); SettingsManager.LoadSettings(); SplashScreen.SetText("Pre-loading databases..."); SessionManager.InitDatabases(string.IsNullOrEmpty(SettingsManager.LastRegion) ? "EU-EN" : SettingsManager.LastRegion == "EU" ? "EU-EN" : SettingsManager.LastRegion); SplashScreen.SetText("Initializing windows..."); WindowManager.Init(); FocusManager.FocusTimer.Start(); SplashScreen.SetText("Initializing Twitch connector..."); TwitchConnector.Instance.Init(); SplashScreen.SetText("Initializing packet processor..."); PacketProcessor.Init(); TeraSniffer.Instance.NewConnection += TeraSniffer_OnNewConnection; TeraSniffer.Instance.EndConnection += TeraSniffer_OnEndConnection; TeraSniffer.Instance.Enabled = true; SplashScreen.SetText("Starting"); SessionManager.CurrentPlayer.Class = Class.None; SessionManager.CurrentPlayer.Name = "player"; SessionManager.CurrentPlayer.PlayerId = 10; TimeManager.Instance.SetServerTimeZone(SettingsManager.LastRegion); ChatWindowManager.Instance.AddTccMessage(_version); SplashScreen.CloseWindowSafe(); UpdateManager.StartCheck(); //WindowManager.LfgListWindow.ShowWindow(); // var l = new Listing(); // l.LeaderId = 10; // l.Message = "SJG exp only"; // l.LeaderName = "Foglio"; // l.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher){PlayerId = 10, IsLeader = true, Online = true}); // l.Applicants.Add(new User(WindowManager.LfgListWindow.Dispatcher){PlayerId = 1, Name = "Applicant", Online = true, UserClass = Class.Priest}); // WindowManager.LfgListWindow.VM.Listings.Add(l); //var l = new List<User>(); //var r = new Random(); //for (uint i = 0; i < 30; i++) // GroupWindowViewModel.Instance.AddOrUpdateMember(new User(GroupWindowViewModel.Instance.GetDispatcher()) // { // Name = i.ToString(), // PlayerId = i, // ServerId = i, // EntityId = i, // UserClass = (Class)r.Next(0, 12) // }); //GroupWindowViewModel.Instance.SetRaid(true); //GroupWindowViewModel.Instance.SetNewLeader(10, "player"); }
//public static DebugWindow DebugWindow; private void OnStartup(object sender, StartupEventArgs e) { Loading = true; //#if DEBUG // DebugWindow = new DebugWindow(); // DebugWindow.Show(); //#endif var v = Assembly.GetExecutingAssembly().GetName().Version; _version = $"TCC v{v.Major}.{v.Minor}.{v.Build}"; InitSplashScreen(); BaseDispatcher = Dispatcher.CurrentDispatcher; TccMessageBox.Create(); //Create it here in STA thread #if !DEBUG AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler; #endif TryDeleteUpdater(); SplashScreen.SetText("Checking for application updates..."); UpdateManager.CheckAppVersion(); SplashScreen.SetText("Checking for database updates..."); UpdateManager.CheckDatabaseVersion(); SplashScreen.SetText("Loading settings..."); var sr = new SettingsReader(); sr.LoadWindowSettings(); sr.LoadSettings(); Process.GetCurrentProcess().PriorityClass = Settings.HighPriority ? ProcessPriorityClass.High : ProcessPriorityClass.Normal; if (Settings.ForceSoftwareRendering) { RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; } SplashScreen.SetText("Pre-loading databases..."); SessionManager.InitDatabases(string.IsNullOrEmpty(Settings.LastRegion) ? "EU-EN" : Settings.LastRegion == "EU" ? "EU-EN" : Settings.LastRegion); SplashScreen.SetText("Initializing windows..."); WindowManager.Init(); //SplashScreen.SetText("Initializing Twitch connector..."); //TwitchConnector.Instance.Init(); SplashScreen.SetText("Initializing packet processor..."); PacketProcessor.Init(); TeraSniffer.Instance.NewConnection += TeraSniffer_OnNewConnection; TeraSniffer.Instance.EndConnection += TeraSniffer_OnEndConnection; TeraSniffer.Instance.Enabled = true; WindowManager.FloatingButton.NotifyExtended("TCC", "Ready to connect.", NotificationType.Normal); SplashScreen.SetText("Starting"); SessionManager.CurrentPlayer.Class = Class.None; SessionManager.CurrentPlayer.Name = "player"; SessionManager.CurrentPlayer.EntityId = 10; TimeManager.Instance.SetServerTimeZone(Settings.LastRegion); ChatWindowManager.Instance.AddTccMessage(_version); SplashScreen.CloseWindowSafe(); UpdateManager.StartCheck(); if (Settings.LastRegion == "NA" || Settings.LastRegion == "") { WindowManager.FloatingButton.NotifyExtended("So long, and thanks for all the fish", ThankYou_mEME, NotificationType.Error, 15000); } if (Debug) { DebugStuff(); } Loading = false; }