Example #1
0
        /// <summary>
        /// Handles when the new button is pressed.
        /// </summary>
        private void newButton_Click(object sender, EventArgs e)
        {
            EditWorkspaceDialog dialog = new EditWorkspaceDialog();

            dialog.ShowDialog();

            // check if we have a valid result
            if (dialog.Workspace != null)
            {
                // add the new workspace
                _workspaces.Add(dialog.Workspace);
                comboBox.Items.Add(dialog.Workspace);

                // select the new workspace
                comboBox.SelectedItem = dialog.Workspace;

                _needsToSaveFile = true;
            }

            // check if we have any workspaces to edit
            editButton.Enabled   = comboBox.SelectedItem != null;
            removeButton.Enabled = comboBox.SelectedItem != null;
        }
Example #2
0
        /// <summary>
        /// Handles when the edit button is clicked.
        /// </summary>
        private void editButton_Click(object sender, EventArgs e)
        {
            EditWorkspaceDialog dialog = new EditWorkspaceDialog();

            dialog.EditWorkspace((Workspace)comboBox.SelectedItem);
            dialog.ShowDialog();

            // check if we have a valid result
            if (dialog.Workspace != null)
            {
                // remove the old workspace
                _workspaces.Remove((Workspace)comboBox.SelectedItem);
                comboBox.Items.Remove(comboBox.SelectedItem);

                // add the nedited workspace
                _workspaces.Add(dialog.Workspace);
                comboBox.Items.Add(dialog.Workspace);

                // select the edited workspace
                comboBox.SelectedItem = dialog.Workspace;

                _needsToSaveFile = true;
            }
        }
        /// <summary>
        /// Handles when the new button is pressed.
        /// </summary>
        private void newButton_Click(object sender, EventArgs e)
        {
            EditWorkspaceDialog dialog= new EditWorkspaceDialog();
            dialog.ShowDialog();

            // check if we have a valid result
            if(dialog.Workspace !=null)
            {
                // add the new workspace
                _workspaces.Add(dialog.Workspace);
                comboBox.Items.Add(dialog.Workspace);

                // select the new workspace
                comboBox.SelectedItem= dialog.Workspace;

                _needsToSaveFile= true;
            }

            // check if we have any workspaces to edit
            editButton.Enabled= comboBox.SelectedItem !=null;
            removeButton.Enabled= comboBox.SelectedItem !=null;
        }
        /// <summary>
        /// Handles when the edit button is clicked.
        /// </summary>
        private void editButton_Click(object sender, EventArgs e)
        {
            EditWorkspaceDialog dialog= new EditWorkspaceDialog();
            dialog.EditWorkspace( (Workspace) comboBox.SelectedItem );
            dialog.ShowDialog();

            // check if we have a valid result
            if(dialog.Workspace !=null)
            {
                // remove the old workspace
                _workspaces.Remove( (Workspace) comboBox.SelectedItem );
                comboBox.Items.Remove(comboBox.SelectedItem);

                // add the nedited workspace
                _workspaces.Add(dialog.Workspace);
                comboBox.Items.Add(dialog.Workspace);

                // select the edited workspace
                comboBox.SelectedItem= dialog.Workspace;

                _needsToSaveFile= true;
            }
        }