131 lines
4.4 KiB
C#
131 lines
4.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Drawing.Text;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using FontAwesome.Sharp;
|
|
using PokerStarsBotClientv2.Forms;
|
|
|
|
namespace PokerStarsBotClientv2
|
|
{
|
|
public partial class MainForm : Form
|
|
{
|
|
|
|
// Fields
|
|
private IconButton currentBtn;
|
|
private Panel leftBorderBtn;
|
|
//private Form currentChildForm;
|
|
private Form FormRun;
|
|
private Form FormUploadAll;
|
|
|
|
// Constructor
|
|
public MainForm()
|
|
{
|
|
InitializeComponent();
|
|
HelperMethods.GetUserConfigFromDB();
|
|
this.Text += " v" + Globals.LocalVersion;
|
|
HelperMethods.MinimizeToTray(this);
|
|
|
|
// GUI
|
|
leftBorderBtn = new Panel();
|
|
leftBorderBtn.Size = new Size(10, 50);
|
|
panelMenu.Controls.Add(leftBorderBtn);
|
|
labelEmail.Text = Properties.Settings.Default.UserName;
|
|
|
|
// Create forms only once
|
|
FormRun = new FormRun();
|
|
FormUploadAll = new FormUploadAll();
|
|
|
|
// Default form on startup
|
|
ActivateButton(btnRun, RGBColors.color5);
|
|
OpenChildForm(FormRun);
|
|
}
|
|
|
|
// Structs
|
|
private struct RGBColors
|
|
{
|
|
public static Color color1 = Color.FromArgb(255, 255, 255); // white
|
|
public static Color color2 = Color.FromArgb(0, 174, 219); // metro blue
|
|
public static Color color3 = Color.FromArgb(26, 32, 40); // pokerstarsbot blue
|
|
public static Color color4 = Color.FromArgb(244, 244, 244); // f4f4f4
|
|
public static Color color5 = Color.Gainsboro;
|
|
public static Color color6 = Color.FromArgb(50, 62, 78); // pokerstarsblue lighter
|
|
}
|
|
|
|
// Methods
|
|
private void ActivateButton(object senderBtn, Color color)
|
|
{
|
|
if (senderBtn != null)
|
|
{
|
|
DisableButton();
|
|
currentBtn = (IconButton)senderBtn;
|
|
currentBtn.BackColor = RGBColors.color6;
|
|
currentBtn.ForeColor = color;
|
|
currentBtn.TextAlign = ContentAlignment.MiddleCenter;
|
|
currentBtn.IconColor = color;
|
|
currentBtn.TextImageRelation = TextImageRelation.TextBeforeImage;
|
|
currentBtn.ImageAlign = ContentAlignment.MiddleRight;
|
|
// Left boder button
|
|
leftBorderBtn.BackColor = RGBColors.color2;
|
|
leftBorderBtn.Location = new Point(0, currentBtn.Location.Y);
|
|
leftBorderBtn.Visible = true;
|
|
leftBorderBtn.BringToFront();
|
|
}
|
|
}
|
|
|
|
private void DisableButton()
|
|
{
|
|
if (currentBtn != null)
|
|
{
|
|
currentBtn.BackColor = Color.FromArgb(26, 32, 40);
|
|
currentBtn.ForeColor = Color.White;
|
|
currentBtn.TextAlign = ContentAlignment.MiddleCenter;
|
|
currentBtn.IconColor = Color.White;
|
|
currentBtn.TextImageRelation = TextImageRelation.Overlay;
|
|
currentBtn.ImageAlign = ContentAlignment.MiddleLeft;
|
|
}
|
|
|
|
}
|
|
|
|
private void OpenChildForm(Form childForm)
|
|
{
|
|
//currentChildForm = childForm;
|
|
childForm.TopLevel = false;
|
|
childForm.FormBorderStyle = FormBorderStyle.None;
|
|
childForm.Dock = DockStyle.Fill;
|
|
panelDesktop.Controls.Add(childForm);
|
|
panelDesktop.Tag = childForm;
|
|
childForm.BringToFront();
|
|
childForm.Show();
|
|
}
|
|
|
|
private void btnRun_Click(object sender, EventArgs e)
|
|
{
|
|
ActivateButton(sender, RGBColors.color5);
|
|
OpenChildForm(FormRun);
|
|
}
|
|
|
|
private void btnUploadAll_Click(object sender, EventArgs e)
|
|
{
|
|
ActivateButton(sender, RGBColors.color5);
|
|
OpenChildForm(FormUploadAll);
|
|
}
|
|
|
|
private void panelLogo_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
Application.Exit();
|
|
}
|
|
}
|
|
}
|