Esempio n. 1
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();
        }
Esempio n. 2
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.
                    using (var dlg = new WarningDialog(Messages.MESSAGEBOX_VIF_DELETE,
                                                       ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)
                    {
                        WindowTitle = Messages.MESSAGEBOX_VIF_DELETE_TITLE
                    })
                    {
                        result = dlg.ShowDialog(Program.MainWindow);
                    }
                }
                else
                {
                    using (var dlg = new WarningDialog(Messages.MESSAGEBOX_NETWORK_DELETE,
                                                       ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)
                    {
                        WindowTitle = Messages.MESSAGEBOX_NETWORK_DELETE_TITLE
                    })
                    {
                        result = dlg.ShowDialog(Program.MainWindow);
                    }
                }

                if (result == DialogResult.Yes)
                {
                    DoRemoveNetwork();
                }
            }
        }