コード例 #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            Debug.Assert(!string.IsNullOrEmpty(textBoxName.Text));

            string extension  = Path.GetExtension(textBoxPath.Text);
            string name       = textBoxName.Text;
            string path       = textBoxPath.Text;
            string parameters = textBoxParameters.Text;

            if (!File.Exists(path) || !openFileDialog.Filter.Contains(extension))
            {
                MessageBox.Show(string.Format("This path for the {0}-player is not valid. Please, select the executable.", name),
                                "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            _item.Path = path;
            if (!_checker.IsValidParameterString(parameters))
            {
                MessageBox.Show(string.Format("The parameter string is invalid: {0}", parameters),
                                "Invalid Parameters", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            _item.Parameters = parameters;

            _sendToList.InvokeCollectionChanged();
            DialogResult = DialogResult.OK;
        }
コード例 #2
0
 public void RevertToRememberedState()
 {
     _mementoedList.Clear();
     foreach (var item in _originalItems)
     {
         _mementoedList._items.Add(item);
     }
     _mementoedList.InvokeCollectionChanged();
 }