private void group_delete_Click(object sender, RoutedEventArgs e)
        {
            DataProcess db = new DataProcess();

            db.CreateConnection("user.db");
            db.RemoveData_proxy_group(group_id_show.Text.Trim());
            db.Endprocess();
            mainwindow.Refresh_Proxy_Group_list();
        }
        public EditTask(BotTask botTask, TaskControl mainControl)
        {
            InitializeComponent();
            old_task = botTask;
            parent   = mainControl;
            txtEditProductURL.Text = botTask.product_url;
            txtEditSize.Text       = botTask.size;
            DataProcess db = new DataProcess();

            db.CreateConnection("user.db");
            List <string> proxy_names = db.Read_proxy_group_name();

            db.Endprocess();
            List <Profile>    profiles        = TaskManagement.User_Profiles;
            List <ProfileMCT> profiles_MCT    = TaskManagement.User_Profiles_MCT;
            List <Profile>    profiles_Mortar = TaskManagement.User_Profiles;

            cmbEditProxy.ItemsSource   = proxy_names;
            cmbEditProxy.SelectedIndex = proxy_names.IndexOf(botTask.activeProxy);
            List <string> profile_names = new List <string>();

            List <string> AS_payment = new List <string>()
            {
                "Credit Card", "Cash on Delivery"
            };

            switch (botTask.store)
            {
            case "A+S":
                foreach (var profile in profiles)
                {
                    if (profile.store == "A+S")
                    {
                        cmbEditProfile.Items.Add(profile.profilename);
                        profile_names.Add(profile.profilename);
                    }
                }
                cmbPayment.ItemsSource = AS_payment;
                break;

            case "MORTAR":
                foreach (var profile in profiles)
                {
                    if (profile.store == "MORTAR")
                    {
                        cmbEditProfile.Items.Add(profile.profilename);
                        profile_names.Add(profile.profilename);
                    }
                }
                cmbPayment.Items.Add("Credit Card");
                break;

            case "MCT":
                foreach (var profile in profiles_MCT)
                {
                    cmbEditProfile.Items.Add(profile.profilename);
                    profile_names.Add(profile.profilename);
                }
                cmbPayment.Items.Add("Credit Card");
                break;

            case "zozo":
                break;

            case "arktz":
                foreach (var profile in profiles)
                {
                    if (profile.store == "ARK")
                    {
                        cmbEditProfile.Items.Add(profile.profilename);
                        profile_names.Add(profile.profilename);
                    }
                }
                cmbPayment.ItemsSource = AS_payment;
                break;

            case "ZINGARO":
                foreach (var profile in profiles)
                {
                    if (profile.store == "Zingaro")
                    {
                        cmbEditProfile.Items.Add(profile.profilename);
                        profile_names.Add(profile.profilename);
                    }
                }
                cmbPayment.Items.Add("Credit Card");
                break;
            }
            cmbEditProfile.SelectedIndex = profile_names.IndexOf(botTask.profilename);
            cmbPayment.SelectedIndex     = botTask.cardtype;
        }
        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;
        }