private void Timer_Tick(object sender, EventArgs e) { // 日付を取得 EventProcessor.GetToday(); // 時間をfor文で調べる for (var i = 0; i < EventProcessor.Times.Count; i++) { var timeString = DateTime.Now.ToLongTimeString(); if (DateTime.Now > EventProcessor.Times[i]) { EventProcessor.CurentClassNum = i; } if (timeString == EventProcessor.Times[i].AddMinutes(-EventProcessor.PreTime).ToLongTimeString()) { NotifyIcon.ShowBalloonTip(5000, "お知らせ", $"{EventProcessor.EventNames[i]}の{EventProcessor.PreTime}分前になりました。", ToolTipIcon.Info); } if (timeString == EventProcessor.Times[i].ToLongTimeString()) { try { Process.Start(EventProcessor.URLs[i]); } catch { MessageBox.Show("URLが開けませんでした", "URL Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public void Save(string fileName) { List <string> dList = new List <string>(); for (int i = 0; i < Rows.Count - 1; i++) { string str = ""; for (int j = 0; j < ColumnCount; j++) { str += (string)Rows[i].Cells[j].Value + ","; } dList.Add(str); } File.WriteAllLines($"./data/{fileName}.zl", dList.ToArray()); EventProcessor.Load(); }
public Main() { EventProcessor.GetToday(); EventProcessor.Load(); forms = new Form[4]; AddTask(); for (int i = 0; i < buttonNames.Length; i++) { GenerateButton(buttonNames[i], new Point(350, i * 50 + (i + 1) * 50)); } Timer timer = new Timer() { Interval = 1000, Enabled = true }; timer.Tick += Timer_Tick; }
protected override void OnClosed(EventArgs e) { System.IO.File.WriteAllLines($"./data/option.zl", new string[] { EventProcessor.PreTime.ToString() }); EventProcessor.Load(); base.OnClosed(e); }