• 大小: 0.13M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-04-27
  • 语言: C#
  • 标签: 定时关机  关机  定时  C#  

资源简介

C#定时关机、重启、注销

支持最小化推盘。

30S倒计时提醒。

资源截图

代码片段和文件信息

/*********************************************************
*   Author:Zingu                                         *
*   Create Time:2010年8月4日12:12:24                     *
*   Code Info:Windows Forms baseOpertion                 *
*   Other:Noting....                                     *
**********************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading; 

namespace TimingClose
{
    public partial class Form1 : Form
    { 
        private bool STATE = false;
        private long sec;
        private long ms;
        private string  type=““;
        System.Timers.Timer t1 = new System.Timers.Timer(1000); 
        System.Timers.Timer t2 =  new System.Timers.Timer(1000);
        System.Timers.Timer t3 = new System.Timers.Timer(1);
        //System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
        public Form1()
        {
            InitializeComponent(); 
            t1.Elapsed += new System.Timers.ElapsedEventHandler(timeout1);
            t2.Elapsed += new System.Timers.ElapsedEventHandler(timeout2);
            t3.Elapsed += new System.Timers.ElapsedEventHandler(timeout3); 
           // this.tabControl1.SelectedIndexChanged += new EventHandler(tabControl1_SelectedIndexChanged);
           // t.Interval = 1;
           // t.Enabled = true;
           // this.t.Tick += new System.EventHandler(this.t_Tick);
            LoadCommbox();
            Init();
        }
        private void t_Tick(object sender System.EventArgs e)
        {
            if (STATE)
            {
                ShowCountDown();
                ShowCountDownER();
            }
        }
        public void timeout1(object source System.Timers.ElapsedEventArgs e)
        { 
            ShowNowTime();  
        }
        public void timeout2(object source System.Timers.ElapsedEventArgs e)
        {
            if (STATE)
            {
                ShowCountDown();
            } 
        }
        public void timeout3(object source System.Timers.ElapsedEventArgs e)
        {
            if (STATE)
            {
                ShowCountDownER();
            } 
        }
        /// 
        /// 当前时间
        /// 

        private void ShowNowTime()
        { 
            Thread.Sleep(1000);
            lbNowTime.Text = “北京时间:“ + DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToLongTimeString().ToString();  
        }
        /// 
        /// 倒计时
        /// 

        private void ShowCountDown()
        {
            //计算多少秒 
            int days = Convert.ToInt32(sec / (24 * 3600));
            int hour = Convert.ToInt32((sec - days * 24 * 3600) / 3600);
            int mint = Convert.ToInt32((sec 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     159232  2020-11-04 17:28  TimingClose\bin\Debug\TimingClose.exe

     文件      38400  2020-11-04 17:28  TimingClose\bin\Debug\TimingClose.pdb

     文件      14328  2020-11-04 17:12  TimingClose\bin\Debug\TimingClose.vshost.exe

     文件     158208  2020-11-04 16:27  TimingClose\bin\Release\TimingClose.exe

     文件      36352  2020-11-04 16:27  TimingClose\bin\Release\TimingClose.pdb

     文件      14328  2020-11-04 16:57  TimingClose\bin\Release\TimingClose.vshost.exe

     文件        490  2009-06-11 05:14  TimingClose\bin\Release\TimingClose.vshost.exe.manifest

     文件      11064  2020-11-04 17:26  TimingClose\Form1.cs

     文件      25658  2020-11-04 17:24  TimingClose\Form1.Designer.cs

     文件     209813  2020-11-04 17:24  TimingClose\Form1.resx

     文件        898  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.csproj.FileListAbsolute.txt

     文件        910  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.csproj.GenerateResource.Cache

     文件     159232  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.exe

     文件     136160  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.Form1.resources

     文件      38400  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.pdb

     文件        180  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.Properties.Resources.resources

     文件        180  2020-11-04 17:28  TimingClose\obj\Debug\TimingClose.WaitMinute.resources

     文件        916  2020-11-04 16:57  TimingClose\obj\Release\TimingClose.csproj.FileListAbsolute.txt

     文件        910  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.csproj.GenerateResource.Cache

     文件     158208  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.exe

     文件     136160  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.Form1.resources

     文件      36352  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.pdb

     文件        180  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.Properties.Resources.resources

     文件        180  2020-11-04 16:27  TimingClose\obj\Release\TimingClose.WaitMinute.resources

     文件      67646  2019-10-11 09:52  TimingClose\off_on.net.ico

     文件        492  2020-11-03 17:09  TimingClose\Program.cs

     文件       1354  2020-11-03 17:09  TimingClose\Properties\AssemblyInfo.cs

     文件       2872  2020-11-03 17:09  TimingClose\Properties\Resources.Designer.cs

     文件       5612  2020-11-03 17:09  TimingClose\Properties\Resources.resx

     文件       1096  2020-11-03 17:09  TimingClose\Properties\Settings.Designer.cs

............此处省略19个文件信息

评论

共有 条评论