/// <summary> /// TODO: Comment /// </summary> public MainView() { InitializeComponent(); //TODO: Save path in configuration string configurationPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SecureVault", "settings", "configuration.dat"); ConfigurationHelper configHelper = new ConfigurationHelper(configurationPath); if (!configHelper.CheckConfiguration()) { ConfigurationPage configPage = new ConfigurationPage(); configPage.DataContext = new ConfigurationViewModel(new Configuration(), this.MainFrame); this.MainFrame.Navigate(configPage); } else { PasswordPage passwordPage = new PasswordPage(); passwordPage.DataContext = new PasswordViewModel(new Vault(), this.MainFrame); this.MainFrame.Navigate(passwordPage); } }
/// <summary> /// TODO: Comment /// </summary> public MainView() { InitializeComponent(); //TODO: Save path in configuration string configurationPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SecureVault", "settings", "configuration.dat"); ConfigurationHelper configHelper = new ConfigurationHelper(configurationPath); if (!configHelper.CheckConfiguration()) { ConfigurationPage configPage = new ConfigurationPage(); configPage.DataContext = new ConfigurationViewModel(new Configuration(), this.MainFrame); this.MainFrame.Navigate(configPage); } else { PasswordPage passwordPage = new PasswordPage(); passwordPage.DataContext = new PasswordViewModel(new Vault(), this.MainFrame); this.MainFrame.Navigate(passwordPage); } }
/// <summary> /// TODO: Comment /// </summary> public void SaveConfigurationExcecute() { string configurationPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SecureVault", "settings", "configuration.dat"); ConfigurationHelper configHelper = new ConfigurationHelper(configurationPath); HashHelper hashHelper = new HashHelper(); SecureStringHelper secureStringHelper = new SecureStringHelper(); if (String.IsNullOrWhiteSpace(secureStringHelper.SecureStringToString(this.MasterPassword)) || String.IsNullOrWhiteSpace(secureStringHelper.SecureStringToString(this.MasterPasswordConfirmation))) { this.Error = "Please set a Password"; return; } //Check if password and confirmation are equal if (secureStringHelper.SecureStringToString(this.MasterPassword).Equals(secureStringHelper.SecureStringToString(this.MasterPasswordConfirmation))) { //Create configuration file configHelper.CreateConfigurationFile(); //Save master password string passwordHash = hashHelper.ComputeHash(secureStringHelper.SecureStringToString(this.MasterPassword)); configHelper.SaveMasterPassword(passwordHash); //Navigate to PasswordPage PasswordPage passwordPage = new PasswordPage(); passwordPage.DataContext = new PasswordViewModel(new Vault(), this.MainFrame); this.MainFrame.Navigate(passwordPage); } else { this.Error = "Not equal"; } }