private void OnOpenFileButtonClick(object sender, EventArgs e)
        {
            var selectedItem = Form.FileList.SelectedItem;

            if (selectedItem == null)
            {
                _messageBoxShower.Show("File doesn't selected!");
                return;
            }

            var listItem = (ListItem)selectedItem;

            Result = new FileInfo(listItem.Id, listItem.FileName);
            Close();
        }
Exemplo n.º 2
0
        private void OkButtonClick(object sender, System.EventArgs e)
        {
            var name = Form.NameTextBox.Text;

            if (string.IsNullOrEmpty(name))
            {
                _messageBoxShower.Show("Name can't be null or empty string");
                return;
            }

            var regex = new Regex(FileNamePattern);

            if (!regex.IsMatch(name))
            {
                _messageBoxShower.Show("Invalid file name");
                return;
            }

            Result = name;
            Close();
        }
Exemplo n.º 3
0
        private void OnCreateFile(object sender, EventArgs e)
        {
            if (_currentFileStatus.IsTextChanged.HasValue &&
                _currentFileStatus.IsTextChanged.Value)
            {
                var result = _questionShower.Show("Do you want save changes?");
                if (result == DialogResult.Yes)
                {
                    SaveFile();
                }
            }

            CreateNewFile();
        }