Exemplo n.º 1
0
        /// <summary>
        /// Actions for edit exec button, also called on double click action
        /// </summary>
        private void ExecEditButton_Click(object sender, EventArgs e)
        {
            // Get exec that is selected
            var selectedName = (string)this.ExecItemsList.SelectedItem;
            var exec         = ExecsManager.GetExec(selectedName);

            // Check is gotten exec
            if (exec == null)
            {
                // This happens when nothing is selected
                //MessageBox.Show("Specified entry does not exist. Delete and re-add", "Error reading entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                // Start add form, but in edit mode
                var editForm   = new ExecAddForm(exec);
                var formResult = editForm.ShowDialog();

                // if form exited with ok
                if (formResult == DialogResult.OK)
                {
                    // Get edited exec
                    var newExec = editForm.NewLeagueExec;

                    // Save exec file
                    ExecsManager.DeleteExecFile(selectedName);
                    ExecsManager.SaveExecFile(newExec);

                    // Refresh list of execs
                    RefreshExecListBox();

                    // Clear info box
                    this.GBoxExecNameTextBox.Text       = "";
                    this.GBoxTargetLocationTextBox.Text = "";
                    this.GBoxPatchVersTextBox.Text      = "";
                    this.GBoxLastModifTextBox.Text      = "";

                    // disable context buttons
                    ExecDeleteButton.Enabled = false;
                    ExecEditButton.Enabled   = false;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Actions for add exec button
        /// </summary>
        private void ExecAddButton_Click(object sender, EventArgs e)
        {
            // Start add exec form
            var addForm    = new ExecAddForm();
            var formResult = addForm.ShowDialog();

            // If form exited with ok
            if (formResult == DialogResult.OK)
            {
                // Get new exec
                var newExec = addForm.NewLeagueExec;

                // Save execinfo file
                ExecsManager.SaveExecFile(newExec);

                // Add to exec items list
                RefreshExecListBox();
            }
        }