예제 #1
0
        private void ایجادتبجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Creating MDI child form and initialize its fields


            var Dirs = Directory.GetDirectories(BaseAddress, "Bot_*").Where(x => Regex.IsMatch(Path.GetFileName(x), @"^Bot_[0123456789]{1,2}$")).Select(x => Convert.ToInt32(Path.GetFileName(x).Replace("Bot_", "")));

            if (Dirs.Any())
            {
                childCount = Dirs.OrderBy(x => x).Last() + 1;
            }
            else
            {
                childCount = 1;
            }
            int    id       = int.Parse(Helpers.Security.SecurityMethodes.GenerateRandomCode(8));
            string DataPath = BaseAddress + "\\Bot_" + childCount.ToString() + "\\";

            frmTelegramBot childForm = new frmTelegramBot(id, DataPath);

            //DAL.TabCount++;
            childForm.Text = "tab " + childCount.ToString();

            childForm.MdiParent   = this;
            childForm.WindowState = FormWindowState.Maximized;
            /// childForm.Siz
            //child Form will now hold a reference value to the tab control
            childForm.tabCtrl = tabControl1;

            //Add a Tabpage and enables it
            TabPage tp = new TabPage();

            tp.Parent = tabControl1;
            tp.Text   = childForm.Text;
            tp.Show();

            //child Form will now hold a reference value to a tabpage
            childForm.tabPag = tp;

            //Activate the MDI child form
            childForm.Show();
            childCount++;

            //Activate the newly created Tabpage
            tabControl1.SelectedTab = tp;
            //  Directory.CreateDirectory(Application.ExecutablePath + "//Satraps//Mangoodarz" + childCount.ToString());
        }
예제 #2
0
        public frmMain()
        {
            InitializeComponent();

            this.MinimumSize = new Size(905, 650);
            this.MaximumSize = new Size(905, 650);
            // tabControl1.RightToLeft = RightToLeft.Yes;
            //if (!Directory.Exists(BaseAddress + ))
            //{
            //    Directory.CreateDirectory(BaseAddress + "\\Satraps");
            //}
            var sargs = Directory.GetDirectories(BaseAddress, "Bot_*").Where(x => Regex.IsMatch(Path.GetFileName(x), @"^Bot_[0123456789]{1,2}$")).OrderBy(x => int.Parse(Path.GetFileName(x).Replace("Bot_", ""))).ToList();

            if (sargs.Count() <= 0)
            {
                //Creating MDI child form and initialize its fields
                //if (!File.Exists(BaseAddress + "\\Satrapi.exe") && !File.Exists(BaseAddress + "\\Satrapi"))
                //{
                //    MessageBox.Show(".در مسیر برنامه پیدا نشد" + "\"Satrapi.*\"" + "فایل ");
                //    return;
                //}

                var Dirs = Directory.GetDirectories(BaseAddress, "Bot_*").Where(x => Regex.IsMatch(Path.GetFileName(x), @"^Bot_[0123456789]{1,2}$")).Select(x => Convert.ToInt32(Path.GetFileName(x).Replace("Bot_", "")));

                //childCount = Dirs.OrderBy(x => x).Last() + 1;

                int    id       = int.Parse(Helpers.Security.SecurityMethodes.GenerateRandomCode(8));
                string DataPath = BaseAddress + "Bot_" + childCount.ToString() + "\\";

                frmTelegramBot childForm = new frmTelegramBot(id, DataPath);
                //DAL.TabCount++;
                childForm.Text = "tab " + childCount.ToString();

                childForm.MdiParent   = this;
                childForm.WindowState = FormWindowState.Maximized;
                /// childForm.Siz
                //child Form will now hold a reference value to the tab control
                childForm.tabCtrl = tabControl1;

                //Add a Tabpage and enables it
                TabPage tp = new TabPage();
                tp.Parent = tabControl1;
                tp.Text   = childForm.Text;
                tp.Show();

                //child Form will now hold a reference value to a tabpage
                childForm.tabPag = tp;

                //Activate the MDI child form
                childForm.Show();
                childCount++;

                //Activate the newly created Tabpage
                tabControl1.SelectedTab = tp;
                //  Directory.CreateDirectory(Application.ExecutablePath + "//Satraps//Mangoodarz" + childCount.ToString());
            }
            foreach (var item in sargs)
            {
                // DAL.TabCount++;
                int id = int.Parse(Helpers.Security.SecurityMethodes.GenerateRandomCode(8));
                // string DataPath = BaseAddress + "\\Satraps\\Mangoodarz" + childCount.ToString() + "\\";

                frmTelegramBot childForm = new frmTelegramBot(id, item);
                childForm.Text        = "tab " + Path.GetFileName(item).Replace("Bot_", "");
                childForm.MdiParent   = this;
                childForm.WindowState = FormWindowState.Maximized;
                /// childForm.Siz
                //child Form will now hold a reference value to the tab control
                childForm.tabCtrl = tabControl1;

                //Add a Tabpage and enables it
                TabPage tp = new TabPage();
                tp.Parent = tabControl1;
                tp.Text   = childForm.Text;
                tp.Show();

                //child Form will now hold a reference value to a tabpage
                childForm.tabPag = tp;

                //Activate the MDI child form
                childForm.Show();
                childCount++;

                //Activate the newly created Tabpage
                tabControl1.SelectedTab = tp;
                //  Directory.CreateDirectory(Application.ExecutablePath + "//Satraps//Mangoodarz" + childCount.ToString());
            }



            this.tabControl1.Dock                  = System.Windows.Forms.DockStyle.Top;
            this.tabControl1.Font                  = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tabControl1.Location              = new System.Drawing.Point(0, 0);
            this.tabControl1.Name                  = "tabControl1";
            this.tabControl1.SelectedIndex         = 0;
            this.tabControl1.Size                  = new System.Drawing.Size(1020, 30);
            this.tabControl1.SizeMode              = System.Windows.Forms.TabSizeMode.FillToRight;
            this.tabControl1.TabIndex              = 1;
            this.tabControl1.Visible               = false;
            this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
        }