public MainForm()
        {
            data_set_CalanderReports = new DataSet();
            data_set_salesman_list = new DataSet();
            data_set_salesman_report = new DataSet();
            mycurrencylist = new CurrencyList();
            loginform = new Login();
            viewrates = new ViewRates();
            calanderreports = new CalanderReports();
            salesmanreports = new SalesManReports();
            simpl = new ServerImplementation();
            curlist = new CurrencyList();
            simpl.Start_Server_Manually();

            RefreshSalesManList();

            InitializeComponent();
            this.menuStrip1.Visible = false;
            this.toolStrip1.Visible = false;
            LoadLoginForm();
            Add_All_Action_Listners();

            // for bypass login window in devlopment mode
            loginform.textBoxUsername.Text = "admin";//--
            loginform.textBoxPass.Text = "admin";//--
            LoginForm_Button_Login();//--
        }
        public Form1()
        {
            sim = new ServerImplementation();
            f2 = new Form2();
            psf = new ProxySettingsForm();
            InitializeComponent();
            OnClickMainView();
            psf.textBoxIP.Text = sim.rates_ip;
            psf.textBoxPort.Text = sim.rates_port;
            f2.buttonStop.Enabled = false;
            f2.buttonRefresh.Enabled = false;
            AddAllActionListener();
            f2.buttonStart.Click += delegate(object o, EventArgs eg)
            {
                /*new Thread(() =>
                {*/
                    f2.buttonStart.Enabled = false;
                    f2.buttonStop.Enabled = false;
                    f2.buttonRefresh.Enabled = false;
                if (sim.Start_Server_Manually(2222))
                {
                    f2.buttonStop.Enabled = true;
                    f2.buttonRefresh.Enabled = true;
                }
                else {
                     f2.buttonStart.Enabled = true;
                }
                //}).Start();
                //MessageBox.Show("Server..Run");//--
            };
            f2.buttonStop.Click += delegate(object o, EventArgs eg)
            {
                /*new Thread(() =>
                {*/
                    f2.buttonStop.Enabled = false;
                    f2.buttonRefresh.Enabled = false;
                    f2.buttonStart.Enabled = false;
                    if (sim.Stop_Server_Manually())
                    {
                        f2.buttonStart.Enabled = true;
                    }
                    else
                    {
                        //f2.buttonStop.Enabled = true;
                        //f2.buttonRefresh.Enabled = true;
                    }
                //}).Start();
                //MessageBox.Show("Server..Stop");//--
            };
            f2.buttonRefresh.Click += delegate(object o, EventArgs eg)
            {
                //Thread t1=
                /*new Thread(() =>
                {*/
                    f2.buttonRefresh.Enabled = false;
                    f2.buttonStop.Enabled = false;
                    f2.buttonStart.Enabled = false;
                    f2.Label_Left.Text = "Please wait";
                    if (sim.Update_PKR_Rates())
                    {
                        f2.Label_Left.Text = ServerImplementation.Update_Rates_Base_State + " currencies rates updated";
                    }
                    else {
                        f2.Label_Left.Text = "Cant Update Fully";
                    }
                    f2.buttonStop.Enabled = true;
                    f2.buttonRefresh.Enabled = true;
                //}).Start();
               /* new Thread(
                    () =>
                    {
                        int i = 0;
                        f2.progressBar1.Value = 0;
                        f2.progressBar1.Maximum = ServerImplementation.Total_Currencies;

                        //f2.progressBar1.Visible = true;
                        f2.progressBar1.Show();
                            //ServerImplementation.Update_Rates_Base_State;
                        int change=i;
                        while (i < ServerImplementation.Total_Currencies) {
                            while (true) {
                                change = ServerImplementation.Update_Rates_Base_State;
                                if (change == i)
                                {
                                    continue;
                                }
                                else {
                                    i = change;
                                    f2.progressBar1.Value = i;
                                    f2.progressBar1.Refresh();
                                    break;
                                }

                                //Thread.CurrentThread.
                            }

                        }
                    }).Start();
                 */
                //MessageBox.Show("Server..Run");//--
            };
        }
        public Form1()
        {
            sim = new ServerImplementation();
            f2  = new Form2();
            psf = new ProxySettingsForm();
            InitializeComponent();
            OnClickMainView();
            psf.textBoxIP.Text       = sim.rates_ip;
            psf.textBoxPort.Text     = sim.rates_port;
            f2.buttonStop.Enabled    = false;
            f2.buttonRefresh.Enabled = false;
            AddAllActionListener();
            f2.buttonStart.Click += delegate(object o, EventArgs eg)
            {
                /*new Thread(() =>
                 * {*/
                f2.buttonStart.Enabled   = false;
                f2.buttonStop.Enabled    = false;
                f2.buttonRefresh.Enabled = false;
                if (sim.Start_Server_Manually(2222))
                {
                    f2.buttonStop.Enabled    = true;
                    f2.buttonRefresh.Enabled = true;
                }
                else
                {
                    f2.buttonStart.Enabled = true;
                }
                //}).Start();
                //MessageBox.Show("Server..Run");//--
            };
            f2.buttonStop.Click += delegate(object o, EventArgs eg)
            {
                /*new Thread(() =>
                 * {*/
                f2.buttonStop.Enabled    = false;
                f2.buttonRefresh.Enabled = false;
                f2.buttonStart.Enabled   = false;
                if (sim.Stop_Server_Manually())
                {
                    f2.buttonStart.Enabled = true;
                }
                else
                {
                    //f2.buttonStop.Enabled = true;
                    //f2.buttonRefresh.Enabled = true;
                }
                //}).Start();
                //MessageBox.Show("Server..Stop");//--
            };
            f2.buttonRefresh.Click += delegate(object o, EventArgs eg)
            {
                //Thread t1=

                /*new Thread(() =>
                 * {*/
                f2.buttonRefresh.Enabled = false;
                f2.buttonStop.Enabled    = false;
                f2.buttonStart.Enabled   = false;
                f2.Label_Left.Text       = "Please wait";
                if (sim.Update_PKR_Rates())
                {
                    f2.Label_Left.Text = ServerImplementation.Update_Rates_Base_State + " currencies rates updated";
                }
                else
                {
                    f2.Label_Left.Text = "Cant Update Fully";
                }
                f2.buttonStop.Enabled    = true;
                f2.buttonRefresh.Enabled = true;
                //}).Start();

                /* new Thread(
                 *   () =>
                 *   {
                 *       int i = 0;
                 *       f2.progressBar1.Value = 0;
                 *       f2.progressBar1.Maximum = ServerImplementation.Total_Currencies;
                 *
                 *       //f2.progressBar1.Visible = true;
                 *       f2.progressBar1.Show();
                 *           //ServerImplementation.Update_Rates_Base_State;
                 *       int change=i;
                 *       while (i < ServerImplementation.Total_Currencies) {
                 *           while (true) {
                 *               change = ServerImplementation.Update_Rates_Base_State;
                 *               if (change == i)
                 *               {
                 *                   continue;
                 *               }
                 *               else {
                 *                   i = change;
                 *                   f2.progressBar1.Value = i;
                 *                   f2.progressBar1.Refresh();
                 *                   break;
                 *               }
                 *
                 *               //Thread.CurrentThread.
                 *           }
                 *
                 *       }
                 *   }).Start();
                 */
                //MessageBox.Show("Server..Run");//--
            };
        }