public void LoadSettings() { // TODO: Crap hack just to get it working if the file doesn't exist, for quick testing. if (File.Exists("settings.xml")) { var xmlSerial = new XmlSerializer(typeof(UserSettings)); var xmlReader = XmlReader.Create("settings.xml"); // TODO: Check file exists, file is deserializable etc settings = (UserSettings)xmlSerial.Deserialize(xmlReader); xmlReader.Close(); } else settings = new UserSettings(); }
// Position the Window in the bottom right of the main screen // Uses WorkingArea to avoid the taskbar if it's along the bottom or right. private void Window_Loaded(object sender, RoutedEventArgs e) { // TODO: Load Window position from settings Left = Screen.PrimaryScreen.WorkingArea.Right - Width; Top = Screen.PrimaryScreen.WorkingArea.Bottom - Height; var s = new SettingsManager(); s.LoadSettings(); settings = s.settings; currentTimerProgress = settings.PomodoroLength; UpdateDisplay(); }