private void Initialize(object sender, System.EventArgs e) { if (!this.Visible) { return; } Application.Idle -= Initialize; // Color apiColor = Color.FromArgb(255, 212, 255, 219); FullLog = new List <String>(); // Label apiLbl = new Label(); apiLbl.AddToParentAndPlace(this, 5, 5); apiLbl.FontSize(12); apiLbl.Text = "API Key:"; apiLbl.BackColor = apiColor; // ApiKeyTBox = new TextBox(); ApiKeyTBox.PlaceUnderLast(this, 0); ApiKeyTBox.Size = new Size(this.ClientRectangle.Width - 10, 20); ApiKeyTBox.FontSize(12); ApiKeyTBox.BackColor = apiColor; // SandboxCkBox = new CheckBox(); SandboxCkBox.PlaceUnderLast(this); SandboxCkBox.Text = "Use Sandbox"; SandboxCkBox.AutoSize = true; SandboxCkBox.FontSize(12); // SameDirectoryCkBox = new CheckBox(); SameDirectoryCkBox.PlaceRightOf(SandboxCkBox, 25); SameDirectoryCkBox.Text = "Place Output files with Input file"; SameDirectoryCkBox.AutoSize = true; SameDirectoryCkBox.Checked = true; SameDirectoryCkBox.FontSize(12); // OverwriteCkBox = new CheckBox(); OverwriteCkBox.PlaceBelow(SameDirectoryCkBox); OverwriteCkBox.Text = "Overwrite existing files"; OverwriteCkBox.AutoSize = true; OverwriteCkBox.Checked = false; OverwriteCkBox.FontSize(12); // SelectInputBtn = new Button(); SelectInputBtn.PlaceUnderLast(this); SelectInputBtn.Text = "Select Input File"; SelectInputBtn.AutoSize = true; SelectInputBtn.FontSize(12); SelectInputBtn.Show(); SelectInputBtn.BackColor = Color.White; SelectInputBtn.Click += SelectInputBtn_Click; // rtb = new RichTextBox(); rtb.PlaceUnderLast(this); rtb.Width = ClientSize.Width - 2 * rtb.Left; rtb.Height = ClientSize.Height - rtb.Location.Y - 12; rtb.BackColor = Color.LightBlue; rtb.FontSize(12); // Log("\n 1. Insure your API Key appears above.\n 2.Select option checkboxes\n 3.Press \"Select Input File\" button."); // try to get saved state to restore controls SaveState.SaveData saved = SaveState.Get(); if (saved == null) { ApiKeyTBox.Text = string.Empty; SandboxCkBox.Checked = true; SameDirectoryCkBox.Checked = true; OverwriteCkBox.Checked = false; } else { ApiKeyTBox.Text = saved.apikey; ApiKeyTBox.SelectionStart = ApiKeyTBox.Text.Length; SandboxCkBox.Checked = saved.Sandbox; SameDirectoryCkBox.Checked = saved.SameDirectory; OverwriteCkBox.Checked = saved.Overwrite; } }
private static void UserSelectTargetFileType(List <atarget> targets) { Form frm = new Form(); frm.NoTopIcons(); frm.FormBorderStyle = FormBorderStyle.FixedDialog; frm.PlaceOnDesktop(MainForm.Location.X + 50, MainForm.Location.Y + 220, 300, 300); frm.BackColor = Color.Beige; // Label topLbl = new Label(); topLbl.AddToParentAndPlace(frm); topLbl.Text = "Select Output Format"; topLbl.BackColor = Color.FromArgb(255, 212, 255, 219); topLbl.FontSize(12); topLbl.AutoSize = true; topLbl.Show(); // for (int i = 0; i < targets.Count; i++) { atarget tgt = targets[i]; CheckBox ckbx = new CheckBox(); ckbx.PlaceUnderLast(frm); ckbx.Text = string.Format(".{0}", tgt.name); ckbx.FontSize(12); ckbx.AutoSize = true; ckbx.Show(); // Label lbl = new Label(); lbl.PlaceRightOf(ckbx); lbl.Location = new Point(150, lbl.Location.Y); lbl.Text = string.Format("(cost = {0} credit)", tgt.credit_cost); lbl.FontSize(12); lbl.AutoSize = true; lbl.Show(); } // Button OkBtn = new Button(); OkBtn.PlaceUnderLast(frm); OkBtn.Text = "OK"; OkBtn.FontSize(12); OkBtn.Height += 5; OkBtn.BackColor = Color.White; OkBtn.Click += UserSelectTargetBtn_Click; // Button CancelBtn = new Button(); CancelBtn.PlaceRightOf(OkBtn); CancelBtn.Text = "Cancel"; CancelBtn.FontSize(12); CancelBtn.BackColor = Color.White; CancelBtn.Height += 5; CancelBtn.Location = new Point(frm.ClientSize.Width - CancelBtn.Width - 5, CancelBtn.Location.Y); CancelBtn.Click += UserSelectTargetBtn_Click; // int bottom = OkBtn.Location.Y + OkBtn.Height + 5; frm.ClientSize = new Size(frm.ClientSize.Width, bottom); var ScreenRect = Screen.FromControl(MainForm).Bounds; if (frm.Top + frm.Height > ScreenRect.Height) { frm.Location = new Point(frm.Location.X, 0); } frm.ShowDialog(); }