コード例 #1
0
        /// <summary>
        /// Browse the folder
        /// </summary>
        /// <param name="startIndex">start index</param>
        /// <param name="requestedCount">requested count</param>
        /// <param name="userAgent">user agent</param>
        /// <returns>the browse result</returns>
        public override BrowseResult Browse(uint startIndex, uint requestedCount, UserAgent userAgent)
        {
            if (Path == null)
            {
                BrowseResult browseResult = new BrowseResult();
                AddFolder(browseResult, startIndex, requestedCount, Resources.Cancel, "ShutdownCancel");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 30), "Shutdown30");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 60), "Shutdown60");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 90), "Shutdown90");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 120), "Shutdown120");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 180), "Shutdown180");
                AddFolder(browseResult, startIndex, requestedCount, String.Format(Resources.InXMinutes, 240), "Shutdown240");
                AddFolder(browseResult, startIndex, requestedCount, Resources.ShutdownImmediatly, "Shutdown");
                AddFolder(browseResult, startIndex, requestedCount, Resources.Restart, "Restart");
                return(browseResult);
            }

            ShutdownTimer.Stop();
            TickCount = null;
            switch (Path)
            {
            case "ShutdownCancel":
                break;

            case "Shutdown":
                OnShutdown();
                break;

            case "Restart":
                OnShutdown(true);
                break;

            default:
                ShutdownTimer.Interval = Int32.Parse(Path.Substring(8)) * 60000;
                TickCount = Environment.TickCount;
                ShutdownTimer.Start();
                break;
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// ShutdownTimer设定与取消逻辑控制
        /// </summary>
        private void SetShutdownTimer()
        {
            if (shutdownTimer.enable == false)
            {
                try
                {
                    shutdownTimeSpan = ShutdownTimer.TimeParse(Txt_ShutDownHours.Text, Txt_ShutDownMinutes.Text);
                    shutdownTime     = DateTime.Now.Add(shutdownTimeSpan);
                    shutdownTimer.Start(shutdownTimeSpan);
                    Txt_ShutDownHours.IsEnabled   = false;
                    Txt_ShutDownMinutes.IsEnabled = false;
                    B_ShutdownSetup.Content       = AppResource.CancelShutdown;
                    notifyBalloonTip(AppResource.ShutdownInfo + shutdownTime.ToString());

                    //状态栏的倒计时监控线程
                    stateRefreshThread = new Thread(new ThreadStart(StartRefresh));
                    stateRefreshThread.IsBackground = true;
                    srh = StartRefreshDelegate;
                    stateRefreshThread.Start();
                }
                catch (Exception ex)
                {
                    notifyBalloonTip(ex.ToString());
                }
            }
            else
            {
                shutdownTimer.Stop();
                stateRefreshThread.Abort();
                Txt_ShutDownHours.IsEnabled   = true;
                Txt_ShutDownMinutes.IsEnabled = true;
                B_ShutdownSetup.Content       = AppResource.SetShutdown;
                S_ShutdownTime.Text           = AppResource.ShutdownTimerState;
                notifyBalloonTip(AppResource.ShutdownCancelInfo);
            }
        }
コード例 #3
0
 private void ShutdownForm_Load(object sender, EventArgs e)
 {
     ShutdownTimer.Start();
 }