Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
            }
            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;

            Proxy_VIF 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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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));
                }
            }
        }