Exemplo n.º 1
0
        private void RemoveNetworkButton_Click(object sender, EventArgs e)
        {
            if (NetworksGridView.SelectedRows.Count == 0)
                return;

            XenAPI.Network network = SelectedNetwork;
            if (network != null && network.IsBond)
            {
                var destroyBondCommand = new DestroyBondCommand(Program.MainWindow, network);
                destroyBondCommand.Execute();
            }
            else
            {
                // Check and see if the system is running in automation test mode.  If so, then
                // do not launch the popup Y/N dialog.
                DialogResult result;
                if (Program.RunInAutomatedTestMode)
                {
                    result = DialogResult.Yes;
                }
                else if (XenObject is VM)
                {
                    // Deleting a VIF, not a Network.
                    result = new ThreeButtonDialog(
                                new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.MESSAGEBOX_VIF_DELETE, Messages.MESSAGEBOX_VIF_DELETE_TITLE),
                                ThreeButtonDialog.ButtonYes,
                                ThreeButtonDialog.ButtonNo).ShowDialog(Program.MainWindow);
                }
                else
                {
                    result = new ThreeButtonDialog(
                                new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.MESSAGEBOX_NETWORK_DELETE, Messages.MESSAGEBOX_NETWORK_DELETE_TITLE),
                                ThreeButtonDialog.ButtonYes,
                                ThreeButtonDialog.ButtonNo).ShowDialog(Program.MainWindow);
                }

                if (result == DialogResult.Yes)
                {
                    DoRemoveNetwork();
                }
            }
        }
Exemplo n.º 2
0
 private void DeleteBondButton_Click(object sender, EventArgs e)
 {
     PIF pif = ((PIFRow)dataGridView1.SelectedRows[0]).pif;
     System.Diagnostics.Trace.Assert(pif.IsBondNIC);
     XenAPI.Network network = pif.Connection.Resolve(pif.network);
     var destroyBondCommand = new DestroyBondCommand(Program.MainWindow, network);
     destroyBondCommand.Execute();
 }