private void GlobalPopulate(MainWindow main, string AccessToken, string username) { #region setting variables this.MainView = main; this.AccessToken = AccessToken; this.User = username; StudentInfoHandler.ACCESS_TOKEN = this.AccessToken; NotificationLogic.ACCESS_TOKEN = this.AccessToken; #endregion InitializeComponent(); #region notification Setup ResizeMainWindowToOriginal(); notifyDev = new NotificationDevelopment(); notifyDev.MainView = this.MainView; notifyDev.NotificationSetup(); #endregion #region Important windows DE = new DistractionEliminator(this); assignment = new AssignmentWindow(); #endregion #region Timers notifyTimer = new NotificationTimer(this); notifyTimer.StartTimer(); NotificationLogic.currentList = currentAssignmentsJson; MasterCalendar.IsTodayHighlighted = true; #endregion //Methods of importance #region API Data setup Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { await RetrieveData(); ConvertJsonToObservable(); CalendarAssignmentDate(); PopulateClassComboBox(); })); //ProcessRing.IsActive = false; OnStartUp = false; #endregion }
// restores all savestate data and replaces instance vars accordingly public void LoadPrefs() { if (PlayerPrefs.HasKey("firststart")) { intro.SetActive(false); user = new User(PlayerPrefs.GetString("user_gender"), PlayerPrefs.GetInt("user_age"), PlayerPrefs.GetInt("user_height"), PlayerPrefs.GetInt("user_weight"), PlayerPrefs.GetInt("user_lvl"), PlayerPrefs.GetInt("user_totalXP")); AddXP(0); //add 0 XP to restore progressbar position lvlLabel.text = "[Level " + user.lvl + "]"; //deserialize json-string into workoutHistory-dict and restore it var dWorkoutHistory = JsonConvert.DeserializeObject <Dictionary <DateTime, List <WorkoutSession> > >(PlayerPrefs.GetString("workoutHistory")); workoutHistory = dWorkoutHistory; Color mainColor = PlayerPrefsX.GetColor("mainColor"); Color bgColor = PlayerPrefsX.GetColor("bgColor"); GameObject.FindGameObjectWithTag("Camera").GetComponent <Camera>().backgroundColor = bgColor; GameObject[] bgos = GameObject.FindGameObjectsWithTag("BGColor"); foreach (GameObject go in bgos) { go.GetComponent <UnityEngine.UI.Image>().color = bgColor; } GameObject[] gos = GameObject.FindGameObjectsWithTag("Header"); foreach (GameObject go in gos) { go.GetComponent <UnityEngine.UI.Image>().color = mainColor; } mainCol = mainColor; bgCol = bgColor; NotificationTimer.h = PlayerPrefs.GetInt("notification_h"); NotificationTimer.m = PlayerPrefs.GetInt("notification_m"); NotificationTimer.SetupLocalNotificationsOnReboot(NotificationTimer.h, NotificationTimer.m, 7); //unlock all currently unlocked rewards again LevelRewards.UnlockLevelRewards(); } else { intro.SetActive(true); } }
private void Form1_Load(object sender, EventArgs e) { ProjectTB.AutoCompleteCustomSource = GetProjectList(); NotificationTimer.Start(); pn.Click += Pn_Click; }