private void AddButton_Click(object sender, EventArgs e) { VIFDialog dialog = new VIFDialog(Connection, null, NetworksGridView.Rows.Count); if (dialog.ShowDialog() != DialogResult.OK) return; NetworksGridView.Rows.Add(new NetworkListViewItem(Connection, dialog.NewVif(), NetworksGridView.Rows.Count, true)); UpdateEnablement(); }
private void PropertiesButton_Click(object sender, EventArgs e) { if (NetworksGridView.SelectedRows.Count <= 0) return; NetworkListViewItem selectedItem = ((NetworkListViewItem)NetworksGridView.SelectedRows[0]); VIFDialog dialog = new VIFDialog(Connection, selectedItem.Vif, selectedItem.Index); if (dialog.ShowDialog() != DialogResult.OK) return; selectedItem.Vif = dialog.NewVif(); selectedItem.UpdateDetails(); UpdateEnablement(); }
private void AddNetworkButton_Click(object sender, EventArgs e) { if (XenObject is VM) { VM vm = (VM)_xenObject; if (NetworksGridView.Rows.Count >= vm.MaxVIFsAllowed) { new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Error, FriendlyErrorNames.VIFS_MAX_ALLOWED, FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE)).ShowDialog(Program.MainWindow); return; } Host master = Helpers.GetMaster(vm.Connection); if (master == null) { // Cache populating? return; } VIFDialog d = new VIFDialog(vm.Connection, null, VIF.GetDeviceId(vm)); if (d.ShowDialog(this) != DialogResult.OK) return; Proxy_VIF pVif = d.GetNewSettings(); pVif.VM = vm.opaque_ref; CreateVIFCommand action = new CreateVIFCommand(Program.MainWindow, vm, pVif); action.Execute(); } else if (XenObject is Host) { Host host = (Host)_xenObject; Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection, new NewNetworkWizard(_xenObject.Connection, null, host)); } else if (XenObject is Pool) { Pool pool = (Pool)_xenObject; Host host = pool.Connection.Resolve(pool.master); if (host != null) { Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection, new NewNetworkWizard(_xenObject.Connection, pool, host)); } } }