コード例 #1
0
ファイル: Form2.cs プロジェクト: joniturunen/nelilaskin
 public Form2(string logFilePath)
 {
     InitializeComponent();
     SaveLabel.Hide();
     label2.Text = "Default logging file path is '" + logFilePath + "'.";
     ReadLog();
 }
コード例 #2
0
        private async void Save()
        {
            SaveLabel.Focusable = true;
            SaveLabel.Focus();
            SaveLabel.Focusable = false;

            var flag = true;

            if (Surname.Text.Equals(""))
            {
                BadSurname.BorderBrush = Brushes.Red;
                flag = false;
            }

            if (Name.Text.Equals(""))
            {
                BadName.BorderBrush = Brushes.Red;
                flag = false;
            }

            if (!flag)
            {
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            var _surname     = Surname.Text;
            var _name        = Name.Text;
            var _second_name = SecondName.Text;

            if (student != null)
            {
                if (_surname == student.Surname &&
                    _name == student.Name &&
                    _second_name == student.SecondName)
                {
                    this.Close(); return;
                }
            }

            repository.SaveStudent(new Student {
                StudentID  = _student,
                GroupID    = _group,
                Name       = _name,
                Surname    = _surname,
                SecondName = _second_name
            });

            await this.ShowMessageAsync(string.Empty, "Student saved.");

            GlobalVars.SaveFlag = true;
            this.Close();
        }
コード例 #3
0
ファイル: Form2.cs プロジェクト: joniturunen/nelilaskin
 private void SaveDebugSettings(object sender, EventArgs e)
 {
     if (!EnableLoggingBox.Checked)
     {
         Logger.WriteLog("User set the debugLevel to: False");
     }
     else
     {
         //Tila on muutettava ennen lokitusta
         Settings.Default["debugLevel"] = EnableLoggingBox.Checked;
         Logger.WriteLog("User set the debugLevel to: " + Settings.Default["debugLevel"]);
     }
     Settings.Default["debugLevel"] = EnableLoggingBox.Checked;
     Settings.Default.Save();
     SaveLabel.Show();
 }
コード例 #4
0
        /// <summary>
        /// Save the data from the model into the database
        /// </summary>
        private void SaveScreen()
        {
            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Saving Record...";
            SaveLabel.Refresh();

            Model.Save();

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Record Saved";

            //populate the tome list box
            TomeListBox.Items.Clear();
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }
        }
コード例 #5
0
        private void OnDuplicateRecordButtonClick(object sender, System.EventArgs e)
        {
            TomeModel duplicateModel;
            int       index, newIndex;

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Duplicating Record...";
            SaveLabel.Refresh();

            //save the current model (just in case the user has changed anything
            Model.Save();
            duplicateModel              = new TomeModel();
            duplicateModel.MinLevel     = Model.MinLevel;
            duplicateModel.ModifiedID   = Model.ModifiedID;
            duplicateModel.TomeBonus    = Model.TomeBonus;
            duplicateModel.TomeName     = Model.TomeName;
            duplicateModel.TomeLongName = Model.TomeLongName;
            duplicateModel.TomeType     = Model.TomeType;
            duplicateModel.Save();

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Record Duplicated";
            DataHasChanged      = false;

            //populate the tome list box
            TomeListBox.Items.Clear();
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }

            //select the last instance of this name
            index    = 0;
            newIndex = TomeListBox.FindStringExact(duplicateModel.TomeLongName);
            while (newIndex != ListBox.NoMatches && newIndex >= index)
            {
                index    = newIndex;
                newIndex = TomeListBox.FindStringExact(duplicateModel.TomeLongName, index);
            }
            TomeListBox.SelectedIndex = index;
        }
コード例 #6
0
        private async void Save()
        {
            SaveLabel.Focus();

            if (GroupNumber.Text.Equals(string.Empty))
            {
                GroupNumber.Focus();
                BadGroup.BorderBrush = Brushes.Red;
                BadLabel.Content     = "Заполните обязательные поля";
                BadLabel.Visibility  = Visibility.Visible;
                return;
            }

            var group_number = GroupNumber.Text;

            if (_group != 0)
            {
                if (group_number == this.group_number)
                {
                    this.Close(); return;
                }
            }

            if (repository.GetGroup(GroupNumber.Text) != null)
            {
                GroupNumber.Focus();
                BadLabel.Content    = "Группа с таким номером уже существует";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            repository.SaveGroup(new Group {
                GroupID     = _group,
                GroupNumber = group_number
            });

            await this.ShowMessageAsync(string.Empty, "Group saved.");

            GlobalVars.SaveFlag = true;
            this.Close();
        }
コード例 #7
0
    public void SetSliderLabel()
    {
        label.text = slider.value.ToString();
        if (Settings.playerSettings.useSettings)
        {
            switch (whichSlider)
            {
            case WhichSlider.RenderDst:
                Settings.playerSettings.renderDst = (int)slider.value;
                break;

            case WhichSlider.Speed:
                Settings.playerSettings.speed = (float)slider.value;
                break;

            case WhichSlider.TurnSpeed:
                Settings.playerSettings.turnSpeed = (float)slider.value;
                break;
            }

            SaveLabel.SetToSave();
        }
    }
コード例 #8
0
    public void SetTheColor(Color colorInMenu)
    {
        switch (whichColor)
        {
        case WhichColor.PlayerColor:
            if (Settings.playerSettings.useSettings)
            {
                Settings.playerSettings.playerColor = colorInMenu;
                SaveLabel.SetToSave();
            }
            break;

        case WhichColor.ParticleColor:
            if (Settings.playerSettings.useSettings)
            {
                Settings.playerSettings.particleColor = colorInMenu;
                SaveLabel.SetToSave();
            }
            break;

        case WhichColor.Safezone:
            if (Settings.playerSettings.useSettings)
            {
                Settings.playerSettings.safezone = colorInMenu;
                SaveLabel.SetToSave();
            }
            break;

        case WhichColor.Killzone:
            if (Settings.playerSettings.useSettings)
            {
                Settings.playerSettings.killzone = colorInMenu;
                SaveLabel.SetToSave();
            }
            break;
        }
    }
コード例 #9
0
        /// <summary>
        /// Save the data from the model into the database
        /// </summary>
        private void SaveScreen()
        {
            int selected;

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Saving Record...";
            SaveLabel.Refresh();

            Model.Save();

            //Autogranted feats
            AutoGrantedFeatsPanel.UpdateMainRecordId(Model.Id);
            AutoGrantedFeatsPanel.SaveAutoGrantedFeats();
            DataHasChanged = false;

            //repopulate the class list (in case any of the names have changed or new ones added)
            selected = ClassListBox.SelectedIndex;
            ClassListBox.Items.Clear();
            ClassNames = ClassModel.GetNames(SortDisplayOrderRadioButton.Checked == true);
            foreach (string Name in ClassNames)
            {
                ClassListBox.Items.Add(Name);
            }
            ClassListBox.SelectedIndex = selected;

            //update the modification fields
            ModDateLabel.Text    = Model.LastUpdatedDate.ToString();
            ModVersionLabel.Text = Model.LastUpdatedVersion;

            //cache the name and abbreviation strings for later comparisons
            // (we have now updated the databse, so update these as well)
            DatabaseName         = Model.Name;
            DatabaseAbbreviation = Model.Abbreviation;

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Record Saved";
        }
コード例 #10
0
    public void ResetSliderLabel()
    {
        switch (whichSlider)
        {
        case WhichSlider.RenderDst:
            slider.value = (float)Settings.playerSettings.renderDst;
            label.text   = slider.value.ToString();
            SaveLabel.SetToSave();
            break;

        case WhichSlider.Speed:
            print("hi");
            slider.value = (float)Settings.playerSettings.speed;
            label.text   = slider.value.ToString();
            SaveLabel.SetToSave();
            break;

        case WhichSlider.TurnSpeed:
            slider.value = (float)Settings.playerSettings.turnSpeed;
            label.text   = slider.value.ToString();
            SaveLabel.SetToSave();
            break;
        }
    }
コード例 #11
0
        private async void SaveNewPassword()
        {
            SaveLabel.Focusable = true;
            SaveLabel.Focus();
            SaveLabel.Focusable = false;

            if (Password.IsEnabled)
            {
                this.Close();
            }

            var flag = true;

            if (NewPassword.Password.Equals(string.Empty))
            {
                flag = false;
                BadNewPassword.BorderBrush = Brushes.Red;
            }

            if (ConfirmPassword.Password.Equals(string.Empty))
            {
                flag = false;
                BadConfirmPassword.BorderBrush = Brushes.Red;
            }

            if (!flag)
            {
                BadLabel.Content    = "Заполните обязательные поля";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            if (NewPassword.Password != ConfirmPassword.Password)
            {
                NewPassword.Clear();
                ConfirmPassword.Clear();
                NewPassword.Focus();
                BadLabel.Content    = "Пароли не совпадают";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            if (NewPassword.Password == Password.Password)
            {
                NewPassword.Clear();
                ConfirmPassword.Clear();
                NewPassword.Focus();
                BadLabel.Content    = "Пароль уже используется";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            //rep.EditPass(NewPassword.Password);
            rep.GetPass = GlobalVars.GetHashCode(NewPassword.Password);
            // EncDecHelper.SetPassword(NewPassword.Password);


            await this.ShowMessageAsync(string.Empty, "Password has changed.");

            this.Close();
        }
コード例 #12
0
ファイル: Form2.cs プロジェクト: joniturunen/nelilaskin
 private void EnableLoggingBox_CheckedChanged(object sender, EventArgs e)
 {
     SaveLabel.Hide();
 }