Beispiel #1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Usuarios us = new Usuarios( TxtLogin.Text , TxtPassword.Text );
                if ( us.Existe )
                {
                    new Parser( ).InitValues( us.Privilegios );

                    Hide( );

                    mainForm main = new mainForm( );
                    Thread thread = new Thread( new ThreadStart( Splash ) );
                    thread.Start( );
                    Thread.Sleep( 6000 );
                    thread.Abort( );

                    main.UsActual = us;
                    main.Show( );
                    ConexionBD.UsuarioActual = us;
                }
                else
                {
                    MessageBox.Show( "El Login y/o el Password son incorrectos" , "Atención" , MessageBoxButtons.OK , MessageBoxIcon.Information );
                }
            }
            catch ( Exception ex)
            {
                log.Error( ex.Message , ex );
                alertControl.Show( this , "Hubo un error" , ex.Message , Image );
            }
        }
 public void Start(mainForm parent)
 {
     this.parent = parent;
     Log.AddToConsole("Uruchamianie serwera", "server");
     serverThread = new Thread(new ThreadStart(ReceivePackets));
     serverThread.IsBackground = true;
     serverThread.Start();
 }
Beispiel #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            mainForm mainForm = new mainForm();
            mainForm.Show();

            while (mainForm.Created)
            {
                Application.DoEvents();

            }
        }
Beispiel #4
0
        public Secondarythread(mainForm form, SemaphoreSlim semaphore)
        {
            this.form = form;
            this.cmdSemaphore = semaphore;
            this.productBirdfarmSem = new SemaphoreSlim(0);
            this.productMainSectionSem = new SemaphoreSlim(0);
            this.productAirplaneSem = new SemaphoreSlim(0);
            this.productNavalGunSem = new SemaphoreSlim(0);

            this.mainSectionSem = new SemaphoreSlim(0);
            this.airplaneSem = new SemaphoreSlim(0);
            this.navalGunSem = new SemaphoreSlim(0);

            this._MainSectionQueue = new System.Collections.Queue();
            this._AirplaneQueue = new System.Collections.Queue();
            this._NavalGunQueue = new System.Collections.Queue();
        }
 public buildMainSectionThread(mainForm form)
 {
     this.form = form;
 }
 private void okButton_Click(object sender, EventArgs e)
 {
     mainForm main = new mainForm();
     this.Hide();
     main.Show();
 }
Beispiel #7
0
 public alarmForm(mainForm frm)
 {
     InitializeComponent();
     mainform       = frm;
     alarmName.Text = "-";
 }
Beispiel #8
0
 public GameStateManager(mainForm game)
 {
     this.game = game;
     states = new List<GameState>();
 }
 public buildAirplaneThread(mainForm form)
 {
     this.form = form;
 }
 public buildNavalGunThread(mainForm form)
 {
     this.form = form;
 }
        private mainForm mForm; //< mForm, Holds parent form

        /***
         * AddNewTeamForm Constructor
         * sets mForm
         **/
        public AddNewTeamForm(mainForm _form )
        {
            InitializeComponent();
            mForm = _form;
        }
Beispiel #12
0
 public rulesForm(mainForm mf)
 {
     InitializeComponent();
     main = mf;
     createListBox();
 }
 /***
  * AddNewPlayerForm Constructor
  * sets mForm
  **/
 public AddNewPlayerForm(mainForm _form)
 {
     InitializeComponent();
     mform = _form;
 }
Beispiel #14
0
 public bool isValidTarget(mainForm main_form)
 {
     return(targetCurrentHP == targetMaxHP && checkIfInRange(main_form) && !targetName.Contains("NoTarget") && !(main_form.cbUseWhitelist.Checked && !main_form.lbWhitelist.Items.Contains(targetName)));
 }
Beispiel #15
0
 public static void InitializeInput(mainForm form1)
 {
     dIDevice = new DIDevice(SystemGuid.Keyboard);
     dIDevice.SetCooperativeLevel(form1, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
     dIDevice.Acquire();
 }
Beispiel #16
0
 public bool doTask(mainForm main_form, Player player)
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
 public static void SetForm(mainForm formToSet)
 {
     mainForm = formToSet;
 }
 private void VehicleButton_Click(object sender, EventArgs e)
 {
     mainForm mainFormObj = new mainForm();
     mainFormObj.Show();
     this.Hide();
 }
Beispiel #19
0
 public WebCrawler(mainForm main)
 {
     InitializeComponent();
     this.main = main;
 }
 public buildBirdfarmThread(mainForm form)
 {
     this.form = form;
 }
Beispiel #21
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txbUserName.Text == "" || txbPass.Text == "")
            {
                MessageBox.Show("Vui lòng kiểm điền đầy đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #region Khai báo request
            xNet.HttpRequest request = new xNet.HttpRequest();
            request.KeepAlive = true;
            request.Cookies   = new CookieDictionary();
            request.AddHeader(HttpHeader.Accept, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            request.AddHeader(HttpHeader.AcceptLanguage, "en-US,en;q=0.5");
            request.UserAgent = Http.ChromeUserAgent();
            #endregion
            string userName = txbUserName.Text;
            string login    = request.Get(domain + "Login/?RequestKey=" + md5(md5(GetHDDSerialNumber()) + "handsome") + "&MachineSerial=" + md5(GetHDDSerialNumber()) + "&UserName="******"&PassWord="******"\"", "") == "Error")
            {
                MessageBox.Show("Truy cập không hợp lệ!");
                return;
            }


            if (login.Equals("true"))
            {
                //login success
                string serial = GetHDDSerialNumber();

                Settings.Default.UserName   = txbUserName.Text;
                Settings.Default.PassWord   = txbPass.Text;
                Settings.Default.isRemember = true;
                Settings.Default.Save();


                string check = request.Get(fLogin.domain + "SelectMachine/?RequestKey=" + md5(md5(GetHDDSerialNumber()) + "handsome") + "&MachineSerial=" + md5(GetHDDSerialNumber()) + "&SoftIndex=" + fLogin.softIndex).ToString();
                check = check.Replace("\"", "");
                if (check == "Error")
                {
                    MessageBox.Show("Truy cập không hợp lệ!!!");
                    return;
                }

                String[] x  = check.Split('|');
                bool     kt = true;
                if (request.Get(fLogin.domain + "CheckExpired/?MachineSerial=" + md5(GetHDDSerialNumber()) + "&SoftIndex=" + fLogin.softIndex).ToString() == "true")
                {
                    kt = false;
                    MessageBox.Show("Phần mềm đã hết hạn sử dụng, vui lòng liên hệ với bộ phận hỗ trợ của MIN SOFTWARE để gia hạn!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Process.Start("chrome.exe", "https://www.facebook.com/minsoftware.vn/");
                }
                else
                if (request.Get(fLogin.domain + "CheckActive/?MachineSerial=" + md5(GetHDDSerialNumber()) + "&SoftIndex=" + fLogin.softIndex).ToString() == "true")
                {
                    kt = false;
                    MessageBox.Show("Thiết bị của bạn đã bị vô hiệu hóa, vui lòng liên hệ với bộ phận hỗ trợ của MIN SOFTWARE để biết thêm thông tin chi tiết!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Process.Start("chrome.exe", "https://www.facebook.com/minsoftware.vn/");
                }

                if (x[0] == "true")
                {
                    if (kt)
                    {
                        MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);


                        //Insert data to CustomerLog
                        string insert = request.Post(fLogin.domain + "AddCustomerLog/?Id_Soft=" + fLogin.softIndex + "&MachineSerial=" + md5(GetHDDSerialNumber()) + "&UserName="******"\"", "") == "true")
                        {
                            mainForm f = new mainForm(Convert.ToDateTime(x[1]).ToString("dd-MM-yyyy"));
                            this.Hide();
                            f.Show();
                        }
                        else
                        {
                            MessageBox.Show("Đã có lỗi xảy ra, vui lòng thử lại sau!");
                        }
                    }
                }
                else
                {
                    //add machine to table wait
                    if (MessageBox.Show("Thiết bị của bạn chưa được kích hoạt, bạn có muốn gửi yêu cầu kích hoạt tới Admin?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        string checkSent = request.Get(domain + "SelectMachineWait/?RequestKey=" + md5(md5(GetHDDSerialNumber()) + "handsome") + "&MachineSerial=" + md5(serial) + "&SoftIndex=" + softIndex).ToString();

                        if (checkSent.Equals("true"))
                        {
                            MessageBox.Show("Bạn đã gửi yêu cầu trước đó, vui lòng liên hệ admin để được kích hoạt!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            try
                            {
                                Process.Start("chrome.exe", "https://www.facebook.com/minsoftware.vn/");
                            }
                            catch { }
                            return;
                        }
                        else
                        {
                            string sendRequest = request.Post(domain + "AddMachine/?MachineSerial=" + md5(GetHDDSerialNumber()) + "&SoftIndex=" + softIndex + "&UserName="******"\"", "") == "true")
                            {
                                MessageBox.Show("Gửi yêu cầu thành công, vui lòng liên hệ admin để được kích hoạt!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                try
                                {
                                    Process.Start("chrome.exe", "https://www.facebook.com/minsoftware.vn/");
                                }
                                catch { }
                            }
                            else
                            {
                                MessageBox.Show("Đã có lỗi xảy ra, vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Tài khoản hoặc mật khẩu không đúng, vui lòng kiểm tra lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }