/// <summary> /// Adds the last history entry to the visible history list /// </summary> /// <param name="history">Current game's history</param> private void addToHistory(List <HistoryEntry> history) { //check if an invoke is required to make this call thread-safe if (this.historyContainer.InvokeRequired) { //use the delegate to make this method thread-safe SetHistoryCallback d = new SetHistoryCallback(addToHistory); this.Invoke(d, new object[] { history }); } else { //create a new label MonoFlat.MonoFlat_Label lbl = new MonoFlat.MonoFlat_Label(); lbl.AutoSize = true; //make it fit inside the historyContainer lbl.MaximumSize = new Size(historyContainer.Width - 20, 500); lbl.Margin = new Padding(5); //set it's text to the readable format of the last history entry lbl.Text = history.Last().getReadableFormat(); lbl.Parent = historyContainer; //create a separator MonoFlat.MonoFlat_Separator sep = new MonoFlat.MonoFlat_Separator(); //make it fit inside the historyContainer sep.Margin = new Padding(0, 10, 0, 10); sep.Width = historyContainer.Width - 20; //add the label to the historyContainer historyContainer.Controls.Add(lbl); //add the separator to the historyContainer historyContainer.Controls.Add(sep); historyContainer.ScrollControlIntoView(sep); //pass the game history to updateStats updateStats(history); } }
/// <summary> /// Called when the addNewPlayerBtn control is clicked /// </summary> private void addNewPlayerBtn_Click(object sender, EventArgs e) { //ensure the player name is not empty if (newPlayerNameTxt.Text.Length > 0) { //create a new label MonoFlat.MonoFlat_Label playerLbl = new MonoFlat.MonoFlat_Label(); playerLbl.AutoSize = true; //set the label text to the player number and entered name playerLbl.Text = string.Format("Player {0}:\n \t{1}\n \tAI:{2}", players.Count + 1, newPlayerNameTxt.Text.Trim(), boolToYesNoString(aiCheck.Checked)); playerLbl.Margin = new Padding(15); playerLbl.Font = new Font("Segoe UI", 14, FontStyle.Italic, GraphicsUnit.Point); playerLbl.Name = string.Format("player{0}", players.Count); //add the label to the FlowLayoutPanel container playersContainer.Controls.Add(playerLbl); playerLbl.Show(); //add a new player object to the list of players players.Add(new Player(newPlayerNameTxt.Text.Trim(), aiCheck.Checked)); //reset the text box and check box newPlayerNameTxt.Text = ""; aiCheck.Checked = false; //add handler playerLbl.MouseUp += new MouseEventHandler(player_MouseUp); } }
private void InitializeComponent() { this.monoFlat_ThemeContainer1 = new MonoFlat.MonoFlat_ThemeContainer(); this.monoFlat_ControlBox1 = new MonoFlat.MonoFlat_ControlBox(); this.txtLog = new System.Windows.Forms.TextBox(); this.button3 = new MonoFlat.MonoFlat_Button(); this.button2 = new MonoFlat.MonoFlat_Button(); this.checkBox1 = new MonoFlat.MonoFlat_CheckBox(); this.cboxOverwrite = new System.Windows.Forms.ComboBox(); this.label3 = new MonoFlat.MonoFlat_Label(); this.txtPassword = new MonoFlat.MonoFlat_TextBox(); this.label2 = new MonoFlat.MonoFlat_Label(); this.txtLocation = new MonoFlat.MonoFlat_TextBox(); this.label1 = new MonoFlat.MonoFlat_Label(); this.monoFlat_ThemeContainer1.SuspendLayout(); this.SuspendLayout(); // // monoFlat_ThemeContainer1 // this.monoFlat_ThemeContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); this.monoFlat_ThemeContainer1.Controls.Add(this.monoFlat_ControlBox1); this.monoFlat_ThemeContainer1.Controls.Add(this.txtLog); this.monoFlat_ThemeContainer1.Controls.Add(this.button3); this.monoFlat_ThemeContainer1.Controls.Add(this.button2); this.monoFlat_ThemeContainer1.Controls.Add(this.checkBox1); this.monoFlat_ThemeContainer1.Controls.Add(this.cboxOverwrite); this.monoFlat_ThemeContainer1.Controls.Add(this.label3); this.monoFlat_ThemeContainer1.Controls.Add(this.txtPassword); this.monoFlat_ThemeContainer1.Controls.Add(this.label2); this.monoFlat_ThemeContainer1.Controls.Add(this.txtLocation); this.monoFlat_ThemeContainer1.Controls.Add(this.label1); this.monoFlat_ThemeContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.monoFlat_ThemeContainer1.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.monoFlat_ThemeContainer1.Location = new System.Drawing.Point(0, 0); this.monoFlat_ThemeContainer1.Name = "monoFlat_ThemeContainer1"; this.monoFlat_ThemeContainer1.Padding = new System.Windows.Forms.Padding(10, 70, 10, 9); this.monoFlat_ThemeContainer1.RoundCorners = true; this.monoFlat_ThemeContainer1.Sizable = true; this.monoFlat_ThemeContainer1.Size = new System.Drawing.Size(393, 529); this.monoFlat_ThemeContainer1.SmartBounds = true; this.monoFlat_ThemeContainer1.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation; this.monoFlat_ThemeContainer1.TabIndex = 0; this.monoFlat_ThemeContainer1.Text = "XProtect - Portable"; // // monoFlat_ControlBox1 // this.monoFlat_ControlBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.monoFlat_ControlBox1.EnableHoverHighlight = true; this.monoFlat_ControlBox1.EnableMaximizeButton = false; this.monoFlat_ControlBox1.EnableMinimizeButton = true; this.monoFlat_ControlBox1.Location = new System.Drawing.Point(281, 15); this.monoFlat_ControlBox1.Name = "monoFlat_ControlBox1"; this.monoFlat_ControlBox1.Size = new System.Drawing.Size(100, 25); this.monoFlat_ControlBox1.TabIndex = 22; this.monoFlat_ControlBox1.Text = "monoFlat_ControlBox1"; // // txtLog // this.txtLog.BackColor = System.Drawing.Color.White; this.txtLog.ForeColor = System.Drawing.SystemColors.ControlDarkDark; this.txtLog.Location = new System.Drawing.Point(12, 73); this.txtLog.Multiline = true; this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtLog.Size = new System.Drawing.Size(369, 201); this.txtLog.TabIndex = 20; this.txtLog.Text = "XProtector - Portable\r\n\r\n------------------------------------------\r\nProgram star" + "ted\r\n"; // // button3 // this.button3.BackColor = System.Drawing.Color.Transparent; this.button3.Font = new System.Drawing.Font("Segoe UI", 12F); this.button3.Image = null; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button3.Location = new System.Drawing.Point(290, 302); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(91, 41); this.button3.TabIndex = 19; this.button3.Text = "Browse ..."; this.button3.TextAlignment = System.Drawing.StringAlignment.Center; this.button3.Click += new System.EventHandler(this.button3_Click); // // button2 // this.button2.BackColor = System.Drawing.Color.Transparent; this.button2.Font = new System.Drawing.Font("Segoe UI", 12F); this.button2.Image = null; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button2.Location = new System.Drawing.Point(12, 477); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(366, 40); this.button2.TabIndex = 18; this.button2.Text = "Decrypt"; this.button2.TextAlignment = System.Drawing.StringAlignment.Center; this.button2.Click += new System.EventHandler(this.button2_Click); // // checkBox1 // this.checkBox1.Checked = false; this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); this.checkBox1.Location = new System.Drawing.Point(150, 446); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(153, 16); this.checkBox1.TabIndex = 17; this.checkBox1.Text = "Open folder when done"; this.checkBox1.CheckedChanged += new MonoFlat.MonoFlat_CheckBox.CheckedChangedEventHandler(this.checkBox1_CheckedChanged); // // cboxOverwrite // this.cboxOverwrite.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboxOverwrite.FormattingEnabled = true; this.cboxOverwrite.Items.AddRange(new object[] { "Ask", "Force", "None"}); this.cboxOverwrite.Location = new System.Drawing.Point(12, 444); this.cboxOverwrite.Name = "cboxOverwrite"; this.cboxOverwrite.Size = new System.Drawing.Size(121, 22); this.cboxOverwrite.TabIndex = 16; this.cboxOverwrite.SelectedIndexChanged += new System.EventHandler(this.cboxOverwrite_SelectedIndexChanged); // // label3 // this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.Font = new System.Drawing.Font("Segoe UI", 9F); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(116)))), ((int)(((byte)(125)))), ((int)(((byte)(132))))); this.label3.Location = new System.Drawing.Point(9, 426); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(93, 15); this.label3.TabIndex = 15; this.label3.Text = "Overwrite Policy"; // // txtPassword // this.txtPassword.BackColor = System.Drawing.Color.Transparent; this.txtPassword.Font = new System.Drawing.Font("Tahoma", 11F); this.txtPassword.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(183)))), ((int)(((byte)(191))))); this.txtPassword.Image = null; this.txtPassword.Location = new System.Drawing.Point(12, 372); this.txtPassword.MaxLength = 32767; this.txtPassword.Multiline = false; this.txtPassword.Name = "txtPassword"; this.txtPassword.ReadOnly = false; this.txtPassword.Size = new System.Drawing.Size(366, 41); this.txtPassword.TabIndex = 14; this.txtPassword.TextAlignment = System.Windows.Forms.HorizontalAlignment.Left; this.txtPassword.UseSystemPasswordChar = true; // // label2 // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("Segoe UI", 9F); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(116)))), ((int)(((byte)(125)))), ((int)(((byte)(132))))); this.label2.Location = new System.Drawing.Point(12, 354); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(60, 15); this.label2.TabIndex = 13; this.label2.Text = "Password:"******"Tahoma", 11F); this.txtLocation.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(183)))), ((int)(((byte)(191))))); this.txtLocation.Image = null; this.txtLocation.Location = new System.Drawing.Point(12, 302); this.txtLocation.MaxLength = 32767; this.txtLocation.Multiline = false; this.txtLocation.Name = "txtLocation"; this.txtLocation.ReadOnly = true; this.txtLocation.Size = new System.Drawing.Size(272, 41); this.txtLocation.TabIndex = 12; this.txtLocation.TextAlignment = System.Windows.Forms.HorizontalAlignment.Left; this.txtLocation.UseSystemPasswordChar = false; // // label1 // this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Segoe UI", 9F); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(116)))), ((int)(((byte)(125)))), ((int)(((byte)(132))))); this.label1.Location = new System.Drawing.Point(9, 283); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(167, 15); this.label1.TabIndex = 11; this.label1.Text = "Extract the decrypted file(s) to:"; // // Form1 // this.ClientSize = new System.Drawing.Size(393, 529); this.Controls.Add(this.monoFlat_ThemeContainer1); this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.KeyPreview = true; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; this.Text = "XProtect - Portable"; this.TransparencyKey = System.Drawing.Color.Fuchsia; this.Load += new System.EventHandler(this.Form1_Load); this.Shown += new System.EventHandler(this.Form1_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); this.monoFlat_ThemeContainer1.ResumeLayout(false); this.monoFlat_ThemeContainer1.PerformLayout(); this.ResumeLayout(false); }