Ejemplo n.º 1
0
 private void backgroundTask_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (FilesToDownload != null && FilesToDownload.Count > 0)
     {
         bool halt = false;
         this.Close();
         if (currentFile < FilesToDownload.Count)
         {
             MessageBox.Show("ERROR DOWNLOAD FILE !!", "ERROR");
             halt = true;
         }
         if (isOpening)
         {
             using (login loginPage = new login())
             {
                 loginPage.Owner = this;
                 if (!halt)
                 {
                     loginPage.ShowDialog();
                 }
                 else
                 {
                     loginPage.exit_btn.PerformClick();
                 }
             }
         }
     }
     else
     {
         this.Close();
         if (isOpening)
         {
             using (login loginPage = new login())
             {
                 loginPage.Owner = this;
                 loginPage.ShowDialog();
             }
         }
     }
 }
Ejemplo n.º 2
0
        public main_page()
        {
            InitializeComponent();

            //File.WriteAllText(GF.path, String.Empty);

            GF.doDebug("===== MAIN FORM :: " + this.Name + " IS OPENED =====");
            this.FormClosing += (s, e) =>
            {
                GF.doDebug("===== MAIN FORM :: " + this.Name + " IS CLOSED =====");
            };

            GF.mainPage = this;

            GF.initLoading();
            GF.showLoading(this);
            DB.initLocalVars();

            switch (CultureInfo.CurrentCulture.Name)
            {
            case "th-TH":
            case "en-US":
                GF.dateSep     = "/";
                GF.thousandSep = ",";
                GF.decimalSep  = ".";
                break;

            case "ru-RU":
                GF.dateSep     = ".";
                GF.thousandSep = " ";
                GF.decimalSep  = ",";
                break;
            }

            using (clock = new Timer())
            {
                clock.Enabled  = true;
                clock.Interval = 100;
                int count = 0;
                clock.Tick += (s, ee) =>
                {
                    count++;
                    uint             idleTime      = 0;
                    GF.LASTINPUTINFO lastInputInfo = new GF.LASTINPUTINFO();
                    lastInputInfo.cbSize = (uint)Marshal.SizeOf(lastInputInfo);
                    lastInputInfo.dwTime = 0;

                    uint envTicks = (uint)Environment.TickCount;

                    if (GF.GetLastInputInfo(ref lastInputInfo))
                    {
                        uint lastInputTick = lastInputInfo.dwTime;

                        idleTime = envTicks - lastInputTick;
                    }
                    //GF.doDebug(">>>>>>>>>> " + idleTime.ToString());
                    if (Math.Floor(Convert.ToDouble(idleTime / 1000)) >= (10 * 60))
                    {
                        logOutTopToolStripMenuItem.PerformClick();
                    }

                    String language_txt = InputLanguage.CurrentInputLanguage.Culture.EnglishName;
                    if (language_txt.ToUpper().IndexOf("ENGLISH") != -1)
                    {
                        language_txt = "ENGLISH";
                    }
                    if (language_txt.ToUpper().IndexOf("THAI") != -1)
                    {
                        language_txt = "ไทย";
                    }
                    if (language_txt.ToUpper().IndexOf("RUSSIAN") != -1)
                    {
                        language_txt = "РУССКИЙ";
                    }
                    language.Text = language_txt;

                    if (count % 10 == 0)
                    {
                        timenow.Text = GF.NOW();
                        count        = 0;
                    }
                    GF.ClickButtonLabeledOK("Hotel lock system interface");
                };
            }

            if (!GF.is_logged_in)
            {
                this.Hide();

                /*if (!DB.skipFileCheck)
                 * {
                 *  using (progress progressPage = new progress())
                 *  {
                 *      progressPage.Owner = this;
                 *      progressPage.ShowDialog();
                 *  }
                 * }
                 * else
                 * {*/
                using (login loginPage = new login())
                {
                    loginPage.Owner = this;
                    GF.closeLoading();
                    loginPage.ShowDialog();
                }
                //}
            }
        }