Skip to content

Commit e0af035

Browse files
committed
Update the main menu bar and the context menu
1 parent f313e80 commit e0af035

File tree

12 files changed

+86
-37
lines changed

12 files changed

+86
-37
lines changed

SimpleTaskManager/TaskManagerForm.Designer.cs

Lines changed: 51 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleTaskManager/TaskManagerForm.cs

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ private Process getSelectedProcess() // lấy ra tiến trình được lựa ch
7777

7878
private void endTaskToolStripMenuItem_Click(object sender, EventArgs e) // dừng một tiến trình bằng cách sử dụng button trên giao diện
7979
{
80-
if (listView.SelectedItems.Count > 0)
81-
{
82-
getSelectedProcess().Kill();
83-
}
84-
GetProcess();
85-
changeColor();
80+
endTaskButton.PerformClick();
8681
}
8782

8883
private void idleToolStripMenuItem_Click(object sender, EventArgs e) // đặt lại mức độ ưu tiên cho các tiếm trình với các mức idle/ normal/ high/ realtime
@@ -121,7 +116,14 @@ private void endTaskButton_Click(object sender, EventArgs e) // dừng một ti
121116
{
122117
if (listView.SelectedItems.Count > 0)
123118
{
124-
getSelectedProcess().Kill();
119+
try
120+
{
121+
getSelectedProcess().Kill();
122+
}
123+
catch (Exception ex)
124+
{
125+
MessageBox.Show(ex.Message, "Cannot kill process", MessageBoxButtons.OK, MessageBoxIcon.Error);
126+
}
125127
}
126128
GetProcess();
127129
}
@@ -137,17 +139,6 @@ private void listView_ColumnClick(object sender, ColumnClickEventArgs e) // sắ
137139
listView.Sort();
138140
}
139141

140-
private void runNewTaskToolStripMenuItem_Click(object sender, EventArgs e) // mở của sổ chạy một ứng dụng mới
141-
{
142-
using (RunNewTaskForm runNewTaskForm = new RunNewTaskForm())
143-
{
144-
if (runNewTaskForm.ShowDialog() == DialogResult.OK)
145-
{
146-
GetProcess();
147-
}
148-
}
149-
}
150-
151142
private void performanceToolStripMenuItem_Click(object sender, EventArgs e) // mở cửa sổ biểu diễn hiệu suất hệ thống: CPU, RAM
152143
{
153144
PerfForm perfForm = new PerfForm();
@@ -164,5 +155,31 @@ private void enableColorchangingToolStripMenuItem_CheckedChanged(object sender,
164155
{
165156
GetProcess();
166157
}
158+
159+
private void runNewProcessToolStripMenuItem_Click(object sender, EventArgs e)
160+
{
161+
runNewTaskToolStripMenuItem.PerformClick();
162+
}
163+
164+
private void performanceToolStripMenuItem1_Click(object sender, EventArgs e)
165+
{
166+
performanceToolStripMenuItem.PerformClick();
167+
}
168+
169+
private void runNewTaskToolStripMenuItem_Click_1(object sender, EventArgs e)
170+
{
171+
using (RunNewTaskForm runNewTaskForm = new RunNewTaskForm())
172+
{
173+
if (runNewTaskForm.ShowDialog() == DialogResult.OK)
174+
{
175+
GetProcess();
176+
}
177+
}
178+
}
179+
180+
private void toolStripMenuItem1_Click(object sender, EventArgs e)
181+
{
182+
endTaskButton.PerformClick();
183+
}
167184
}
168185
}
1 KB
Binary file not shown.
2 KB
Binary file not shown.
Binary file not shown.
1 KB
Binary file not shown.
2 KB
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
54.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)