📄 form1.cs
字号:
}
if (weeks == "Thursday")
{
label3.Text = "星期四";
}
if (weeks == "Friday")
{
label3.Text = "星期五";
}
if (weeks == "Saturday")
{
label3.Text = "星期六";
}
if (weeks == "Sunday")
{
label3.Text = "星期日";
}
}
int hh, mm, ss, yy, mms, dd;
yy = System.DateTime.Now.Year;
mms = System.DateTime.Now.Month;
dd = System.DateTime.Now.Day;
hh = System.DateTime.Now.Hour;
mm = System.DateTime.Now.Minute;
ss = System.DateTime.Now.Second;
int i;
for (i = 1; i <= listBox1.Items.Count; i++)
{
string mystring, weekd;
int myhh, mymm, myss;
mystring = listBox1.Items[i - 1].ToString();
weekd = mystring.Substring(10, 10).Trim ();
// MessageBox.Show(weekd);
if (weekd == "星期一")
{
weekd = "Monday";
}
if (weekd == "星期二")
{
weekd = "Tuesday";
}
if (weekd == "星期三")
{
weekd = "Wednesday";
}
if (weekd == "星期四")
{
weekd = "Thursday";
}
if (weekd == "星期五")
{
weekd = "Friday";
}
if (weekd == "星期六")
{
weekd = "Saturday";
}
if (weekd == "星期日")
{
weekd = "Sunday";
}
int myyear, mymoths, myday;
if (mystring.Substring(0, 10) != " ")
{
myyear = int.Parse(mystring.Substring(0, 4));
if (myyear == yy)
{
mymoths = int.Parse(mystring.Substring(5, 2));
if (mymoths == mms)
{
myday = int.Parse(mystring.Substring(8, 2));
if (myday == dd)
{
if (weekd != System.DateTime.Now.DayOfWeek.ToString())
{
myhh = int.Parse(mystring.Substring(20, 2));
if (hh == myhh)
{
mymm = int.Parse(mystring.Substring(23, 2));
if (mm == mymm)
{
myss = int.Parse(mystring.Substring(26, 2));
if (ss == myss)
{
string mess;
if (button3.Text == "English")
{
mess = label9.Text.ToString() + " 今天 " + label3.Text + " " + mystring.Substring(29, mystring.Length - 29);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "温馨提示";
}
else
Shows(mess, "English");
}
else
{
mess = label9.Text.ToString() + " Today " + label3.Text + " " + mystring.Substring(29, mystring.Length - 29);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "Notice";
}
else
Shows(mess, "Chinese");
}
if (tsk1.Checked == true)
{
System.Media.SystemSounds.Beep.Play();
notifyIcon.BalloonTipText = mess;
notifyIcon.ShowBalloonTip(11000, notifyIcon.BalloonTipTitle, notifyIcon.BalloonTipText, notifyIcon.BalloonTipIcon);
}
ts.Text = mess;
}
}
}
}
}
}
}
}
else if (weekd == "当天里" || weekd=="Today")
{
if (mystring.Substring(0, 10) == " ")
{
myhh = int.Parse(mystring.Substring (20,2));//(13, 2));
if (hh == myhh)
{
mymm = int.Parse(mystring.Substring(23, 2));//(16, 2));
if (mm == mymm)
{
myss = int.Parse(mystring.Substring(26,2));//(19, 2));
if (ss == myss)
{
string mess;
if (button3.Text == "English")
{
mess = "今天 " + times.Text + " " + mystring.Substring(29, mystring.Length - 29);//(22, mystring.Length - 22);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "温馨提示";
}
else
Shows(mess, "English");
}
else
{
mess = mess = "Today " + times.Text + " " + mystring.Substring(29, mystring.Length - 29);//(22, mystring.Length - 22);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "Notice";
}
else
Shows(mess, "Chinese");
}
if (tsk1.Checked == true)
{
System.Media.SystemSounds.Beep.Play();
notifyIcon.BalloonTipText = mess;
notifyIcon.ShowBalloonTip(11000, notifyIcon.BalloonTipTitle, notifyIcon.BalloonTipText, notifyIcon.BalloonTipIcon);
}
ts.Text = mess;
}
}
}
}
}
else if (mystring.Substring(0, 10) == " ")
{
if (weekd == System.DateTime .Now .DayOfWeek .ToString ())//label3.Text)
{
myhh = int.Parse(mystring.Substring(20, 2));
if (hh == myhh)
{
mymm = int.Parse(mystring.Substring(23, 2));
if (mm == mymm)
{
myss = int.Parse(mystring.Substring(26, 2));
if (ss == myss)
{
string mess;
if (button3.Text == "English")
{
mess = "今天 " + label3.Text + " " + mystring.Substring(29, mystring.Length - 29);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "温馨提示";
}
else
Shows(mess, "English");
}
else
{
mess = "Today " + label3.Text + " " + mystring.Substring(29, mystring.Length - 29);
if (tsk1.Checked == true)
{
notifyIcon.BalloonTipTitle = "Notice";
}
else
Shows(mess, "Chinese");
}
if (tsk1.Checked == true)
{
System.Media.SystemSounds.Beep.Play();
notifyIcon.BalloonTipText = mess;
notifyIcon.ShowBalloonTip(11000, notifyIcon.BalloonTipTitle, notifyIcon.BalloonTipText, notifyIcon.BalloonTipIcon);
}
ts.Text = mess;
}
}
}
}
}
}
}
private void button5_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
openFileDialog1.RestoreDirectory = true;
listBox1.Items.Clear();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
ReadFile(openFileDialog1.FileName);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, "Read the files is error");
}
}
}
private void Save_Click(object sender, EventArgs e)
{
string paths;
paths = Directory.GetCurrentDirectory() + "\\ Bak.txt";
StreamWriter sw =new StreamWriter(paths ,false ,Encoding .Default ) ;
foreach (string oneline in listBox1.Items)
sw.WriteLine(oneline );
sw.Close();
}
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{
ABout about = new ABout();
about.Show();
}
private void button3_Click(object sender, EventArgs e)
{
string weeks = label3.Text;
if (button3.Text == "English")
{
this.Text = "yeanling";
label8.Text = "Year - Month";
button3.Text = "Chinese";
label1.Text = "System Time";
label2.Text = "Today";
groupBox1.Text = "SET";
label4.Text = "Time";
label5.Text = "Week";
button1.Text = "Add";
button2.Text = "Delete";
Open.Text = "Open";
Save.Text = "Save";
label6.Text = "Task";
button4.Text = "Hide";
label11.Text = "Opacity";
button5.Text = "Save As";
listView1.Columns[0].Text = "Year.Month.Day";
listView1.Columns[1].Text = "Week";
listView1.Columns[2].Text = "Time";
listView1.Columns[3].Text = "Task";
toolStripStatusLabel1.Text ="Notice :";
label9.Text = System.DateTime.Now.ToShortDateString();
xq.Items.Clear();
string[] a = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
xq.Items.AddRange(a );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -