public MyTableLayoutPanelActionList(ControlDesigner designer,
                                     DesignerActionList actionList) : base(designer.Component)
 {
     this.designer   = designer;
     this.actionList = actionList;
     control         = (MyTableLayoutPanel)designer.Control;
 }
Exemple #2
0
 private void Form1_Shown(object sender, EventArgs e)
 {
     this.Size     = new Size(800, 800);
     this.Location = new Point(400, 0);
     //this.TopMost = true;
     {
         TLP = new MyTableLayoutPanel((panelCount + 1) / 2, Math.Min(panelCount, 2), new Func <int, string>((int n) =>
         {
             string ans = ""; for (int i = 0; i < n; i++)
             {
                 ans += "P";
             }
             return(ans);
         })((panelCount + 1) / 2), panelCount == 1 ? "P" : "PP");
         for (int i = 0; i < panelCount; i++)
         {
             TLP.AddControl(new GamePanel(port + i, i == 0 ? 20 : fps), i / 2, i % 2);
         }
         this.Controls.Add(TLP);
     }
     this.FormClosing += Form1_FormClosing;
     {
         Thread thread = new Thread(() =>
         {
             Random rand = new Random();
             while (true)
             {
                 public_random = rand.Next(int.MaxValue);
                 Thread.Sleep(500);
             }
         });
         thread.IsBackground = true;
         thread.Start();
     }
 }
Exemple #3
0
        async Task <T> Select <T>(List <T> s, string message = "Please select")
        {
            Form          f         = new Form();
            var           tlp       = new MyTableLayoutPanel(1, s.Count + 2, "P", new string('A', s.Count + 1) + "P");
            T             selected  = default(T);
            SemaphoreSlim semaphore = new SemaphoreSlim(0);

            tlp.Controls.Add(new MyLabel(message), 0, 0);
            for (int _ = 0; _ < s.Count; _++)
            {
                int i = _;
                var b = new MyButton(s[i].ToString());
                b.Click += delegate
                {
                    b.Enabled = false;
                    f.Enabled = false;
                    selected  = s[i];
                    f.Text    = $"#{i}: {b.Text}";
                    f.Close();
                    f.Dispose();
                };
                tlp.Controls.Add(b, 0, i + 1);
            }
            f.FormClosed += delegate { lock (semaphore) semaphore.Release(); };
            tlp.Dock      = DockStyle.Top;
            f.Controls.Add(new MyPanel()
            {
                Controls = { tlp }, AutoScroll = true
            });
            f.Show();
            await semaphore.WaitAsync();

            return(selected);
        }
Exemple #4
0
 public Game()
 {
     controlPanel = new MyTableLayoutPanel(3, 1, "AAS300", "A");
     {
         {
             imageFeedBack         = new MyCheckBox("Image Feed Back");
             imageFeedBack.Checked = true;
             controlPanel.AddControl(imageFeedBack, 0, 0);
         }
         {
             showImageFeedBack                 = new MyCheckBox("Show Image Feed Back");
             showImageFeedBack.Checked         = false;
             showImageFeedBack.CheckedChanged += ShowImageFeedBack_CheckedChanged;
             controlPanel.AddControl(showImageFeedBack, 0, 0);
         }
         {
             Panel pnl = new Panel();
             {
                 pnl.Dock       = DockStyle.Fill;
                 pnl.AutoScroll = true;
                 {
                     generalSettings      = new MyInputField();
                     generalSettings.Dock = DockStyle.Top;
                     generalSettings.AddField("Image Feed Back Width", imageFeedBackSize.Width.ToString()).TextChanged   += (o, e) => { try { imageFeedBackSize.Width = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("Image Feed Back Height", imageFeedBackSize.Height.ToString()).TextChanged += (o, e) => { try { imageFeedBackSize.Height = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("Port", SocketHandler.port.ToString()).TextChanged           += (o, e) => { try { SocketHandler.port = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("darryMode", darryMode.ToString()).TextChanged               += (o, e) => { try { darryMode = bool.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("max_upward_speed", max_upward_speed.ToString()).TextChanged += (o, e) => { try { max_upward_speed = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("alpha", alpha.ToString()).TextChanged                  += (o, e) => { try { alpha = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("重利", gravity.ToString()).TextChanged                   += (o, e) => { try { gravity = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("升力", liftForce.ToString()).TextChanged                 += (o, e) => { try { liftForce = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("可見障礙物數量", obstacleCount.ToString()).TextChanged        += (o, e) => { try { obstacleCount = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("存活區的範圍", rangeY.ToString()).TextChanged                += (o, e) => { try { rangeY = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("障礙物距離的範圍", obstacleDistance.ToString()).TextChanged    += (o, e) => { try { obstacleDistance = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("障礙物寬度(通過時間)的範圍", obstacleWidth.ToString()).TextChanged += (o, e) => { try { obstacleWidth = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("障礙物通道底部高度的範圍", obstacleY.ToString()).TextChanged       += (o, e) => { try { obstacleY = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     generalSettings.AddField("障礙物通道寬度的範圍", obstacleHeight.ToString()).TextChanged    += (o, e) => { try { obstacleHeight = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
                     pnl.Controls.Add(generalSettings);
                 }
             }
             controlPanel.AddControl(pnl, 2, 0);
         }
     }
     Reset();
     Update(true);
 }
Exemple #5
0
        public Form1()
        {
            //MessageBox.Show(Color.FromArgb(127,127,127).ToString());
            this.Size         = new Size(1200, 750);
            this.FormClosing += Form1_FormClosing;
            {
                MyTableLayoutPanel tlp = new MyTableLayoutPanel(1, 2, "A", "PP");
                {
                    TLP = new MyTableLayoutPanel(2, 1, "AP", "P");
                    {
                        TLP.AddControl(Game.controlPanel, 0, 0);
                    }
                    {
                        TXB = new MyTextBox(true);
                        TLP.AddControl(TXB, 1, 0);
                    }
                    tlp.AddControl(TLP, 0, 0);
                }
                {
                    PictureBox pbx = new PictureBox();
                    pbx.Image    = new Bitmap(pbx.Width, pbx.Height);
                    pbx.Dock     = DockStyle.Fill;
                    pbx.SizeMode = PictureBoxSizeMode.Zoom;

                    /*pbx.SizeChanged += (sender, e) =>
                     * {
                     *  SocketHandler_logAppended(pbx.Size.ToString());
                     *  pbx.Image.Dispose();
                     *  pbx.Image = new Bitmap(pbx.Width, pbx.Height);
                     * };*/
                    new Thread(() =>
                    {
                        while (true)
                        {
                            Thread.Sleep(20);
                            Do(() =>
                            {
                                var bmp   = new Bitmap(game.imageFeedBackSize.Width, game.imageFeedBackSize.Height); //new Bitmap(pbx.Width, pbx.Height);
                                this.Text = bmp.Size.ToString();
                                    << << << < HEAD
                                    game.drawImage(bmp, true);
                                == == == =
                                    game.drawImage(bmp, false);
Exemple #6
0
 public MessagePage(InfoPage _info, LogPage _log) : base("主頁")
 {
     info = _info;
     log  = _log;
     {
         TLPmain = new MyTableLayoutPanel(3, 3, "PPP", "PAA");
         {
             TXBchat = new MyTextBox(true);
             TLPmain.Controls.Add(TXBchat, 0, 0);
             TLPmain.SetColumnSpan(TXBchat, 2);
         }
         {
             TXBmsg = new MyTextBox(true);
             TLPmain.Controls.Add(TXBmsg, 2, 0);
         }
         {
             TXBinput = new MyTextBox(false);
             //TXBinput.AcceptsReturn = true;
             TXBinput.Multiline    = true;
             TXBinput.Height       = 50;
             TXBinput.TextChanged += TXBinput_TextChanged;
             TLPmain.Controls.Add(TXBinput, 0, 1);
             TLPmain.SetColumnSpan(TXBinput, 3);
         }
         {
             BTNconnect        = new MyButton("");
             BTNconnect.Click += ButtonClicked;
             TLPmain.Controls.Add(BTNconnect, 0, 2);
         }
         {
             BTNmatch        = new MyButton("");
             BTNmatch.Click += ButtonClicked;
             TLPmain.Controls.Add(BTNmatch, 1, 2);
         }
         {
             BTNquit        = new MyButton("");
             BTNquit.Click += ButtonClicked;
             TLPmain.Controls.Add(BTNquit, 2, 2);
         }
         this.Controls.Add(TLPmain);
     }
     SetState(StateEnum.Disconnected);
 }
Exemple #7
0
 public Form1()
 {
     this.Size         = new Size(750, 750);
     this.FormClosing += Form1_FormClosing;
     {
         TLP = new MyTableLayoutPanel(2, 1, "AP", "P");
         {
             TLP.AddControl(game.inputField, 0, 0);
         }
         {
             TXB = new MyTextBox(true);
             TLP.AddControl(TXB, 1, 0);
         }
         this.Controls.Add(TLP);
     }
     socketHandler.logAppended += SocketHandler_logAppended;
     socketHandler.msgReceived += SocketHandler_msgReceived;
     socketHandler.Start();
 }
Exemple #8
0
        public ToolsTabPage() : base("Tools")
        {
            List <Tuple <string, Action> > buttonSettings = new List <Tuple <string, Action> >();

            InitializeButtons(buttonSettings);
            var tlp = new MyTableLayoutPanel(1, buttonSettings.Count + 1, "P", new string('A', buttonSettings.Count) + "P");

            for (int i = 0; i < buttonSettings.Count; i++)
            {
                var p = buttonSettings[i];
                var b = new MyButton(p.Item1);
                b.Click += delegate { p.Item2(); };
                tlp.Controls.Add(b, 0, i);
            }
            tlp.Dock = DockStyle.Top;
            this.Controls.Add(new MyPanel()
            {
                Controls = { tlp }, AutoScroll = true
            });
        }
Exemple #9
0
 public Game()
 {
     controlPanel = new MyTableLayoutPanel(2, 1, "AA", "A");
     {
         generalSettings = new MyInputField();
         generalSettings.AddField("Port", SocketHandler.port.ToString()).TextChanged           += (o, e) => { try { SocketHandler.port = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("darryMode", darryMode.ToString()).TextChanged               += (o, e) => { try { darryMode = bool.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("max_upward_speed", max_upward_speed.ToString()).TextChanged += (o, e) => { try { max_upward_speed = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("alpha", alpha.ToString()).TextChanged                  += (o, e) => { try { alpha = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("重利", gravity.ToString()).TextChanged                   += (o, e) => { try { gravity = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("升力", liftForce.ToString()).TextChanged                 += (o, e) => { try { liftForce = double.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("可見障礙物數量", obstacleCount.ToString()).TextChanged        += (o, e) => { try { obstacleCount = int.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("存活區的範圍", rangeY.ToString()).TextChanged                += (o, e) => { try { rangeY = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("障礙物距離的範圍", obstacleDistance.ToString()).TextChanged    += (o, e) => { try { obstacleDistance = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("障礙物寬度(通過時間)的範圍", obstacleWidth.ToString()).TextChanged += (o, e) => { try { obstacleWidth = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("障礙物通道底部高度的範圍", obstacleY.ToString()).TextChanged       += (o, e) => { try { obstacleY = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         generalSettings.AddField("障礙物通道寬度的範圍", obstacleHeight.ToString()).TextChanged    += (o, e) => { try { obstacleHeight = Interval.Parse((o as MyTextBox).Text); } catch (Exception) { MessageBox.Show("格式不正確"); } };
         controlPanel.AddControl(generalSettings, 1, 0);
     }
     Reset();
     Update(true);
 }
Exemple #10
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Text              = "Calculator";
            lblMain           = CreateLabel("0", ContentAlignment.MiddleRight, mainLabelFont);
            lblMemory         = CreateLabel("M", ContentAlignment.MiddleLeft, mainLabelFont);
            lblTemp           = CreateLabel("", ContentAlignment.BottomRight, tempLabelFont);
            lblMemory.Visible = false;


            MyPanel            mainPanel     = new MyPanel(DockStyle.Fill, new Padding(4), Color.Transparent);
            MyTableLayoutPanel mainContainer = new MyTableLayoutPanel(7, 10, DockStyle.Fill, Color.White);

            mainContainer.SetRowDimension(SizeType.Percent, 20, 13, 13, 13, 13, 13, 13);
            mainContainer.SetColumnDimension(SizeType.Percent, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10);
            mainContainer.SetGradientBackground(calcColor2, calcColor1, 90f);
            MyTableLayoutPanel displayPanel = new MyTableLayoutPanel(2, 2, DockStyle.Fill, new Padding(10), Color.Transparent);

            displayPanel.SetBorderAndGradientBackground(new Pen(calcBorderColor, 2), calcColor1, calcColor2, 90f);
            displayPanel.SetRowDimension(SizeType.Percent, 30, 70);
            displayPanel.SetColumnDimension(SizeType.Percent, 10, 90);


            displayPanel.Controls.Add(lblTemp, 1, 0);
            displayPanel.Controls.Add(lblMain, 1, 1);
            displayPanel.Controls.Add(lblMemory, 0, 0);
            displayPanel.SetRowSpan(lblMemory, 2);

            mainContainer.Controls.Add(displayPanel, 0, 0);
            mainContainer.SetColumnSpan(displayPanel, 10);


            MyTableLayoutPanel degRadGradPanel = new MyTableLayoutPanel(1, 3, DockStyle.Fill, new Padding(3));

            degRadGradPanel.SetColumnDimension(SizeType.Percent, 36, 36, 27);
            degRadGradPanel.SetBorder(new Pen(calcBorderColor, 2));

            RadioButton degButton  = CreateRadioButton("Degrees");
            RadioButton radButton  = CreateRadioButton("Radians", true);
            RadioButton gradButton = CreateRadioButton("Gradians");

            degButton.Click  += (s, args) => angleMode = AngleMode.Degree;
            radButton.Click  += (s, args) => angleMode = AngleMode.Radian;
            gradButton.Click += (s, args) => angleMode = AngleMode.Gradient;

            degRadGradPanel.Controls.Add(degButton, 0, 0);
            degRadGradPanel.Controls.Add(radButton, 1, 0);
            degRadGradPanel.Controls.Add(gradButton, 2, 0);

            mainContainer.Controls.Add(degRadGradPanel, 0, 1);
            mainContainer.SetColumnSpan(degRadGradPanel, 5);


            Button btnMc = CreateButton("MC");
            Button btnMr = CreateButton("MR");
            Button btnMs = CreateButton("MS");
            Button btnMp = CreateButton("M+");
            Button btnMm = CreateButton("M-");

            mainContainer.Controls.Add(btnMc, 5, 1);
            mainContainer.Controls.Add(btnMr, 6, 1);
            mainContainer.Controls.Add(btnMs, 7, 1);
            mainContainer.Controls.Add(btnMp, 8, 1);
            mainContainer.Controls.Add(btnMm, 9, 1);

            MyPanel emptyPanel = new MyPanel(DockStyle.Fill, Padding.Empty, Color.Transparent);

            emptyPanel.SetBorder(new Pen(calcBorderColor, 1));

            Button btnE         = CreateButton("e");
            Button btnLn        = CreateButton("ln");
            Button btnRnd       = CreateButton("Rnd");
            Button btnEToX      = CreateButton("eⁿ");
            Button btnBksp      = CreateButton("←");
            Button btnCE        = CreateButton("CE");
            Button btnC         = CreateButton("C");
            Button btnPlusMinus = CreateButton("±");
            Button btnSqrt      = CreateButton("√");

            mainContainer.Controls.Add(emptyPanel, 0, 2);
            mainContainer.Controls.Add(btnE, 1, 2);
            mainContainer.Controls.Add(btnLn, 2, 2);
            mainContainer.Controls.Add(btnRnd, 3, 2);
            mainContainer.Controls.Add(btnEToX, 4, 2);
            mainContainer.Controls.Add(btnBksp, 5, 2);
            mainContainer.Controls.Add(btnCE, 6, 2);
            mainContainer.Controls.Add(btnC, 7, 2);
            mainContainer.Controls.Add(btnPlusMinus, 8, 2);
            mainContainer.Controls.Add(btnSqrt, 9, 2);


            Button btnInt     = CreateButton("Int");
            Button btnSinh    = CreateButton("sinh");
            Button btnSin     = CreateButton("sin");
            Button btnXsquare = CreateButton("x²");
            Button btnFact    = CreateButton("n!");
            Button btn7       = CreateButton("7");
            Button btn8       = CreateButton("8");
            Button btn9       = CreateButton("9");
            Button btnDiv     = CreateButton("/");
            Button btnPercent = CreateButton("%");

            mainContainer.Controls.Add(btnInt, 0, 3);
            mainContainer.Controls.Add(btnSinh, 1, 3);
            mainContainer.Controls.Add(btnSin, 2, 3);
            mainContainer.Controls.Add(btnXsquare, 3, 3);
            mainContainer.Controls.Add(btnFact, 4, 3);
            mainContainer.Controls.Add(btn7, 5, 3);
            mainContainer.Controls.Add(btn8, 6, 3);
            mainContainer.Controls.Add(btn9, 7, 3);
            mainContainer.Controls.Add(btnDiv, 8, 3);
            mainContainer.Controls.Add(btnPercent, 9, 3);

            Button btnDms     = CreateButton("dms");
            Button btnCosh    = CreateButton("cosh");
            Button btnCos     = CreateButton("cos");
            Button btnXPowerN = CreateButton("xⁿ");
            Button btnYRootX  = CreateButton("ⁿ√x");
            Button btn4       = CreateButton("4");
            Button btn5       = CreateButton("5");
            Button btn6       = CreateButton("6");
            Button btnMult    = CreateButton("*");
            Button btn1ByX    = CreateButton("1/x");

            mainContainer.Controls.Add(btnDms, 0, 4);
            mainContainer.Controls.Add(btnCosh, 1, 4);
            mainContainer.Controls.Add(btnCos, 2, 4);
            mainContainer.Controls.Add(btnXPowerN, 3, 4);
            mainContainer.Controls.Add(btnYRootX, 4, 4);
            mainContainer.Controls.Add(btn4, 5, 4);
            mainContainer.Controls.Add(btn5, 6, 4);
            mainContainer.Controls.Add(btn6, 7, 4);
            mainContainer.Controls.Add(btnMult, 8, 4);
            mainContainer.Controls.Add(btn1ByX, 9, 4);


            Button btnPi         = CreateButton("Pi");
            Button btnTanh       = CreateButton("tanh");
            Button btnTan        = CreateButton("tan");
            Button btnXCube      = CreateButton("x³");
            Button btnThirdRootX = CreateButton("³√x");
            Button btn1          = CreateButton("1");
            Button btn2          = CreateButton("2");
            Button btn3          = CreateButton("3");
            Button btnMinus      = CreateButton("-");
            Button btnEquals     = CreateButton("=");

            mainContainer.Controls.Add(btnPi, 0, 5);
            mainContainer.Controls.Add(btnTanh, 1, 5);
            mainContainer.Controls.Add(btnTan, 2, 5);
            mainContainer.Controls.Add(btnXCube, 3, 5);
            mainContainer.Controls.Add(btnThirdRootX, 4, 5);
            mainContainer.Controls.Add(btn1, 5, 5);
            mainContainer.Controls.Add(btn2, 6, 5);
            mainContainer.Controls.Add(btn3, 7, 5);
            mainContainer.Controls.Add(btnMinus, 8, 5);
            mainContainer.Controls.Add(btnEquals, 9, 5);
            mainContainer.SetRowSpan(btnEquals, 2);


            CheckBox btnFE    = CreateCheckBox("F-E");
            Button   btnExp   = CreateButton("Exp");
            Button   btnMod   = CreateButton("Mod");
            Button   btnLog   = CreateButton("log");
            Button   btn10ToX = CreateButton("10ⁿ");
            Button   btn0     = CreateButton("0");
            Button   btnDot   = CreateButton(".");
            Button   btnPlus  = CreateButton("+");

            mainContainer.Controls.Add(btnFE, 0, 6);
            mainContainer.Controls.Add(btnExp, 1, 6);
            mainContainer.Controls.Add(btnMod, 2, 6);
            mainContainer.Controls.Add(btnLog, 3, 6);
            mainContainer.Controls.Add(btn10ToX, 4, 6);
            mainContainer.Controls.Add(btn0, 5, 6);
            mainContainer.SetColumnSpan(btn0, 2);
            mainContainer.Controls.Add(btnDot, 7, 6);
            mainContainer.Controls.Add(btnPlus, 8, 6);


            mainPanel.Controls.Add(mainContainer);
            this.Controls.Add(mainPanel);

            btnBksp.Click += (s, args) => {
                if (lblMain.Text.Length == 1)
                {
                    lblMain.Text = "0";
                }
                else
                {
                    lblMain.Text = lblMain.Text.Substring(0, lblMain.Text.Length - 1);
                }
            };
            btnCE.Click += (s, args) => {
                lblMain.Text = "0";
                if (isLastUnary)
                {
                    lblTemp.Text = unaryTemp;
                }
                unaryTemp = "";
                unaryExp  = "";
            };

            btnC.Click += (s, args) => {
                currentFunction = Function.None;
                lblMain.Text    = "0";
                lblTemp.Text    = "";
                unaryExp        = "";
                unaryTemp       = "";
            };
            btnEquals.Click += (s, args) => {
                current = Convert.ToDouble(lblMain.Text);
                EvaluatePending();
                lblTemp.Text    = "";
                currentFunction = Function.None;
                isOverwrite     = true;
            };
            btnDot.Click += (s, args) => { if (!isDecimal)
                                           {
                                               MainInput(".");
                                           }
                                           isDecimal = true; };

            btnPlusMinus.Click += (s, args) => {
                if (lblMain.Text[0] == '-')
                {
                    lblMain.Text = lblMain.Text.Substring(1);
                }
                else
                {
                    lblMain.Text = '-' + lblMain.Text;
                }
            };
            btnMs.Click += (s, args) => {
                userMemory        = Convert.ToDouble(lblMain.Text);
                lblMemory.Visible = true;
                isOverwrite       = true;
                isMemorySet       = true;
            };
            btnMc.Click += (s, args) => {
                userMemory        = 0;
                lblMemory.Visible = false;
                isMemorySet       = false;
            };
            btnMr.Click += (s, args) => {
                lblMain.Text = userMemory.ToString();
                isOverwrite  = true;
            };
            btnMp.Click += (s, args) => {
                if (isMemorySet)
                {
                    userMemory  += Convert.ToDouble(lblMain.Text);
                    lblMain.Text = userMemory.ToString();
                    isOverwrite  = true;
                }
            };
            btnMm.Click += (s, args) => {
                if (isMemorySet)
                {
                    userMemory  -= Convert.ToDouble(lblMain.Text);
                    lblMain.Text = userMemory.ToString();
                    isOverwrite  = true;
                }
            };


            btnFE.Click += (s, args) => {
                isScientific = btnFE.Checked;
                FunctionInputUnary(Function.Exponential);
                isOverwrite = true;
            };


            btn1.Click += (s, args) => MainInput("1");
            btn2.Click += (s, args) => MainInput("2");
            btn3.Click += (s, args) => MainInput("3");
            btn4.Click += (s, args) => MainInput("4");
            btn5.Click += (s, args) => MainInput("5");
            btn6.Click += (s, args) => MainInput("6");
            btn7.Click += (s, args) => MainInput("7");
            btn8.Click += (s, args) => MainInput("8");
            btn9.Click += (s, args) => MainInput("9");
            btn0.Click += (s, args) => MainInput("0");



            btnPlus.Click    += (s, args) => FunctionInput(Function.Addition);
            btnMinus.Click   += (s, args) => FunctionInput(Function.Subtraction);
            btnMult.Click    += (s, args) => FunctionInput(Function.Multiplication);
            btnDiv.Click     += (s, args) => FunctionInput(Function.Division);
            btnMod.Click     += (s, args) => FunctionInput(Function.Mod);
            btnXPowerN.Click += (s, args) => FunctionInput(Function.XToY);
            btnYRootX.Click  += (s, args) => FunctionInput(Function.YRootX);

            btn10ToX.Click      += (s, args) => FunctionInputUnary(Function.Power10);
            btnLog.Click        += (s, args) => FunctionInputUnary(Function.Log10);
            btnExp.Click        += (s, args) => FunctionInputUnary(Function.Exponential);
            btnThirdRootX.Click += (s, args) => FunctionInputUnary(Function.ThirdRootX);
            btnXCube.Click      += (s, args) => FunctionInputUnary(Function.XCube);
            btnTanh.Click       += (s, args) => FunctionInputUnary(Function.TanH);
            btnTan.Click        += (s, args) => FunctionInputUnary(Function.Tan);
            btnPi.Click         += (s, args) => FunctionInputUnary(Function.Pi);
            btnCosh.Click       += (s, args) => FunctionInputUnary(Function.CosH);
            btnCos.Click        += (s, args) => FunctionInputUnary(Function.Cos);
            btnSinh.Click       += (s, args) => FunctionInputUnary(Function.SinH);
            btnSin.Click        += (s, args) => FunctionInputUnary(Function.Sin);
            btnDms.Click        += (s, args) => FunctionInputUnary(Function.Dms);
            btnFact.Click       += (s, args) => FunctionInputUnary(Function.Factorial);
            btnXsquare.Click    += (s, args) => FunctionInputUnary(Function.XSquare);
            btnInt.Click        += (s, args) => FunctionInputUnary(Function.Int);
            btnLn.Click         += (s, args) => FunctionInputUnary(Function.LogE);
            btnRnd.Click        += (s, args) => FunctionInputUnary(Function.Random);
            btnEToX.Click       += (s, args) => FunctionInputUnary(Function.EToX);
            btnE.Click          += (s, args) => FunctionInputUnary(Function.E);
            btn1ByX.Click       += (s, args) => FunctionInputUnary(Function.OneByX);
            btnSqrt.Click       += (s, args) => FunctionInputUnary(Function.SquareRoot);
            btnPercent.Click    += (s, args) => FunctionInputUnary(Function.Percent);
        }
Exemple #11
0
        private void Init()
        {
            Text = "Facebook - Login & SignUp";
            MyTableLayoutPanel mainPanel = new MyTableLayoutPanel(2, 1, DockStyle.Fill);
            MyTableLayoutPanel topPanel  = new MyTableLayoutPanel(1, 3, DockStyle.Fill, new Padding(10), Color.DarkBlue)
            {
                AutoSize = true
            };

            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20));
            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));

            TableLayoutPanel loginContainer = new TableLayoutPanel()
            {
                RowCount    = 2,
                ColumnCount = 3,
                Dock        = DockStyle.Right,
                AutoSize    = true
            };

            loginContainer.Controls.Add(new Label()
            {
                Text      = "Email Or Phone",
                ForeColor = Color.White
            }, 0, 0);

            txtLoginMobile = new TextBox()
            {
            };

            loginContainer.Controls.Add(txtLoginMobile, 0, 1);

            loginContainer.Controls.Add(new Label()
            {
                Text      = "Password",
                ForeColor = Color.White
            }, 1, 0);

            txtLoginPassword = new TextBox()
            {
                PasswordChar = '*'
            };

            loginContainer.Controls.Add(txtLoginPassword, 1, 1);

            Button btnLogin = new Button()
            {
                Text      = "Log In",
                ForeColor = Color.White,
            };

            btnLogin.Click += BtnLogin_Click;

            loginContainer.Controls.Add(btnLogin, 2, 1);

            topPanel.Controls.Add(loginContainer, 2, 0);
            topPanel.Controls.Add(new Label()
            {
                Text      = "facebook",
                Font      = new Font("Helvetica", 30, FontStyle.Bold),
                ForeColor = Color.White,
                AutoSize  = true
            }, 1, 0);

            MyTableLayoutPanel bottomPanel = new MyTableLayoutPanel(1, 2, DockStyle.Fill);

            bottomPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            bottomPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            bottomPanel.SetGradientBackground(Color.White, System.Drawing.Color.FromArgb(211, 216, 232), 90f);

            Panel bottomLeftPanel = new Panel()
            {
                Dock                  = DockStyle.Fill,
                BackgroundImage       = Image.FromFile(Environment.CurrentDirectory + "\\Images\\bg.png"),
                BackgroundImageLayout = ImageLayout.Zoom
            };

            MyTableLayoutPanel bottomRightPanel = new MyTableLayoutPanel(10, 1, DockStyle.Fill);

            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            bottomRightPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            bottomRightPanel.AutoSize = true;

            bottomRightPanel.Controls.Add(new Label()
            {
                Text     = "Create an account",
                Font     = new Font("Helvetica", 20, FontStyle.Bold),
                AutoSize = true
            }, 0, 0);

            bottomRightPanel.Controls.Add(new Label()
            {
                Text     = "It's quick and easy.",
                Font     = new Font("Helvetica", 10),
                AutoSize = true
            }, 0, 1);

            txtName = new TextBox()
            {
                Text      = "First Name",
                Dock      = DockStyle.Fill,
                Font      = new Font("Helvetica", 15),
                ForeColor = Color.Gray
            };

            txtSurName = new TextBox()
            {
                Text      = "Surname",
                Dock      = DockStyle.Fill,
                Font      = new Font("Helvetica", 15),
                ForeColor = Color.Gray
            };

            txtMobile = new TextBox()
            {
                Text      = "Mobile Or Email",
                Dock      = DockStyle.Fill,
                Font      = new Font("Helvetica", 15),
                ForeColor = Color.Gray
            };

            txtPassword = new TextBox()
            {
                Text      = "New Password",
                Dock      = DockStyle.Fill,
                Font      = new Font("Helvetica", 15),
                ForeColor = Color.Gray
            };

            txtName.Enter     += (s, args) => txtName.Text = txtName.Text == "First Name" ? "" : txtName.Text;
            txtName.Leave     += (s, args) => txtName.Text = txtName.Text == "" ? "First Name" : txtName.Text;
            txtSurName.Enter  += (s, args) => txtSurName.Text = txtSurName.Text == "Surname" ? "" : txtSurName.Text;
            txtSurName.Leave  += (s, args) => txtSurName.Text = txtSurName.Text == "" ? "Surname" : txtSurName.Text;
            txtMobile.Enter   += (s, args) => txtMobile.Text = txtMobile.Text == "Mobile Or Email" ? "" : txtMobile.Text;
            txtMobile.Leave   += (s, args) => txtMobile.Text = txtMobile.Text == "" ? "Mobile Or Email" : txtMobile.Text;
            txtPassword.Enter += (s, args) => {
                if (txtPassword.Text == "New Password")
                {
                    txtPassword.Text         = "";
                    txtPassword.PasswordChar = '*';
                }
            };
            txtPassword.Leave += (s, args) => {
                if (txtPassword.Text == "")
                {
                    txtPassword.Text         = "New Password";
                    txtPassword.PasswordChar = '\0';
                }
            };

            MyTableLayoutPanel namePanel = new MyTableLayoutPanel(1, 2, DockStyle.Fill, new Padding(0, 5, 0, 5));

            namePanel.AutoSize = true;
            namePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            namePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            namePanel.Controls.Add(txtName, 0, 0);
            namePanel.Controls.Add(txtSurName, 1, 0);

            bottomRightPanel.Controls.Add(namePanel, 0, 2);
            bottomRightPanel.Controls.Add(txtMobile, 0, 3);
            bottomRightPanel.Controls.Add(txtPassword, 0, 4);

            GroupBox birthdayBox = new GroupBox()
            {
                Text     = "Birthday",
                Dock     = DockStyle.Fill,
                AutoSize = true,
                Padding  = new Padding(10)
            };

            dobPicker = new DateTimePicker()
            {
                Dock = DockStyle.Top
            };

            MyTableLayoutPanel radioButtonContainer = new MyTableLayoutPanel(1, 2, DockStyle.Fill);

            radioButtonContainer.AutoSize = true;
            radioButtonContainer.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            radioButtonContainer.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));

            male = new RadioButton()
            {
                Text    = "Male",
                Checked = true
            };
            female = new RadioButton()
            {
                Text = "Female"
            };

            radioButtonContainer.Controls.Add(male, 0, 0);
            radioButtonContainer.Controls.Add(female, 1, 0);

            birthdayBox.Controls.Add(dobPicker);

            bottomRightPanel.Controls.Add(birthdayBox, 0, 5);
            bottomRightPanel.Controls.Add(radioButtonContainer, 0, 6);

            bottomRightPanel.Controls.Add(new Label()
            {
                Text     = "By clicking Sign Up, you agree to our Terms, Data Policy and\nCookie Policy. You may receive SMS notifications from us and\ncan opt out at any time.",
                Font     = new Font("Helvetica", 8),
                AutoSize = true
            }, 0, 7);

            Button btnSignUp = new Button()
            {
                Text      = "Sign Up",
                Font      = new Font("Helvetica", 12, FontStyle.Bold),
                AutoSize  = true,
                ForeColor = Color.White,
                BackColor = System.Drawing.Color.FromArgb(95, 155, 76),
                Padding   = new Padding(15, 10, 15, 10)
            };

            bottomRightPanel.Controls.Add(btnSignUp, 0, 8);
            bottomPanel.Controls.Add(bottomLeftPanel, 0, 0);
            bottomPanel.Controls.Add(bottomRightPanel, 1, 0);
            mainPanel.Controls.Add(topPanel, 0, 0);
            mainPanel.Controls.Add(bottomPanel, 0, 1);

            this.Controls.Add(mainPanel);

            btnSignUp.Click += BtnSignUp_Click;
        }
Exemple #12
0
 public Form1()
 {
     this.Size = new Size(700, 500);
     this.FormClosing += Form1_FormClosing;
     {
         TLPmain = new MyTableLayoutPanel(2, 1, "PA", "P");
         {
             TXBoutput = new MyTextBox(true);
             TLPmain.AddControl(TXBoutput, 0, 0);
         }
         {
             TLPbtn = new MyTableLayoutPanel(1, 5, "A", $"AAAPS{Database.scopeSize.Width}");
             {
                 BTNstart = new MyButton("Start");
                 BTNstart.Click += BTNstart_Click;
                 TLPbtn.AddControl(BTNstart, 0, 0);
             }
             {
                 BTNscan = new MyButton("Scan");
                 BTNscan.Click += BTNscan_Click;
                 TLPbtn.AddControl(BTNscan, 0, 1);
             }
             {
                 CHBpressKey = new MyCheckBox("Press Key");
                 CHBpressKey.CheckedChanged += CHBpressKey_CheckedChanged;
                 CHBpressKey.Checked = true;
                 TLPbtn.AddControl(CHBpressKey, 0, 2);
             }
             {
                 LBL = new MyLabel("");
                 TLPbtn.AddControl(LBL, 0, 3);
             }
             {
                 PBX = new PictureBox();
                 PBX.Dock = DockStyle.Fill;
                 PBX.SizeMode = PictureBoxSizeMode.AutoSize;
                 TLPbtn.AddControl(PBX, 0, 4);
             }
             TLPmain.AddControl(TLPbtn, 1, 0);
         }
         this.Controls.Add(TLPmain);
     }
     socketHandler = new SocketHandler();
     socketHandler.logAppended += SocketHandler_logAppended;
     socketHandler.msgReceived += SocketHandler_msgReceived;
     {
         Thread thread = new Thread(() =>
         {
             int pre_count = 0;
             while (true)
             {
                 Thread.Sleep(5000);
                 if (socketHandler.dataConnectionCounter != pre_count) SocketHandler_logAppended((pre_count = socketHandler.dataConnectionCounter).ToString() + " communications");
             }
         });
         thread.IsBackground = true;
         thread.Start();
     }
     {
         Thread thread = new Thread(() =>
           {
               while (true)
               {
                   Thread.Sleep(500);
                   PBX.Invoke(new Action(() =>
                   {
                       var bmp = getFeedBackImage();
                       if (bmp == null) LBL.Text = "Unavailable";
                       else LBL.Text = (IsLive(bmp) ? "Alive" : "Dead");
                       var preImg = PBX.Image;
                       PBX.Image = bmp;
                       if (preImg != null) preImg.Dispose();
                   }));
               }
           });
         thread.IsBackground = true;
         thread.Start();
     }
Exemple #13
0
        public GamePanel(int _port, double fps)
        {
            this.Dock     = DockStyle.Fill;
            port          = _port;
            socketHandler = new SocketHandler(port);
            game          = new Game(socketHandler, new Random(Form1.public_random));
            //MessageBox.Show(Color.FromArgb(127,127,127).ToString());
            //this.Size = new Size(1200, 750);
            {
                TLPmain = new MyTableLayoutPanel(1, 2, "A", "S1P");
                {
                    TLPctrl          = new MyTableLayoutPanel(2, 1, "PP", "P");
                    TLPctrl.AutoSize = false;
                    {
                        TLPctrl.AddControl(game.controlPanel, 0, 0);
                    }
                    {
                        TXB = new MyTextBox(true);
                        TLPctrl.AddControl(TXB, 1, 0);
                    }
                    TLPmain.AddControl(TLPctrl, 0, 0);
                }
                {
                    PictureBox pbx = new PictureBox();
                    pbx.Image    = new Bitmap(pbx.Width, pbx.Height);
                    pbx.Dock     = DockStyle.Fill;
                    pbx.SizeMode = PictureBoxSizeMode.Zoom;

                    /*pbx.SizeChanged += (sender, e) =>
                     * {
                     *  SocketHandler_logAppended(pbx.Size.ToString());
                     *  pbx.Image.Dispose();
                     *  pbx.Image = new Bitmap(pbx.Width, pbx.Height);
                     * };*/
                    bool humanFriendly = true;
                    pbx.Click += (object sender, EventArgs e) =>
                    {
                        humanFriendly ^= true;
                    };
                    pbx.DoubleClick += Pbx_DoubleClick;
                    {
                        Thread thread = new Thread(() =>
                        {
                            while (true)
                            {
                                Thread.Sleep((int)Math.Ceiling(1000.0 / fps));
                                var bmp = (humanFriendly ? new Bitmap(pbx.Width, pbx.Height) : new Bitmap(game.imageFeedBackSize.Width, game.imageFeedBackSize.Height));
                                game.drawImage(bmp, humanFriendly);
                                Do(() =>
                                {
                                    //this.Text = bmp.Size.ToString();
                                    //{
                                    //    BitmapData bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                                    //    unsafe
                                    //    {
                                    //        byte *p=(byte*)bd.Scan0.ToPointer
                                    //    }
                                    //}
                                    var img   = pbx.Image;
                                    pbx.Image = bmp;
                                    img.Dispose();
                                });
                            }
                        });
                        thread.IsBackground = true;
                        thread.Start();
                    }
                    TLPmain.AddControl(pbx, 0, 1);
                }
                this.Controls.Add(TLPmain);
            }
            socketHandler.logAppended += SocketHandler_logAppended;
            socketHandler.msgReceived += SocketHandler_msgReceived;
            socketHandler.Start();
            {
                Thread thread = new Thread(() =>
                {
                    int pre_count = 0;
                    while (true)
                    {
                        Thread.Sleep(5000);
                        if (socketHandler.dataConnectionCounter != pre_count)
                        {
                            SocketHandler_logAppended((pre_count = socketHandler.dataConnectionCounter).ToString() + " communications");
                        }
                    }
                });
                thread.IsBackground = true;
                thread.Start();
            }
        }
Exemple #14
0
 private void InitializeControls()
 {
     this.FormClosing += Form1_FormClosing;
     {
         TLP = new MyTableLayoutPanel(5, 1, "PAAAA", "P");
         {
             {
                 LBL    = new MyLabel("");
                 status = "Q, W, O: control\r\nP: restart all";
                 TLP.AddControl(LBL, 0, 0);
             }
             {
                 MyTableLayoutPanel tlp = new MyTableLayoutPanel(1, 2, "A", "AA");
                 {
                     PBX          = new PictureBox();
                     PBX.Dock     = DockStyle.Fill;
                     PBX.SizeMode = PictureBoxSizeMode.AutoSize;
                     PBX.Image    = Properties.Resources.buttonDark;
                     tlp.AddControl(PBX, 0, 0);
                 }
                 {
                     Panel pnl = new Panel();
                     pnl.Dock         = DockStyle.Fill;
                     pnl.AutoSize     = true;
                     pnl.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                     PictureBox pbx = new PictureBox();
                     pbx.Dock     = DockStyle.Fill;
                     pbx.SizeMode = PictureBoxSizeMode.Zoom;
                     pbx.Image    = Properties.Resources.computer;
                     MyLabel lbl = new MyLabel("");
                     lbl.Font      = new Font("Consolas", 8, FontStyle.Bold);
                     lbl.Dock      = DockStyle.None;
                     lbl.ForeColor = Color.FromArgb(64, 0, 0, 0);
                     lbl.BackColor = Color.Transparent;
                     lbl.Parent    = pbx;
                     //{
                     //    Bitmap bmp = new Bitmap(1, 1);
                     //    bmp.SetPixel(0, 0, Color.Transparent);
                     //    lbl.BackgroundImage = bmp;
                     //}
                     //pnl.Controls.Add(lbl);
                     pnl.Controls.Add(pbx);
                     tlp.AddControl(pnl, 0, 1);
                     Thread thread = new Thread(() =>
                     {
                         Thread.Sleep(3000);
                         while (true)
                         {
                             Thread.Sleep(20);
                             StringBuilder s = new StringBuilder();
                             for (int i = 0; i < 10; i++)
                             {
                                 for (int j = 0; j < 30; j++)
                                 {
                                     s.Append(random.Next(0, 2) == 0 ? '0' : '1');
                                 }
                                 s.Append("\r\n");
                             }
                             lbl.Invoke(new Action(() => { lbl.Text = s.ToString(); }));
                         }
                     });
                     thread.IsBackground = true;
                     thread.Start();
                 }
                 TLP.AddControl(tlp, 1, 0);
             }
             {
                 TB         = new TrackBar();
                 TB.Dock    = DockStyle.Fill;
                 TB.Minimum = 0;
                 TB.Maximum = 1000;
                 TLP.AddControl(TB, 2, 0);
             }
             {
                 TXB              = new MyTextBox(false);
                 TXB.KeyDown     += Form1_KeyDown;
                 TXB.KeyUp       += Form1_KeyUp;
                 TXB.TextChanged += (object s, EventArgs e1) => { TXB.Text = null; };
                 TLP.AddControl(TXB, 3, 0);
             }
             {
                 IFD = new MyInputField();
                 IFD.AddField("Play speed (FPS)", FPS.ToString()).TextChanged += (object s, EventArgs e1) => {
                     double t;
                     if (!double.TryParse((s as TextBox).Text, out t))
                     {
                         MessageBox.Show("格式不正確");
                     }
                     else
                     {
                         FPS = t;
                     }
                 };
                 TLP.AddControl(IFD, 4, 0);
             }
         }
         this.Controls.Add(TLP);
     }
 }
Exemple #15
0
        public Form1()
        {
            //MessageBox.Show(Color.FromArgb(127,127,127).ToString());
            this.Size         = new Size(1200, 750);
            this.FormClosing += Form1_FormClosing;
            {
                MyTableLayoutPanel tlp = new MyTableLayoutPanel(1, 2, "A", "PP");
                {
                    TLP = new MyTableLayoutPanel(2, 1, "AP", "P");
                    {
                        TLP.AddControl(game.controlPanel, 0, 0);
                    }
                    {
                        TXB = new MyTextBox(true);
                        TLP.AddControl(TXB, 1, 0);
                    }
                    tlp.AddControl(TLP, 0, 0);
                }
                {
                    PictureBox pbx = new PictureBox();
                    pbx.Image    = new Bitmap(pbx.Width, pbx.Height);
                    pbx.Dock     = DockStyle.Fill;
                    pbx.SizeMode = PictureBoxSizeMode.Normal;

                    /*pbx.SizeChanged += (sender, e) =>
                     * {
                     *  SocketHandler_logAppended(pbx.Size.ToString());
                     *  pbx.Image.Dispose();
                     *  pbx.Image = new Bitmap(pbx.Width, pbx.Height);
                     * };*/
                    new Thread(() =>
                    {
                        while (true)
                        {
                            Thread.Sleep(500);
                            Do(() =>
                            {
                                var bmp   = new Bitmap(pbx.Width, pbx.Height);
                                this.Text = bmp.Size.ToString();
                                game.drawImage(bmp);
                                pbx.Image.Dispose();
                                pbx.Image = bmp;
                            });
                        }
                    }).Start();
                    tlp.AddControl(pbx, 0, 1);
                }
                this.Controls.Add(tlp);
            }
            socketHandler.logAppended += SocketHandler_logAppended;
            socketHandler.msgReceived += SocketHandler_msgReceived;
            socketHandler.Start();
            Thread thread = new Thread(() =>
            {
                int pre_count = 0;
                while (true)
                {
                    Thread.Sleep(5000);
                    if (socketHandler.dataConnectionCounter != pre_count)
                    {
                        SocketHandler_logAppended((pre_count = socketHandler.dataConnectionCounter).ToString() + " communications");
                    }
                }
            });

            thread.IsBackground = true;
            thread.Start();
        }