예제 #1
0
        private void PopulateComboBox()
        {
            try
            {
                m_comboBoxISOLibraries.SuspendLayout();
                int selectedIndex = m_comboBoxISOLibraries.SelectedIndex;

                foreach (var item in m_comboBoxISOLibraries.Items)
                {
                    if (item is ToStringWrapper <SR> wrapper && wrapper.item != null)
                    {
                        wrapper.item.PropertyChanged -= server_PropertyChanged;
                    }
                }
                m_comboBoxISOLibraries.Items.Clear();

                m_comboBoxISOLibraries.Items.Add(new ToStringWrapper <SR>(null, Messages.IMPORT_OPTIONS_PAGE_CHOOSE_ISO_SR));
                m_comboBoxISOLibraries.Items.Add(new ToStringWrapper <SR>(null, Messages.IMPORT_OPTIONS_PAGE_NEW_ISO_LIBRARY));

                var isoName = OVF.GetISOFixupFileName();

                var availableSRs = Connection.Cache.SRs;
                foreach (var sr in availableSRs)
                {
                    if (!IsIsoSrSelectable(sr))
                    {
                        continue;
                    }

                    int index = AddReplaceSrItem(sr);
                    if (selectedIndex < 0)
                    {
                        foreach (var vdiRef in sr.VDIs)
                        {
                            var vdi = Connection.Resolve(vdiRef);
                            if (vdi != null && vdi.name_label == isoName)
                            {
                                selectedIndex = index;
                                break;
                            }
                        }
                    }
                }

                if (m_comboBoxISOLibraries.SelectedIndex < 0)
                {
                    SetSelectedIndexProgrammatically(selectedIndex < 0 ? 0 : selectedIndex);
                }
            }
            finally
            {
                m_comboBoxISOLibraries.ResumeLayout();
            }
        }
예제 #2
0
        private void ValidateSelection()
        {
            if (m_radioButtonDontRunOSFixups.Checked)
            {
                m_buttonNextEnabled      = true;
                m_pictureBoxInfo.Visible = m_labelFixupISOInfo.Visible = m_ctrlError.Visible = false;
                OnPageUpdated();
                return;
            }

            SelectedIsoSR = m_radioButtonRunOSFixups.Checked && m_comboBoxISOLibraries.SelectedItem is ToStringWrapper <SR> wrapper
                ? wrapper.item
                : null;

            if (!PerformCheck((out string error) =>
            {
                error = null;
                return(SelectedIsoSR != null);
            }))
            {
                return;
            }

            if (!PerformCheck(CheckFixupIsoInXencenterInstallation))
            {
                return;
            }

            var isoName = OVF.GetISOFixupFileName();

            foreach (var vdiRef in SelectedIsoSR.VDIs)
            {
                var vdi = Connection.Resolve(vdiRef);
                if (vdi != null && vdi.name_label == isoName)
                {
                    m_labelFixupISOInfo.Text = Messages.IMPORT_OPTIONS_PAGE_FOUND_EXISTING_ISO;
                    return;
                }
            }

            if (!PerformCheck(CheckCanCreateVdiOnIsoSr))
            {
                return;
            }

            m_labelFixupISOInfo.Text = Messages.IMPORT_OPTIONS_PAGE_USE_SELECTED_ISO_LIBRARY;
        }
예제 #3
0
 private void GetFixupIsoInfo()
 {
     m_isoFilename = OVF.GetISOFixupFileName();
 }
예제 #4
0
        private bool CheckFixupIsoInXencenterInstallation(out string error)
        {
            error = string.Empty;

            var theVdi = Connection.Cache.VDIs.FirstOrDefault(vdi => vdi != null && vdi.name_label == OVF.GetISOFixupFileName());

            if (theVdi != null || File.Exists(OVF.GetISOFixupPath()))
            {
                return(true);
            }

            error = Messages.IMPORT_OPTIONS_PAGE_ERROR_NO_FIXUP_ISO_INSTALLED;
            return(false);
        }