Пример #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>

        static void Main()
        {
            try
            {
                Application.Run(new MainForm(StopsToLoad.Stops));
            }
            catch (Exception)
            {
                // App crashing, reset the PDA.
                if (!s_attemptingQuit)
                {
                    HAL.Reset();
                }
            }
        }
Пример #2
0
 private void ThreadEntry()
 {
     try
     {
         while (!m_shouldStop)
         {
             System.Threading.Thread.Sleep(1000);
             MainRoutine();
         }
     }
     catch (Exception)
     {
         // This will crash the app, so restart the PDA.
         if (!MainForm.s_attemptingQuit)
         {
             HAL.Reset();
         }
     }
 }
Пример #3
0
 private void m_rebootButton_Click(object sender, System.EventArgs e)
 {
     HAL.Reset();
 }
Пример #4
0
        private void m_updateTimer_Tick(object sender, System.EventArgs e)
        {
            if (m_startupScreenDelay == 0 && m_splashPanel.Visible)
            {
                if (!m_checkedForUpdatesYet)
                {
                    // Check for update
                    string exePath   = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
                    string exeFolder = exePath.Substring(0, exePath.LastIndexOf("\\"));


                    NativeMethods.ProcessInfo pi;
                    byte[] si = new byte[128];
                    if (m_availableVersion.CompareTo(m_currentVersion) > 0)
                    {
                        // Newer version is available.
                        // Launch updater.
                        NativeMethods.CreateProcess(
                            Path.Combine(exeFolder, "BTUpdater.exe"),
                            BinaryName + " " + UpdateShare,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            false,
                            0,
                            IntPtr.Zero,
                            exeFolder,
                            si,
                            out pi);

                        Exit();
                        return;
                    }

                    m_checkedForUpdatesYet = true;
                }

                RefreshInfo();
                m_splashPanel.Visible = false;
                return;
            }
            else if (m_startupScreenDelay > 0)
            {
                m_startupScreenDelay--;
                return;
            }

            m_timeLabel.Text = DateTime.Now.ToString("h:mm tt");
            if (DateTime.Now.Second == 0)
            {
                RefreshInfo();
            }

            if (m_isOffline)
            {
                TimeSpan timeSinceWentOffline = DateTime.Now.Subtract(m_timeWentOffline);
                if (timeSinceWentOffline.TotalSeconds > OFFLINE_REBOOT_TIMEOUT)
                {
                    HAL.Reset();
                }
                else
                {
                    int    timeRemainingUntilReboot = OFFLINE_REBOOT_TIMEOUT - (int)timeSinceWentOffline.TotalSeconds;
                    string buttonCaption            = string.Format("REBOOT ({0})", timeRemainingUntilReboot);
                    m_rebootButton.Text = buttonCaption;
                }
            }
        }