コード例 #1
0
ファイル: ImportEulaPage.cs プロジェクト: wranders/xenadmin
        public override void PopulatePage()
        {
            if (DisableStep)             //defensive check
            {
                return;
            }

            if (!m_checkBoxAccept.Enabled)
            {
                m_checkBoxAccept.Enabled = true;
            }

            m_tabControlEULA.TabPages.Clear();
            m_checkBoxAccept.Checked = false;

            EulaSection_Type[] eulas = OVF.FindSections <EulaSection_Type>(SelectedOvfEnvelope);

            if (!PerformCheck((out string error) => CheckNumberOfEulas(eulas.Length, out error)))
            {
                m_checkBoxAccept.Enabled = false;
                return;
            }

            foreach (EulaSection_Type eula in eulas)
            {
                RichTextBox rtb = new RichTextBox {
                    ReadOnly = true, Dock = DockStyle.Fill, BackColor = SystemColors.Window, BorderStyle = BorderStyle.None
                };
                string licText = OVF.FindStringsMessage(SelectedOvfEnvelope, eula.License);

                if (licText.StartsWith(@"{\rtf"))
                {
                    rtb.Rtf = licText;
                }
                else
                {
                    rtb.Text = licText;
                }

                //RichTextBox does not support BorderStyle.FixedSingle, therefore as a workaround use
                //BorderStyle.None and put the RichTextBox in a panel with BorderStyle.FixedSingle
                Panel panel = new Panel {
                    Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle
                };
                panel.Controls.Add(rtb);

                TabPage tp = new TabPage {
                    Text = Messages.EULA
                };
                tp.Controls.Add(panel);

                m_tabControlEULA.TabPages.Add(tp);
            }
        }