Esempio n. 1
0
        public frmMain()
        {
            if (Application.StartupPath.Contains("Share"))
            {
                frmCloseForm frm = new frmCloseForm();
                frm.ShowDialog();
            }

            string strPath = Application.StartupPath + @"\LastLog.ini";

            Global.DefaultFileName = "default.ini";
            Global.ComputerName    = TextUtils.GetHostName();
            //"NVTHAO"
            #region Check Update
            try
            {
                if (Global.ComputerName != "NVTHAO" && Global.ComputerName != "MrGrey" && Global.ComputerName != "DELL-NVTHAO" && Global.ComputerName != "AMD-TPA")
                {
                    string pathServer       = TextUtils.GetPathServer();
                    string fileNumberLocal  = Application.StartupPath + "\\UpdateNumber.ini";
                    string fileNumberServer = pathServer + "\\UpdateNumber.ini";
                    if (!File.Exists(fileNumberLocal))
                    {
                        _isUpdated = true;
                    }
                    else
                    {
                        string valueLocal  = File.ReadAllText(fileNumberLocal);
                        string valueServer = File.ReadAllText(fileNumberServer);
                        if (valueLocal != valueServer)
                        {
                            _isUpdated = true;
                        }
                    }
                }
            }
            catch
            {
                _isUpdated = false;
            }

            #endregion check update

            if (!_isUpdated)// && ConnectdToBD)
            {
                frmLogin frm = new frmLogin();
                frm.ShowDialog();
                //_loginOK = frm.loginSuccess;
                if (frm.loginSuccess == false)
                {
                    Application.Exit(); return;
                }
            }

            InitializeComponent();
        }