예제 #1
0
        public void ProfileSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(NameBox.Text.Trim()) || String.IsNullOrEmpty(Agebox.Text.Trim())||(!Convert.ToBoolean(MaleCheck.IsChecked)&&!Convert.ToBoolean(FemaleCheck.IsChecked)))
            {

                MessageBox.Show("You gotta fill up stuff man!");
            }

            else
            {

                PersonData person = new PersonData();
                person.Name = NameBox.Text.Trim();
                person.Age = Agebox.Text.Trim();

                double age;

                double.TryParse(Agebox.Text.Trim(), out age);

                person.SetSex = Convert.ToBoolean(MaleCheck.IsChecked) ? PersonData.Sex.Male : PersonData.Sex.Female;

                Database database;

                if (!Database.DoesDatabaseExists("Data"))
                {
                    database = Database.CreateDatabase("Data");
                    database.CreateTable<PersonData>("login");
                    database.CreateTable<DataRow>("UserData");
                    database.Table<PersonData>("login").Add(person);
                    try
                    {
                        database.Save();

                    }
                    catch
                    {

                    }
                }
                NavigationService.Navigate(new Uri("/LetsSee.xaml", UriKind.Relative));

            }
        }
예제 #2
0
        public void ProfileSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(NameBox.Text.Trim()) || String.IsNullOrEmpty(Agebox.Text.Trim()) || (!Convert.ToBoolean(MaleCheck.IsChecked) && !Convert.ToBoolean(FemaleCheck.IsChecked)))
            {
                MessageBox.Show("You gotta fill up stuff man!");
            }

            else
            {
                PersonData person = new PersonData();
                person.Name = NameBox.Text.Trim();
                person.Age  = Agebox.Text.Trim();

                double age;

                double.TryParse(Agebox.Text.Trim(), out age);

                person.SetSex = Convert.ToBoolean(MaleCheck.IsChecked) ? PersonData.Sex.Male : PersonData.Sex.Female;


                Database database;

                if (!Database.DoesDatabaseExists("Data"))
                {
                    database = Database.CreateDatabase("Data");
                    database.CreateTable <PersonData>("login");
                    database.CreateTable <DataRow>("UserData");
                    database.Table <PersonData>("login").Add(person);
                    try
                    {
                        database.Save();
                    }
                    catch
                    {
                    }
                }
                NavigationService.Navigate(new Uri("/LetsSee.xaml", UriKind.Relative));
            }
        }