private void PropertiesButton_Click(object sender, EventArgs e) { if (NetworksGridView.SelectedRows.Count <= 0) { return; } NetworkListViewItem selectedItem = ((NetworkListViewItem)NetworksGridView.SelectedRows[0]); VIF newVif; using (var dialog = new VIFDialog(Connection, selectedItem.Vif, selectedItem.Index, Template.HasSriovRecommendation())) { if (dialog.ShowDialog() != DialogResult.OK) { return; } newVif = dialog.NewVif(); } selectedItem.Vif = 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()) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Error, FriendlyErrorNames.VIFS_MAX_ALLOWED, FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE))) { dlg.ShowDialog(Program.MainWindow); } return; } Host master = Helpers.GetMaster(vm.Connection); if (master == null) { // Cache populating? return; } VIF pVif; using (var d = new VIFDialog(vm.Connection, null, VIF.GetDeviceId(vm), vm.HasSriovRecommendation())) { if (d.ShowDialog(this) != DialogResult.OK) { return; } pVif = d.GetNewSettings(); } pVif.VM = new XenRef <VM>(vm.opaque_ref); var action = new CreateVIFAction(vm, pVif); action.Completed += createVIFAction_Completed; action.RunAsync(); } 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)); } } }
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 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)); } } }
private void AddButton_Click(object sender, EventArgs e) { VIF newVif; using (var dialog = new VIFDialog(Connection, null, NetworksGridView.Rows.Count, Template.HasSriovRecommendation())) { if (dialog.ShowDialog() != DialogResult.OK) { return; } newVif = dialog.NewVif(); } NetworksGridView.Rows.Add(new NetworkListViewItem(Connection, newVif, NetworksGridView.Rows.Count, true)); UpdateEnablement(); }
private void launchVmNetworkSettingsDialog() { VM vm = XenObject as VM; VIF vif = SelectedVif; if (vm == null || vif == null) { return; } int device; VIFDialog d; if (int.TryParse(vif.device, out device)) { d = new VIFDialog(vm.Connection, vif, device, vm.HasSriovRecommendation()); } else { log.ErrorFormat("Aborting vif edit. Could not parse existing vif device to int. Value is: '{0}'", vif.device); return; } if (d.ShowDialog() != DialogResult.OK) { return; } var proxyVIF = d.GetNewSettings(); UpdateVIFCommand command = new UpdateVIFCommand(Program.MainWindow, vm, vif, proxyVIF); InBuildList = true; command.Completed += new EventHandler((s, f) => Program.Invoke(this, () => { InBuildList = false; BuildList(); })); command.Execute(); }
private void launchVmNetworkSettingsDialog() { VM vm = XenObject as VM; VIF vif = SelectedVif; if (vm == null || vif == null) { return; } int device; if (!int.TryParse(vif.device, out device)) { log.ErrorFormat("Aborting vif edit. Could not parse existing vif device to int. Value is: '{0}'", vif.device); return; } VIF proxyVIF; using (var d = new VIFDialog(vm.Connection, vif, device, vm.HasSriovRecommendation())) { if (d.ShowDialog() != DialogResult.OK) { return; } proxyVIF = d.GetNewSettings(); } var action = new UpdateVIFAction(vm, vif, proxyVIF); action.Completed += updateVIFAction_Completed; InBuildList = true; action.RunAsync(); }