Beispiel #1
0
        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();

            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");
        }