FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WpkgNotifier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
COs
wpkg
WpkgNotifier
Commits
886faae8
Commit
886faae8
authored
4 years ago
by
Dr Adam Thorn
Browse files
Options
Downloads
Patches
Plain Diff
Have clients unregister from server on exit
parent
ffb7738e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
WpkgInstaller/IWpkgNotifierMessageServer.cs
+3
-0
3 additions, 0 deletions
WpkgInstaller/IWpkgNotifierMessageServer.cs
WpkgInstaller/WpkgInstaller.cs
+11
-0
11 additions, 0 deletions
WpkgInstaller/WpkgInstaller.cs
WpkgNotifier/TrayNotifier.cs
+14
-3
14 additions, 3 deletions
WpkgNotifier/TrayNotifier.cs
with
28 additions
and
3 deletions
WpkgInstaller/IWpkgNotifierMessageServer.cs
+
3
−
0
View file @
886faae8
...
...
@@ -9,6 +9,9 @@ namespace WpkgInstaller
[
OperationContract
(
IsOneWay
=
true
)]
void
Register
(
int
pid
);
[
OperationContract
(
IsOneWay
=
true
)]
void
Unregister
(
int
pid
);
[
OperationContract
(
IsOneWay
=
true
)]
void
ProcessRequest
(
WpkgMessageRequestType
type
);
}
...
...
This diff is collapsed.
Click to expand it.
WpkgInstaller/WpkgInstaller.cs
+
11
−
0
View file @
886faae8
...
...
@@ -207,6 +207,17 @@ namespace WpkgInstaller
}
}
public
void
Unregister
(
int
pid
)
{
if
(
clients
.
Remove
(
pid
))
{
eventLog
.
WriteEntry
(
String
.
Format
(
"Client {0} unregistered"
,
pid
));
}
else
{
eventLog
.
WriteEntry
(
String
.
Format
(
"Unknown client {0} requested to unregister"
,
pid
),
EventLogEntryType
.
Warning
);
}
}
public
void
ProcessRequest
(
WpkgMessageRequestType
type
)
{
switch
(
type
)
...
...
This diff is collapsed.
Click to expand it.
WpkgNotifier/TrayNotifier.cs
+
14
−
3
View file @
886faae8
...
...
@@ -15,10 +15,13 @@ namespace WpkgNotifier
private
EventLog
eventLog
;
private
WpkgMessageState
state
;
private
IWpkgNotifierMessageServer
server
;
private
int
pid
;
public
TrayNotifier
()
{
Process
currentProcess
=
Process
.
GetCurrentProcess
();
pid
=
currentProcess
.
Id
;
eventLog
=
new
EventLog
();
string
eventSourceName
=
"TrayNotifier"
;
string
logName
=
"WpkgNotifier"
;
...
...
@@ -34,6 +37,8 @@ namespace WpkgNotifier
OpenMessageChannel
();
Application
.
ApplicationExit
+=
new
EventHandler
(
this
.
OnApplicationExit
);
MenuItem
actionsMenu
=
new
MenuItem
(
"Actions"
);
MenuItem
syncMenuItem
=
new
MenuItem
(
"Sync"
,
new
EventHandler
(
RequestSync
));
MenuItem
queryMenuItem
=
new
MenuItem
(
"Query"
,
new
EventHandler
(
RequestQuery
));
...
...
@@ -65,6 +70,11 @@ namespace WpkgNotifier
};
}
private
void
OnApplicationExit
(
object
sender
,
EventArgs
e
)
{
server
.
Unregister
(
pid
);
}
private
void
OpenMessageChannel
()
{
eventLog
.
WriteEntry
(
"Trying to open channel"
);
...
...
@@ -78,8 +88,7 @@ namespace WpkgNotifier
server
=
channelFactory
.
CreateChannel
();
eventLog
.
WriteEntry
(
"channel created"
);
Process
currentProcess
=
Process
.
GetCurrentProcess
();
server
.
Register
(
currentProcess
.
Id
);
server
.
Register
(
pid
);
eventLog
.
WriteEntry
(
"Registered with server"
);
}
catch
(
Exception
e
)
...
...
@@ -114,6 +123,8 @@ namespace WpkgNotifier
Application
.
Exit
();
}
public
void
SetToolTip
(
string
msg
)
{
notifyIcon
.
Text
=
msg
;
...
...
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