Ejemplo n.º 1
0
        private void PopulateConfiguration()
        {
            DpiScale dpiScale = new DpiScale(CreateGraphics());
            IEnumerable <IConfigurationData> configItems = m_adapter.GetConfiguration().Where(x => x.UserCanModify);

            TableLayoutPanel tblMain = new TableLayoutPanel
            {
                Dock = DockStyle.Top
            };

            int height = dpiScale.ScaleIntY(8);

            tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, height));

            int height32 = dpiScale.ScaleIntY(32);

            foreach (IConfigurationData config in configItems)
            {
                GrowLabel lbl = new GrowLabel
                {
                    Anchor = AnchorStyles.Left,
                    Text   = AddSpaceBetweenWords(config.Name),
                };

                tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, lbl.Height < height32 ? height32 : lbl.Height));
                tblMain.Controls.Add(lbl, 0, tblMain.RowStyles.Count - 1);

                if (!string.IsNullOrEmpty(config.AvailableValues))
                {
                    HandleComboBox(tblMain, config);
                }
                else if (config.Name == AppConfiguration.ScreenshotPreviewSizeName) //special case for TrackBar
                {
                    HandleScreenshotPreviewSize(tblMain, config, dpiScale);
                }
                else
                {
                    HandleTextBox(tblMain, config);
                }

                height += height32;
            }

            tblMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tblMain.Height = height + dpiScale.ScaleIntY(8);

            tabControl.TabPages[0].Controls.Add(tblMain);
            Height = tblMain.Height + dpiScale.ScaleIntY(110);
        }
Ejemplo n.º 2
0
        private void PopulateConfiguration()
        {
            IEnumerable <IConfigurationData> configItems = m_adapter.GetConfiguration().Where(x => x.UserCanModify);

            TableLayoutPanel tblMain = new TableLayoutPanel();

            tblMain.Dock = DockStyle.Top;
            tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 8));
            int height = 8;

            foreach (IConfigurationData config in configItems)
            {
                GrowLabel lbl = new GrowLabel();
                lbl.Anchor = AnchorStyles.Left;
                lbl.Text   = AddSpaceBetweenWords(config.Name);

                tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, lbl.Height < 32 ? 32 : lbl.Height));
                tblMain.Controls.Add(lbl, 0, tblMain.RowStyles.Count - 1);

                if (!string.IsNullOrEmpty(config.AvailableValues))
                {
                    HandleComboBox(tblMain, config);
                }
                else if (config.Name == "ScreenshotPreviewSize") //special case for TrackBar
                {
                    HandleScreenshotPreviewSize(tblMain, config);
                }
                else
                {
                    HandleTextBox(tblMain, config);
                }

                height += 32;
            }

            tblMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tblMain.Height = height;

            tabControl.TabPages[0].Controls.Add(tblMain);
            Height = height + 110;
        }
Ejemplo n.º 3
0
        private void PopulateConfiguration()
        {
            TableLayoutPanel panel = new TableLayoutPanel {
                Dock = DockStyle.Top
            };

            panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 8f));
            int num = 8;

            using (IEnumerator <IConfigurationDataSource> enumerator = (from item in this.DataSourceAdapter.GetConfiguration()
                                                                        where item.UserCanModify
                                                                        select item).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IConfigurationDataSource ds = enumerator.Current;
                    GrowLabel control           = new GrowLabel {
                        Anchor = AnchorStyles.Left,
                        Text   = AddSpaceBetweenWords(ds.Name)
                    };
                    panel.RowStyles.Add(new RowStyle(SizeType.Absolute, (control.Height < 0x20) ? ((float)0x20) : ((float)control.Height)));
                    panel.Controls.Add(control, 0, panel.RowStyles.Count - 1);
                    if (!string.IsNullOrEmpty(ds.AvailableValues))
                    {
                        ComboBox box = new ComboBox {
                            Dock = DockStyle.Fill
                        };
                        char[]   separator = new char[] { ';' };
                        string[] strArray  = ds.AvailableValues.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                        List <Tuple <string, string> > list = new List <Tuple <string, string> >();
                        for (int i = 0; i < (strArray.Length - 1); i += 2)
                        {
                            list.Add(new Tuple <string, string>(strArray[i], strArray[i + 1]));
                        }
                        box.ValueMember    = "Item1";
                        box.DataSource     = list;
                        box.BindingContext = new BindingContext();
                        box.SelectedItem   = (from item in list
                                              where item.Item2 == ds.Value
                                              select item).FirstOrDefault <Tuple <string, string> >();
                        panel.Controls.Add(box, 1, panel.RowStyles.Count - 1);
                        this.m_configValues.Add(new Tuple <IConfigurationDataSource, object>(ds, box));
                    }
                    else
                    {
                        TextBox box2 = new TextBox {
                            Dock = DockStyle.Fill,
                            Text = ds.Value
                        };
                        this.m_configValues.Add(new Tuple <IConfigurationDataSource, object>(ds, box2));
                        if (ds.Name == "GameFileDirectory")
                        {
                            this.m_gameFileDirectory       = box2;
                            this.m_gameFileDirectory.Width = 170;
                            FlowLayoutPanel panel2 = new FlowLayoutPanel {
                                Dock     = DockStyle.Fill,
                                Controls = { this.m_gameFileDirectory }
                            };
                            Button button = new Button {
                                Text = "Browse..."
                            };
                            button.Click += new EventHandler(this.browseButton_Click);
                            panel2.Controls.Add(button);
                            panel.Controls.Add(panel2, 1, panel.RowStyles.Count - 1);
                        }
                        else
                        {
                            panel.Controls.Add(box2, 1, panel.RowStyles.Count - 1);
                        }
                    }
                    num += 0x20;
                }
            }
            panel.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
            panel.Height = num;
            this.tabControl.TabPages[0].Controls.Add(panel);
            base.Height = num + 110;
        }
Ejemplo n.º 4
0
 private void InitializeComponent()
 {
     this.tblMain    = new TableLayoutPanel();
     this.txtText    = new TextBox();
     this.lblHeader  = new GrowLabel();
     this.flpButtons = new FlowLayoutPanel();
     this.btnOK      = new Button();
     this.btnCancel  = new Button();
     this.tblMain.SuspendLayout();
     this.flpButtons.SuspendLayout();
     base.SuspendLayout();
     this.tblMain.ColumnCount = 1;
     this.tblMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
     this.tblMain.Controls.Add(this.txtText, 0, 1);
     this.tblMain.Controls.Add(this.lblHeader, 0, 0);
     this.tblMain.Controls.Add(this.flpButtons, 0, 2);
     this.tblMain.Dock     = DockStyle.Fill;
     this.tblMain.Location = new Point(0, 0);
     this.tblMain.Name     = "tblMain";
     this.tblMain.RowCount = 3;
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 32f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 32f));
     this.tblMain.Size       = new Size(0x158, 0x142);
     this.tblMain.TabIndex   = 0;
     this.txtText.Dock       = DockStyle.Fill;
     this.txtText.Location   = new Point(3, 0x23);
     this.txtText.Multiline  = true;
     this.txtText.Name       = "txtText";
     this.txtText.ScrollBars = ScrollBars.Vertical;
     this.txtText.Size       = new Size(0x152, 0xfc);
     this.txtText.TabIndex   = 0;
     this.lblHeader.AutoSize = true;
     this.lblHeader.Location = new Point(3, 0);
     this.lblHeader.Name     = "lblHeader";
     this.lblHeader.Size     = new Size(0x3e, 13);
     this.lblHeader.TabIndex = 2;
     this.lblHeader.Text     = "growLabel1";
     this.flpButtons.Controls.Add(this.btnCancel);
     this.flpButtons.Controls.Add(this.btnOK);
     this.flpButtons.Dock          = DockStyle.Fill;
     this.flpButtons.FlowDirection = FlowDirection.RightToLeft;
     this.flpButtons.Location      = new Point(0, 290);
     this.flpButtons.Margin        = new Padding(0);
     this.flpButtons.Name          = "flpButtons";
     this.flpButtons.Size          = new Size(0x158, 0x20);
     this.flpButtons.TabIndex      = 3;
     this.btnOK.Anchor             = AnchorStyles.Right | AnchorStyles.Top;
     this.btnOK.DialogResult       = DialogResult.OK;
     this.btnOK.Location           = new Point(0xb9, 3);
     this.btnOK.Name     = "btnOK";
     this.btnOK.Size     = new Size(0x4b, 0x17);
     this.btnOK.TabIndex = 2;
     this.btnOK.Text     = "OK";
     this.btnOK.UseVisualStyleBackColor = true;
     this.btnCancel.Location            = new Point(0x10a, 3);
     this.btnCancel.Name     = "btnCancel";
     this.btnCancel.Size     = new Size(0x4b, 0x17);
     this.btnCancel.TabIndex = 3;
     this.btnCancel.Text     = "Cancel";
     this.btnCancel.UseVisualStyleBackColor = true;
     base.AcceptButton        = this.btnOK;
     base.AutoScaleDimensions = new SizeF(6f, 13f);
     base.AutoScaleMode       = AutoScaleMode.Font;
     base.CancelButton        = this.btnCancel;
     base.ClientSize          = new Size(0x158, 0x142);
     base.Controls.Add(this.tblMain);
     base.Name     = "TextBoxForm";
     base.ShowIcon = false;
     this.Text     = "TextBoxForm";
     this.tblMain.ResumeLayout(false);
     this.tblMain.PerformLayout();
     this.flpButtons.ResumeLayout(false);
     base.ResumeLayout(false);
 }
Ejemplo n.º 5
0
        private void PopulateConfiguration()
        {
            IEnumerable <IConfigurationData> configItems = m_adapter.GetConfiguration().Where(x => x.UserCanModify);

            TableLayoutPanel tblMain = new TableLayoutPanel();

            tblMain.Dock = DockStyle.Top;
            tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 8));
            int height = 8;

            foreach (IConfigurationData config in configItems)
            {
                GrowLabel lbl = new GrowLabel();
                lbl.Anchor = AnchorStyles.Left;
                lbl.Text   = AddSpaceBetweenWords(config.Name);

                tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, lbl.Height < 32 ? 32 : lbl.Height));
                tblMain.Controls.Add(lbl, 0, tblMain.RowStyles.Count - 1);

                if (!string.IsNullOrEmpty(config.AvailableValues))
                {
                    ComboBox cmb = new ComboBox();
                    cmb.Dock = DockStyle.Fill;

                    string[] items = config.AvailableValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    List <Tuple <string, string> > cmbDataSource = new List <Tuple <string, string> >();

                    for (int i = 0; i < items.Length - 1; i += 2)
                    {
                        cmbDataSource.Add(new Tuple <string, string>(items[i], items[i + 1]));
                    }

                    cmb.ValueMember    = "Item1";
                    cmb.DataSource     = cmbDataSource;
                    cmb.BindingContext = new BindingContext();
                    cmb.SelectedItem   = cmbDataSource.FirstOrDefault(x => x.Item2 == config.Value);

                    tblMain.Controls.Add(cmb, 1, tblMain.RowStyles.Count - 1);
                    m_configValues.Add(new Tuple <IConfigurationData, object>(config, cmb));
                }
                else
                {
                    TextBox txt = new TextBox();
                    txt.Dock = DockStyle.Fill;
                    txt.Text = config.Value;
                    m_configValues.Add(new Tuple <IConfigurationData, object>(config, txt));

                    if (config.Name == "GameFileDirectory")
                    {
                        m_gameFileDirectory       = txt;
                        m_gameFileDirectory.Width = 170;
                        FlowLayoutPanel flp = new FlowLayoutPanel();
                        flp.Dock = DockStyle.Fill;
                        flp.Controls.Add(m_gameFileDirectory);
                        Button browseButton = new Button();
                        browseButton.Text   = "Browse...";
                        browseButton.Click += browseButton_Click;
                        flp.Controls.Add(browseButton);
                        tblMain.Controls.Add(flp, 1, tblMain.RowStyles.Count - 1);
                    }
                    else if (config.Name == "ScreenshotCaptureDirectories")
                    {
                        m_screenshotDirectories         = txt;
                        m_screenshotDirectories.Width   = 170;
                        m_screenshotDirectories.Enabled = false;
                        FlowLayoutPanel flp = new FlowLayoutPanel();
                        flp.Dock = DockStyle.Fill;
                        flp.Controls.Add(txt);
                        Button changeButton = new Button();
                        changeButton.Text   = "Change...";
                        changeButton.Click += ChangeButton_Click;
                        flp.Controls.Add(changeButton);
                        tblMain.Controls.Add(flp, 1, tblMain.RowStyles.Count - 1);
                    }
                    else
                    {
                        tblMain.Controls.Add(txt, 1, tblMain.RowStyles.Count - 1);
                    }
                }

                height += 32;
            }

            tblMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tblMain.Height = height;

            tabControl.TabPages[0].Controls.Add(tblMain);
            Height = height + 110;
        }
Ejemplo n.º 6
0
 private void InitializeComponent()
 {
     this.tblMain        = new TableLayoutPanelDB();
     this.lblTimePlayed  = new Label();
     this.lblTitle       = new GrowLabel();
     this.txtDescription = new TextBox();
     this.pbImage        = new PictureBox();
     this.lblTags        = new GrowLabel();
     this.ctrlStats      = new StatsControl();
     this.tblMain.SuspendLayout();
     ((ISupportInitialize)this.pbImage).BeginInit();
     base.SuspendLayout();
     this.tblMain.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
     this.tblMain.ColumnCount     = 1;
     this.tblMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
     this.tblMain.Controls.Add(this.lblTimePlayed, 0, 2);
     this.tblMain.Controls.Add(this.lblTitle, 0, 0);
     this.tblMain.Controls.Add(this.txtDescription, 0, 5);
     this.tblMain.Controls.Add(this.pbImage, 0, 1);
     this.tblMain.Controls.Add(this.lblTags, 0, 4);
     this.tblMain.Controls.Add(this.ctrlStats, 0, 3);
     this.tblMain.Dock     = DockStyle.Fill;
     this.tblMain.Location = new Point(0, 0);
     this.tblMain.Margin   = new Padding(0);
     this.tblMain.Name     = "tblMain";
     this.tblMain.RowCount = 6;
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 200f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 78f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
     this.tblMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
     this.tblMain.Size                = new Size(0xcc, 0x28e);
     this.tblMain.TabIndex            = 0;
     this.lblTimePlayed.Anchor        = AnchorStyles.Left;
     this.lblTimePlayed.AutoSize      = true;
     this.lblTimePlayed.Location      = new Point(4, 0x100);
     this.lblTimePlayed.Name          = "lblTimePlayed";
     this.lblTimePlayed.Size          = new Size(0x44, 13);
     this.lblTimePlayed.TabIndex      = 7;
     this.lblTimePlayed.Text          = "Time Played:";
     this.lblTitle.Anchor             = AnchorStyles.None;
     this.lblTitle.AutoSize           = true;
     this.lblTitle.Font               = new Font("Arial", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
     this.lblTitle.Location           = new Point(0x51, 11);
     this.lblTitle.Name               = "lblTitle";
     this.lblTitle.Size               = new Size(0x29, 0x13);
     this.lblTitle.TabIndex           = 4;
     this.lblTitle.Text               = "Title";
     this.lblTitle.UseMnemonic        = false;
     this.txtDescription.BackColor    = SystemColors.Window;
     this.txtDescription.Dock         = DockStyle.Fill;
     this.txtDescription.Location     = new Point(4, 0x197);
     this.txtDescription.Multiline    = true;
     this.txtDescription.Name         = "txtDescription";
     this.txtDescription.ReadOnly     = true;
     this.txtDescription.Size         = new Size(0xc4, 0xf3);
     this.txtDescription.TabIndex     = 1;
     this.txtDescription.TextChanged += new EventHandler(this.txtDescription_TextChanged);
     this.pbImage.Dock                = DockStyle.Fill;
     this.pbImage.Location            = new Point(4, 0x2d);
     this.pbImage.Name                = "pbImage";
     this.pbImage.Size                = new Size(0xc4, 0xc2);
     this.pbImage.SizeMode            = PictureBoxSizeMode.StretchImage;
     this.pbImage.TabIndex            = 2;
     this.pbImage.TabStop             = false;
     this.lblTags.Anchor              = AnchorStyles.Left;
     this.lblTags.AutoSize            = true;
     this.lblTags.Location            = new Point(4, 0x178);
     this.lblTags.Name                = "lblTags";
     this.lblTags.Size                = new Size(0x22, 13);
     this.lblTags.TabIndex            = 5;
     this.lblTags.Text                = "Tags:";
     this.ctrlStats.Dock              = DockStyle.Fill;
     this.ctrlStats.Location          = new Point(1, 0x11c);
     this.ctrlStats.Margin            = new Padding(0);
     this.ctrlStats.Name              = "ctrlStats";
     this.ctrlStats.Size              = new Size(0xca, 0x4e);
     this.ctrlStats.TabIndex          = 8;
     base.AutoScaleDimensions         = new SizeF(6f, 13f);
     base.AutoScaleMode               = AutoScaleMode.Font;
     base.Controls.Add(this.tblMain);
     base.Name = "GameFileSummary";
     base.Size = new Size(0xcc, 0x28e);
     base.ClientSizeChanged += new EventHandler(this.GameFileSummary_ClientSizeChanged);
     this.tblMain.ResumeLayout(false);
     this.tblMain.PerformLayout();
     ((ISupportInitialize)this.pbImage).EndInit();
     base.ResumeLayout(false);
 }