-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
70 lines (66 loc) · 2.31 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ToDoList
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
if(textBox1.Text != "")
{
checkedListBox1.Items.Add(textBox1.Text);
notifyIcon1.Icon = SystemIcons.Application;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Add Task";
notifyIcon1.BalloonTipText = textBox1.Text;
notifyIcon1.ShowBalloonTip(1000);
textBox1.Clear();
}
else
{
notifyIcon1.Icon = SystemIcons.Application;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
notifyIcon1.BalloonTipTitle = "Error";
notifyIcon1.BalloonTipText = "Empty String";
notifyIcon1.ShowBalloonTip(1000);
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (checkedListBox1.Text != string.Empty)
{
for (int i = 0; i <= checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.GetItemChecked(i) == true)
{
checkedListBox1.Items.RemoveAt(i);
notifyIcon1.Icon = SystemIcons.Application;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Delete Task";
notifyIcon1.BalloonTipText = checkedListBox1.GetItemText(i);
notifyIcon1.ShowBalloonTip(1000);
}
}
}
else
{
notifyIcon1.Icon = SystemIcons.Application;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
notifyIcon1.BalloonTipTitle = "Error";
notifyIcon1.BalloonTipText = "Empty String";
notifyIcon1.ShowBalloonTip(1000);
}
}
}
}