diff --git a/solarApp/fmArchive.Designer.cs b/solarApp/fmArchive.Designer.cs index 2018b04..acb31ab 100644 --- a/solarApp/fmArchive.Designer.cs +++ b/solarApp/fmArchive.Designer.cs @@ -79,6 +79,7 @@ namespace solarApp this.tbUserName = new System.Windows.Forms.TextBox(); this.btSendMail = new System.Windows.Forms.Button(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.lbMsgTitle = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -361,6 +362,7 @@ namespace solarApp // panel1 // this.panel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption; + this.panel1.Controls.Add(this.lbMsgTitle); this.panel1.Controls.Add(this.bt_invDay); this.panel1.Controls.Add(this.btVerifyData); this.panel1.Controls.Add(this.lbSiteDB_sensor); @@ -632,6 +634,15 @@ namespace solarApp this.btSendMail.UseVisualStyleBackColor = true; this.btSendMail.Click += new System.EventHandler(this.btSendMail_Click); // + // lbMsgTitle + // + this.lbMsgTitle.AutoSize = true; + this.lbMsgTitle.Location = new System.Drawing.Point(931, 20); + this.lbMsgTitle.Name = "lbMsgTitle"; + this.lbMsgTitle.Size = new System.Drawing.Size(51, 19); + this.lbMsgTitle.TabIndex = 15; + this.lbMsgTitle.Text = "label2"; + // // fmArchive // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F); @@ -714,5 +725,6 @@ namespace solarApp private System.Windows.Forms.TextBox tbContent; private System.Windows.Forms.Label lbReceiver; private System.Windows.Forms.TextBox tbReceiver; + private System.Windows.Forms.Label lbMsgTitle; } } \ No newline at end of file diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index cfc1f33..593d834 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -14,6 +14,7 @@ namespace solarApp public partial class fmArchive : Form { getStationSvc stationSvc = new getStationSvc(); + System.Timers.Timer _timer; public fmArchive() { InitializeComponent(); @@ -70,17 +71,38 @@ namespace solarApp i++; } #endregion + + #region 自動執行 + _timer = new System.Timers.Timer(); + _timer.Interval = 10000; + _timer.SynchronizingObject = this; + _timer.Elapsed += _timer_Elapsed; + _timer.Start(); + #endregion + // dtselect_station1.Value = DateTime.Today.AddDays(-1); dtSelect1.Value = System.DateTime.Today.AddDays(-1); dtSelect2.Value = System.DateTime.Today.AddDays(-1); - //#region 自動執行 + // // Run this procedure in an appropriate event. //counter = 0; //timer1.Interval = 600; //timer1.Enabled = true; // Hook up timer's tick event handler. - //#endregion + // + } + + private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + if (System.DateTime.Now.Hour == 00 && DateTime.Now.Minute == 45) + { + MessageBox.Show("ok"); + dtSelect1.Value = System.DateTime.Now.AddDays(-1); + dtSelect2.Value = System.DateTime.Now.AddDays(-1); + bt_archive.PerformClick(); + //bt_archive_Click.PerformClick(); + } } private void rb_site_CheckedChanged(object sender, EventArgs e) @@ -224,6 +246,7 @@ namespace solarApp } i++; } + lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!"; } private void bt_clear_sensor_Click(object sender, EventArgs e)