Ejemplo n.º 1
0
        /// <summary>
        /// Callback function for Edit Instance button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditInstanceOverview_Click(object sender, EventArgs e)
        {
            int index = ConnectionDataGrid.CurrentRow.Index;

            if (index < 0)
            {
                MessageBox.Show("Please select an instance to edit.", "Edit Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //Grab server control from tab list and pass it to new form to manipulate
                ServerControl    sc = (ServerControl)MainTabControl.TabPages[index + 1];
                EditInstanceForm editInstancePopup = new EditInstanceForm(sc);

                editInstancePopup.ShowDialog();

                //Reflect changes to the ServerControl in the list box
                //ConnectionDataGrid.Rows.RemoveAt(index);
                //ConnectionDataGrid.Rows.Insert(index, GetServerRow(sc.serverMan));
                ConnectionDataGrid.Rows[index].SetValues(GetServerRow(sc.serverMan));
            }
        }
        /// <summary>
        /// Callback function for Edit Instance button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditInstanceOverview_Click(object sender, EventArgs e)
        {
            int index = ConnectionDataGrid.CurrentRow.Index;
            if (index < 0)
            {
                MessageBox.Show("Please select an instance to edit.", "Edit Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //Grab server control from tab list and pass it to new form to manipulate
                ServerControl sc = (ServerControl)MainTabControl.TabPages[index+1];
                EditInstanceForm editInstancePopup = new EditInstanceForm(sc);

                editInstancePopup.ShowDialog();

                //Reflect changes to the ServerControl in the list box
                //ConnectionDataGrid.Rows.RemoveAt(index);
                //ConnectionDataGrid.Rows.Insert(index, GetServerRow(sc.serverMan));
                ConnectionDataGrid.Rows[index].SetValues(GetServerRow(sc.serverMan));
            }
        }