Ejemplo n.º 1
0
 private void ShowAll_Click(object sender, EventArgs e)
 {
     foreach (var bot in bots)
     {
         MonitorServer.Send("show", bot.Port);
     }
     Log.Add("All bots are shown");
 }
Ejemplo n.º 2
0
 private void HideAll_Click(object sender, EventArgs e)
 {
     foreach (var bot in bots)
     {
         MonitorServer.Send("hide", bot.Port);
     }
     Log.Add("All bots are hidden");
 }
Ejemplo n.º 3
0
        private static void SendHello()
        {
            var port = 49001;

            for (int i = 1; i < 20; i++)
            {
                MonitorServer.Send("hello", port);

                port += 1;
            }
        }
Ejemplo n.º 4
0
        private void CreateTab()
        {
            tab.Text = Name;
            tab.UseVisualStyleBackColor = true;



            start.Text     = "Start";
            start.Anchor   = (AnchorStyles.Top | AnchorStyles.Right);
            start.Location = new Point(100, 10);
            start.Width    = 90;

            start.Click += (sender, args) =>
            {
                MonitorServer.Send("start", Port);
            };


            stop.Text     = "Stop";
            stop.Width    = 90;
            stop.Anchor   = (AnchorStyles.Top | AnchorStyles.Right);
            stop.Location = new Point(100, 40);

            stop.Click += (sender, args) =>
            {
                MonitorServer.Send("stop", Port);
            };



            if (Window)
            {
                hide_show.Text = "Hide";
            }
            else
            {
                hide_show.Text = "Show";
            }
            hide_show.Width    = 90;
            hide_show.Anchor   = (AnchorStyles.Top | AnchorStyles.Right);
            hide_show.Location = new Point(100, 70);

            hide_show.Click += (sender, args) =>
            {
                string msg;
                if (Window)
                {
                    msg = "hide";
                }
                else
                {
                    msg = "show";
                }
                MonitorServer.Send(msg, Port);

                hide_show.Text = Window ? "Hide" : "Show";
            };



            folder.Text     = "Logs folder";
            folder.Width    = 90;
            folder.Anchor   = (AnchorStyles.Top | AnchorStyles.Right);
            folder.Location = new Point(100, 100);

            folder.Click += (sender, args) =>
            {
                try
                {
                    Process.Start("explorer.exe", Path_to_dir + "\\logs");
                }
                catch (Exception)
                {
                }
            };



            launch.Text     = "Launch bot";
            launch.Width    = 90;
            launch.Anchor   = (AnchorStyles.Top | AnchorStyles.Right);
            launch.Location = new Point(100, 130);

            launch.Click += (sender, args) =>
            {
                try
                {
                    ProcessStartInfo processStartInfo = new ProcessStartInfo(Path_to_dir + "\\BoomTrader_2.exe")
                    {
                        WorkingDirectory = Path_to_dir
                    };

                    Process.Start(processStartInfo);
                }
                catch (Exception ex)
                {
                    Log.Add(ex.Message);
                }
            };

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));

            var dcol = new DataGridViewTextBoxColumn
            {
                HeaderText = "Date",
                Name       = "date"
            };

            resources.ApplyResources(dcol, "date");


            var mcol = new DataGridViewTextBoxColumn
            {
                Width        = 150,
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
                HeaderText   = "Message",
                Name         = "message"
            };

            resources.ApplyResources(mcol, "message");

            //progress.Anchor = (AnchorStyles.Top| AnchorStyles.Left | AnchorStyles.Right);



            logs.AllowUserToAddRows          = false;
            logs.AllowUserToDeleteRows       = false;
            logs.AllowUserToResizeColumns    = false;
            logs.AllowUserToResizeRows       = false;
            logs.SelectionMode               = DataGridViewSelectionMode.FullRowSelect;
            logs.BackgroundColor             = System.Drawing.SystemColors.ControlLightLight;
            logs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            logs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                dcol,
                mcol
            });
            //resources.ApplyResources(logs, "logs");
            logs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
            logs.Name     = "logs";
            logs.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
            logs.RowHeadersVisible     = false;
            logs.Location = new Point(3, 269);
            logs.Size     = new Size(mf.Width - 54, 160);

            progress.ForeColor = Color.Black;
            progress.Height    = 18;
            progress.Location  = new Point(info.Width + 9, logs.Location.Y - progress.Height - mf.tabs.Padding.Y * 2);
            progress.Value     = 0;
            progress.Width     = mf.Width - info.Width - 3 * 20;


            tab.Controls.Add(start);
            tab.Controls.Add(stop);
            tab.Controls.Add(hide_show);
            tab.Controls.Add(launch);
            tab.Controls.Add(folder);
            tab.Controls.Add(logs);
            tab.Controls.Add(progress);
            mf.tabs.TabPages.Add(tab);
        }