コード例 #1
0
        private void button_EditPattern_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count == 1)
            {
                string fileName  = textBox_FileName.Text;
                string formating = textBox_Formating.Text;
                int    Event     = _selectionToStatus[comboBox_saveEvent.SelectedIndex];
                int    id        = dataGridView.SelectedRows[0].Index;

                if (string.IsNullOrWhiteSpace(fileName) || string.IsNullOrWhiteSpace(formating))
                {
                    UserError("Fill all fields first.");
                    return;
                }
                if (FileNameAlreadyExists(fileName, "", id))
                {
                    UserError(_errorFilenameExists);
                    return;
                }
                if (id == -1)
                {
                    UserError(_errorHorriblyWrong);
                }
                else
                {
                    lock (_patternDictionary)
                    {
                        _patternDictionary[id] = new FileFormating
                        {
                            Filename  = fileName,
                            Pattern   = formating,
                            SaveEvent = Event
                        };
                    }
                }
            }
        }
コード例 #2
0
        private void button_EditPattern_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count == 1)
            {
                string fileName = textBox_FileName.Text;
                string formating = textBox_Formating.Text;
                int Event = _selectionToStatus[comboBox_saveEvent.SelectedIndex];
                int id = dataGridView.SelectedRows[0].Index;

                if (string.IsNullOrWhiteSpace(fileName) || string.IsNullOrWhiteSpace(formating))
                {
                    UserError("Fill all fields first.");
                    return;
                }
                if (FileNameAlreadyExists(fileName, "", id))
                {
                    UserError(_errorFilenameExists);
                    return;
                }
                if (id == -1)
                    UserError(_errorHorriblyWrong);
                else
                {
                    lock (_patternDictionary)
                    {
                        _patternDictionary[id] = new FileFormating
                        {
                            Filename = fileName,
                            Pattern = formating,
                            SaveEvent = Event
                        };
                    }
                }
            }
        }