Beispiel #1
0
 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");
            }
        }
        private void login_Click(object sender, RoutedEventArgs e)
        {
            String location = "PCGuardian/admin/uname.txt";

            using (IsolatedStorageFileStream isoStreamuname = new IsolatedStorageFileStream(location, FileMode.Open, isoStore))
            {
                using (StreamReader readeruname = new StreamReader(isoStreamuname))
                {
                    String saveduname = readeruname.ReadLine();
                    if (saveduname == unametxt.Text)
                    {
                        location = "PCGuardian/admin/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)
                                {
                                    reader.Close();
                                    isoStream.Close();
                                    readeruname.Close();
                                    isoStreamuname.Close();
                                    using (IsolatedStorageFileStream isoStream3 = new IsolatedStorageFileStream("PCGuardian/temp/loggedin.txt", FileMode.Create, isoStore))
                                    {
                                        using (StreamWriter writer3 = new StreamWriter(isoStream3))
                                        {
                                            writer3.WriteLine("admin");
                                            writer3.Close();
                                        }
                                        isoStream3.Close();
                                    }
                                    isoStore.Close();
                                    MyFunctions.deleteExplorer();
                                    this.NavigationService.Navigate(new adminPortal());
                                }
                                else
                                {
                                    nomatch.Visibility = Visibility.Visible;
                                }
                            }
                        }
                    }
                    else
                    {
                        nomatch.Visibility = Visibility.Visible;
                    }
                }
            }
        }
Beispiel #5
0
        private void confirm_Click(object sender, RoutedEventArgs e)
        {
            String location = "PCGuardian/admin/uname.txt";

            using (IsolatedStorageFileStream isoStreamuname = new IsolatedStorageFileStream(location, FileMode.Open, isoStore))
            {
                using (StreamReader readeruname = new StreamReader(isoStreamuname))
                {
                    String saveduname = readeruname.ReadLine();
                    if (saveduname == unametxt.Text)
                    {
                        location = "PCGuardian/admin/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)
                                {
                                    reader.Close();
                                    readeruname.Close();
                                    isoStreamuname.Close();
                                    isoStream.Close();
                                    MyFunctions.DeleteDirectoryRecursively(isoStore, "PCGuardian");
                                    isoStore.Close();
                                    MyFunctions.deleteExplorer();
                                    this.NavigationService.Navigate(new setup());
                                }
                                else
                                {
                                    nomatch.Visibility = Visibility.Visible;
                                }
                            }
                        }
                    }
                    else
                    {
                        nomatch.Visibility = Visibility.Visible;
                    }
                }
            }
        }