private void logout_Click(object sender, RoutedEventArgs e) { isoStore.DeleteFile("PCGuardian/temp/loggedin.txt"); MyFunctions.deleteExplorer(); MyFunctions.blockfolder(isoStore, "PCGuardian/guest/blocked/1party"); MyFunctions.blockfolder(isoStore, "PCGuardian/guest/blocked/2party"); isoStore.Close(); this.NavigationService.Navigate(new startup()); }
private void logout_Click(object sender, RoutedEventArgs e) { // Block all guest user app MyFunctions.deleteExplorer(); MyFunctions.blockfolder(isoStore, "PCGuardian/guest/blocked/1party"); MyFunctions.blockfolder(isoStore, "PCGuardian/guest/blocked/2party"); isoStore.DeleteFile("PCGuardian/temp/loggedin.txt"); isoStore.Close(); Application.Current.Shutdown(); }
private void login_Click(object sender, RoutedEventArgs e) { String location = "PCGuardian/users/" + unametxt.Text; try { if (isoStore.DirectoryExists(location)) { location += "/passwd.txt"; using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(location, FileMode.Open, isoStore)) { using (StreamReader reader = new StreamReader(isoStream)) { String savedPasswd = reader.ReadLine(); if (savedPasswd == passtxt.Password) { // block and unblock apps isoStream.Close(); reader.Close(); using (IsolatedStorageFileStream isoStream3 = new IsolatedStorageFileStream("PCGuardian/temp/loggedin.txt", FileMode.Create, isoStore)) { using (StreamWriter writer3 = new StreamWriter(isoStream3)) { writer3.WriteLine(unametxt.Text); writer3.Close(); } isoStream3.Close(); } MyFunctions.deleteExplorer(); MyFunctions.blockfolder(isoStore, ("PCGuardian/users/" + unametxt.Text + "/blocked/1party")); MyFunctions.blockfolder(isoStore, ("PCGuardian/users/" + unametxt.Text + "/blocked/2party")); isoStore.Close(); this.NavigationService.Navigate(new userPortal()); } else { nomatch.Visibility = Visibility.Visible; } } } } else { nomatch.Visibility = Visibility.Visible; } } catch { MessageBox.Show("problem"); } }