Example #1
0
        /*  private void button1_Click_1(object sender, EventArgs e)
         * {
         *    Average avg = new Average();
         *    LoadForm loadstats = new LoadForm();
         *    loadstats.openstats();
         * }
         */
        private void DarkThemeSwitch_CheckedChanged(object sender, EventArgs e)
        {
            FilePrep     prep = new FilePrep();
            IHashService hash;

            HashService.HashServiceClient client = new HashService.HashServiceClient();

            if (client != null)
            {
                hash = new HashNonLocal();
            }
            else
            {
                hash = new HashLocal();
            }

            if (DarkThemeSwitch.Checked)
            {
                BackgroundImage = Properties.Resources.dark1;
                Properties.Settings.Default.ThemeDark = true;
                Properties.Settings.Default.Save();
                prep.Write(Resource1.UserDataFile, user, hash);
            }
            else
            {
                BackgroundImage = Properties.Resources.dribbble;
                Properties.Settings.Default.ThemeDark = false;
                Properties.Settings.Default.Save();
                prep.Write(Resource1.UserDataFile, user, hash);
            }
        }
Example #2
0
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            FilePrep            prep  = new FilePrep();
            Lazy <List <User> > users = new Lazy <List <User> >(() => new List <User>(prep.ReadUser(Resource1.UserDataFile)));

            if (checkBox18.Checked)
            {
                if (PasswordTextBox.Text == RepeatPassword.Text)
                {
                    bool match = false;
                    User user  = new User(usernameTextBox.Text, PasswordTextBox.Text);
                    foreach (User u in users.Value)
                    {
                        if (u.Username.Equals(user.Username))
                        {
                            MessageBox.Show(Resource1.UsernameTaken);
                            match = true;
                            break;
                        }
                    }
                    if (!match)
                    {
                        IHashService hash;
                        HashService.HashServiceClient client = new HashService.HashServiceClient();

                        if (client != null)
                        {
                            hash = new HashNonLocal();
                        }
                        else
                        {
                            hash = new HashLocal();
                        }

                        prep.Write(Resource1.UserDataFile, user, hash);
                        MessageBox.Show(Resource1.UserCreated);
                        Close();
                    }
                }
                else
                {
                    MessageBox.Show(Resource1.PasswordsDontMatch);
                }
            }
            else
            {
                MessageBox.Show(Resource1.AgeDenied);
            }
        }
Example #3
0
        private void SaveToFile_Click(object sender, EventArgs e)
        {
            FilePrep filePrep = new FilePrep();

            filePrep.Write(Resource1.FileName, bars);
        }