public MainWindow() { InitializeComponent(); // Create DefaultUser if it doesn't exist try { // Try loading default profile currentUserProfile = ProblemData.LoadUserData("DefaultUser" + ".xml"); // Check loaded profile for version if (currentUserProfile.clientVersion != clientVersion) { throw new Exception($"Loaded file (ver. {currentUserProfile.clientVersion}) has version mismatch with client (ver. {clientVersion})"); } } catch (System.IO.FileNotFoundException) { // Create new and save currentUserProfile = new UserProfile("DefaultUser", clientVersion); currentUserProfile.SaveUserData(); } // Greet the user HelloUser_TextBlock.Text = HelloUser_TextBlock.Text.Replace("[username]", currentUserProfile.userName); // Display the client version ClientVersion_TextBlock.Text = ClientVersion_TextBlock.Text.Replace("[version]", clientVersion); }