Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
902d3e27
Commit
902d3e27
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Restructure context menu, use better variable names.
Refers to
#2
parent
e51c35da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ATXTray/AutoTxTray.cs
+30
-23
30 additions, 23 deletions
ATXTray/AutoTxTray.cs
with
30 additions
and
23 deletions
ATXTray/AutoTxTray.cs
+
30
−
23
View file @
902d3e27
...
...
@@ -25,30 +25,37 @@ namespace ATXTray
private
readonly
NotifyIcon
_notifyIcon
=
new
NotifyIcon
();
private
readonly
ContextMenuStrip
_cmStrip
=
new
ContextMenuStrip
();
private
readonly
ToolStripMenuItem
_mi1
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_mi2
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_mi3
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_miExit
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_miTitle
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_miSvcRunning
=
new
ToolStripMenuItem
();
private
readonly
ToolStripMenuItem
_miSvcSuspended
=
new
ToolStripMenuItem
();
public
AutoTxTray
()
{
_notifyIcon
.
Icon
=
new
Icon
(
"AutoTx.ico"
);
var
bold
=
new
Font
(
_cmStrip
.
Font
,
FontStyle
.
Bold
);
_config
=
ServiceConfig
.
Deserialize
(
ConfigFile
);
_mi
1
.
Text
=
@"Exit"
;
_mi
1
.
Click
+=
_mi1_
Click
;
_mi
Exit
.
Text
=
@"Exit"
;
_mi
Exit
.
Click
+=
MiExit
Click
;
_mi2
.
Font
=
bold
;
_mi2
.
Click
+=
ShowContextMenu
;
_miTitle
.
Font
=
new
Font
(
_cmStrip
.
Font
,
FontStyle
.
Bold
);
_miTitle
.
Text
=
@"AutoTx Service Monitor"
;
_miTitle
.
Image
=
Image
.
FromFile
(
"AutoTx.ico"
);
_miTitle
.
BackColor
=
Color
.
LightCoral
;
_miTitle
.
Click
+=
ShowContextMenu
;
_mi3
.
Font
=
bold
;
_mi3
.
Text
=
@"service active (no limitations apply)"
;
_mi3
.
Click
+=
ShowContextMenu
;
_miSvcRunning
.
Text
=
@"Service NOT RUNNING!"
;
_miSvcRunning
.
BackColor
=
Color
.
LightCoral
;
_miSvcRunning
.
Click
+=
ShowContextMenu
;
_miSvcSuspended
.
Text
=
@"No limits apply, service active."
;
_miSvcSuspended
.
Click
+=
ShowContextMenu
;
_cmStrip
.
Items
.
AddRange
(
new
ToolStripItem
[]
{
_mi3
,
_mi2
,
_mi1
_miTitle
,
_miSvcRunning
,
_miSvcSuspended
,
_miExit
});
_notifyIcon
.
ContextMenuStrip
=
_cmStrip
;
...
...
@@ -87,7 +94,7 @@ namespace ATXTray
serviceRunning
,
heartBeatText
,
_status
.
TransferInProgress
));
}
private
void
_mi1_
Click
(
object
sender
,
EventArgs
e
)
{
private
void
MiExit
Click
(
object
sender
,
EventArgs
e
)
{
_notifyIcon
.
Visible
=
false
;
Application
.
Exit
();
}
...
...
@@ -127,15 +134,15 @@ namespace ATXTray
_statusChanged
=
true
;
_svcRunning
=
curSvcRunState
;
if
(
_svcRunning
)
{
_mi
2
.
Text
=
@"
AutoTx s
ervice running"
;
_mi
2
.
Image
=
Image
.
FromFile
(
"AutoTx.ico"
)
;
_mi
2
.
BackColor
=
Color
.
LightGreen
;
_mi
3
.
Enabled
=
true
;
_mi
SvcRunning
.
Text
=
@"
S
ervice running
.
"
;
_mi
SvcRunning
.
BackColor
=
Color
.
LightGreen
;
_mi
Title
.
BackColor
=
Color
.
LightGreen
;
_mi
SvcSuspended
.
Enabled
=
true
;
}
else
{
_mi
2
.
Image
=
null
;
_mi
2
.
BackColor
=
Color
.
LightCoral
;
_mi
2
.
Text
=
@"AutoTx service NOT RUNNING"
;
_mi
3
.
Enabled
=
false
;
_mi
SvcRunning
.
Text
=
@"Service NOT RUNNING!"
;
_mi
SvcRunning
.
BackColor
=
Color
.
LightCoral
;
_mi
Title
.
BackColor
=
Color
.
LightCoral
;
_mi
SvcSuspended
.
Enabled
=
false
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment