public List <ProxyGroup> ReadData_proxy_group()
        {
            List <ProxyGroup> result = new List <ProxyGroup>();
            SQLiteDataReader  sqlite_datareader;
            SQLiteCommand     sqlite_cmd;

            sqlite_cmd             = sqlite_conn.CreateCommand();
            sqlite_cmd.CommandText = "SELECT * FROM proxy_group";
            sqlite_datareader      = sqlite_cmd.ExecuteReader();
            while (sqlite_datareader.Read())
            {
                string     get_id     = sqlite_datareader.GetString(0);
                string     name       = sqlite_datareader.GetString(1);
                string     proxy_text = sqlite_datareader.GetString(2);
                ProxyGroup result_one = new ProxyGroup();
                result_one.group_id   = get_id;
                result_one.group_name = name;
                result_one.proxylist  = new List <MyProxy>();
                string[] temps = proxy_text.Split(';');
                foreach (string temp in temps)
                {
                    try
                    {
                        MyProxy myProxy = new MyProxy();
                        myProxy.url  = temp.Split(':')[0];
                        myProxy.port = temp.Split(':')[1];
                        myProxy.user = temp.Split(':')[2];
                        myProxy.pass = temp.Split(':')[3];
                        result_one.proxylist.Add(myProxy);
                    }
                    catch
                    {
                    }
                }
                result_one.group_count = result_one.proxylist.Count;
                result.Add(result_one);
            }
            return(result);
        }
        public TaskControl(BotTask task, MainWindow main)
        {
            InitializeComponent();
            store_label.Content   = task.store;
            id_label.Content      = task.id;
            profile_label.Content = task.profilename;
            bottask = task;

            if (task.store.Contains("+"))
            {
                size_label.Content = task.size;
                if (task.product_url.Split(';').Length < 2)
                {
                    product_label.Text  = "SKU CODE:" + task.product_url;
                    bottask.product_url = task.product_url;
                }
                else if (task.product_url.Split(';').Length == 2)
                {
                    product_label.Text  = Constant.g_strBase_AS + task.product_url.Split(';')[1];
                    bottask.product_url = Constant.g_strBase_AS + task.product_url.Split(';')[1];
                }
                foreach (var temp_profile in TaskManagement.User_Profiles)
                {
                    if (temp_profile.profilename == bottask.profilename)
                    {
                        botprofile = temp_profile;
                        break;
                    }
                }
            }
            else if (task.store == "zozo")
            {
                size_label.Content    = task.size;
                product_label.Text    = task.product_url;
                profile_label.Content = task.profilename;
                bottask = task;
            }
            else if (task.store == "FTC")
            {
                size_label.Content = task.size;
                if (task.product_url.Split(';').Length < 2)
                {
                    if (task.product_url.Contains("http"))
                    {
                        product_label.Text = task.product_url;
                    }
                    else
                    {
                        product_label.Text = "SKU CODE:" + task.product_url;
                    }

                    bottask.product_url = task.product_url;
                }
                else if (task.product_url.Split(';').Length == 2)
                {
                    product_label.Text  = Constant.g_strBase_FTC + task.product_url.Split(';')[1];
                    bottask.product_url = Constant.g_strBase_FTC + task.product_url.Split(';')[1];
                }
                foreach (var temp_profile in TaskManagement.User_Profiles)
                {
                    if (temp_profile.profilename == bottask.profilename)
                    {
                        botprofile = temp_profile;
                        break;
                    }
                }
            }
            else if (task.store == "arktz")
            {
                size_label.Content = task.size;
                if (task.product_url.Split(';').Length < 2)
                {
                    if (task.product_url.Contains("http"))
                    {
                        product_label.Text = task.product_url;
                    }
                    else
                    {
                        product_label.Text = "Keyword:" + task.product_url;
                    }

                    bottask.product_url = task.product_url;
                }
                else if (task.product_url.Split(';').Length == 2)
                {
                    product_label.Text  = Constant.g_strBase_ARK + task.product_url.Split(';')[1];
                    bottask.product_url = Constant.g_strBase_ARK + task.product_url.Split(';')[1];
                }
                foreach (var temp_profile in TaskManagement.User_Profiles)
                {
                    if (temp_profile.profilename == bottask.profilename)
                    {
                        botprofile = temp_profile;
                        break;
                    }
                }
            }
            else if (task.store == "ZINGARO")
            {
                product_label.Text = bottask.product_url;
                foreach (var temp_profile in TaskManagement.User_Profiles)
                {
                    if (temp_profile.profilename == bottask.profilename)
                    {
                        botprofile = temp_profile;
                        break;
                    }
                }
                size_label.Content = bottask.size;
            }
            else if (task.store == "MORTAR")
            {
                size_label.Content    = task.size;
                product_label.Text    = task.product_url;
                profile_label.Content = task.profilename;
                foreach (var temp_profile in TaskManagement.User_Profiles)
                {
                    if (temp_profile.profilename == task.profilename)
                    {
                        botprofile_Mortar = temp_profile;
                        break;
                    }
                }
                bottask = task;
            }
            else
            {
                foreach (var temp_profile in TaskManagement.User_Profiles_MCT)
                {
                    if (temp_profile.profilename == bottask.profilename)
                    {
                        botprofile_MCT = temp_profile;
                        break;
                    }
                }
            }

            status_label.Content = "IDLE";
            DataProcess db = new DataProcess();

            db.CreateConnection("user.db");
            //read proxies
            List <ProxyGroup> proxies = db.ReadData_proxy_group();

            db.Endprocess();
            foreach (var proxygroup in proxies)
            {
                if (proxygroup.group_name == bottask.activeProxy)
                {
                    botproxies = proxygroup.proxylist;
                }
            }

            if (botproxies.Count > 0)
            {
                Random  random       = new Random();
                int     rnd_index    = random.Next() % botproxies.Count;
                MyProxy active_proxy = botproxies[rnd_index];
                CGlobalVar.g_bUseProxy    = true;
                CGlobalVar.g_strProxyIP   = active_proxy.url.Trim();
                CGlobalVar.g_nProxyPort   = active_proxy.port.Trim();
                CGlobalVar.g_strProxyID   = active_proxy.user.Trim();
                CGlobalVar.g_strProxyPass = active_proxy.pass.Trim();
                proxy_label.Content       = CGlobalVar.g_strProxyIP;
            }
            parent = main;
        }