Jawab membuat aplikasi login windows phone.

  • 18 Agustus 2012 10:06
     
     

    namespace login
    {
        public partial class MainPage : PhoneApplicationPage
        {



    string str2;
            string username = "duddy";
            string password = "1234";
            string str1;
            // Constructor
            public MainPage()
            {
                InitializeComponent();


            }

            private void button1_Click(object sender, RoutedEventArgs e)
            {
                   IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();
                // Create a new folder and call it "MyFolder".
                myStore.CreateDirectory("MyFolder");
                // Specify the file path and options.
                using (var isoFileStream = new IsolatedStorageFileStream("MyFolder\\myFile.txt", FileMode.OpenOrCreate, FileAccess.Write, myStore))
                {
                    //Write the data
                    using (var isoFileWriter = new StreamWriter(isoFileStream))
                    {
                        isoFileWriter.WriteLine(password);
                        isoFileWriter.WriteLine(username);
                    }
                }
               try
                 {
                    // Specify the file path and options.
                    using (var isoFileStream = new IsolatedStorageFileStream("MyFolder\\myFile.txt", FileMode.Open, myStore))
                    {
                        // Read the data.
                        using (var isoFileReader = new StreamReader(isoFileStream))
                        {
                            str1 = isoFileReader.ReadLine();
                            str2 = isoFileReader.ReadLine();
                            if ((str1 == passwordBox1.Password) && (str2 == textBox1.Text))
                            {

                NavigationService.Navigate(new Uri("/form/PanoramaPage1.xaml", UriKind.Relative));
                            }
                            else
                            {
                                passwordBox1.Focus();
                            }
                        }
                    }
                 }
             catch
               {
                 // Handle the case when the user attempts to click the Read button first.

               }  
            }
        }
    }

    yng saya tanyakan membuat page setting bertujuan untuk add dan delete user.

                                                                   

Semua Balasan