namespace PerpetuumSoft.Widgets.Licensing
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    internal class TrialForm : Form
    {
        private IContainer components;
        private Label expirationDateWarninglabel;
        private GroupBox groupBox1;
        private bool isTrial = false;
        private Label label1;
        private PerpetuumSoftLicense license = null;
        private RichTextBox licenseRichTextBox;
        private string productName = string.Empty;
        private Button tryButton;

        public TrialForm(bool designTime, PerpetuumSoftLicense license, Type type, string productName, string requirsOption, string licenseAgreement)
        {
            this.InitializeComponent();
            this.productName = productName;
            this.license = license;
            this.licenseRichTextBox.set_Rtf(licenseAgreement);
            bool flag = license.IsExpire(type);
            if ((license == null) || license.IsTrial)
            {
                this.isTrial = true;
            }
            else if (flag)
            {
                this.isTrial = true;
                this.expirationDateWarninglabel.Visible = true;
                this.groupBox1.Location = new Point(this.groupBox1.Location.X, (this.groupBox1.Location.Y + this.expirationDateWarninglabel.Size.Height) + 10);
                this.groupBox1.Size = new Size(this.groupBox1.Size.Width, this.groupBox1.Size.Height - (this.expirationDateWarninglabel.Size.Height + 10));
            }
            this.label1.Text = string.Format("{0} : {1} requires '{2}' option in license", productName, type.Name, requirsOption);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.tryButton = new Button();
            this.label1 = new Label();
            this.groupBox1 = new GroupBox();
            this.licenseRichTextBox = new RichTextBox();
            this.expirationDateWarninglabel = new Label();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            this.tryButton.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tryButton.DialogResult = DialogResult.OK;
            this.tryButton.set_FlatStyle(3);
            this.tryButton.Location = new Point(8, 0x18f);
            this.tryButton.Name = "tryButton";
            this.tryButton.TabIndex = 0;
            this.tryButton.Text = "Close";
            this.label1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label1.Location = new Point(0x10, 8);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x240, 0x18);
            this.label1.TabIndex = 3;
            this.label1.Text = "label1";
            this.groupBox1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupBox1.Controls.Add(this.licenseRichTextBox);
            this.groupBox1.Location = new Point(8, 40);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x248, 0x158);
            this.groupBox1.TabIndex = 4;
            this.groupBox1.set_TabStop(false);
            this.groupBox1.Text = "Agreement";
            this.licenseRichTextBox.BackColor = SystemColors.Control;
            this.licenseRichTextBox.Dock = DockStyle.Fill;
            this.licenseRichTextBox.Location = new Point(3, 0x10);
            this.licenseRichTextBox.Name = "licenseRichTextBox";
            this.licenseRichTextBox.ReadOnly = true;
            this.licenseRichTextBox.Size = new Size(0x242, 0x145);
            this.licenseRichTextBox.TabIndex = 0;
            this.licenseRichTextBox.Text = "licenseRichTextBox";
            this.expirationDateWarninglabel.ForeColor = Color.Red;
            this.expirationDateWarninglabel.Location = new Point(0x10, 40);
            this.expirationDateWarninglabel.Name = "expirationDateWarninglabel";
            this.expirationDateWarninglabel.Size = new Size(0x218, 0x17);
            this.expirationDateWarninglabel.TabIndex = 5;
            this.expirationDateWarninglabel.Text = "The can not use current product version. Licence has expired";
            this.expirationDateWarninglabel.Visible = false;
            this.set_AutoScaleBaseSize(new Size(5, 13));
            base.ClientSize = new Size(0x25a, 0x1af);
            base.Controls.Add(this.expirationDateWarninglabel);
            base.Controls.Add(this.groupBox1);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.tryButton);
            base.FormBorderStyle = FormBorderStyle.FixedDialog;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "TrialForm";
            base.set_StartPosition(1);
            this.Text = "Trial Form";
            this.groupBox1.ResumeLayout(false);
            base.ResumeLayout(false);
        }
    }
}
