Added tray icon

This commit is contained in:
Matthew Bonner
2018-12-15 12:11:42 +00:00
parent b97fadd8b1
commit e64c69729c
17 changed files with 1206 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DnsServerApp", "DnsServerAp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DnsServerApp.NETCore", "DnsServerApp.NETCore\DnsServerApp.NETCore.csproj", "{ADE80805-9FA7-4F66-8A18-57B98F8C0B0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DnsServerTrayIcon", "DnsServerTrayIcon\DnsServerTrayIcon.csproj", "{2F91BD07-2CEE-47FA-8486-457B54612B4C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -37,6 +39,10 @@ Global
{ADE80805-9FA7-4F66-8A18-57B98F8C0B0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADE80805-9FA7-4F66-8A18-57B98F8C0B0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADE80805-9FA7-4F66-8A18-57B98F8C0B0F}.Release|Any CPU.Build.0 = Release|Any CPU
{2F91BD07-2CEE-47FA-8486-457B54612B4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F91BD07-2CEE-47FA-8486-457B54612B4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F91BD07-2CEE-47FA-8486-457B54612B4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F91BD07-2CEE-47FA-8486-457B54612B4C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

64
DnsServerTrayIcon/AboutForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,64 @@
namespace DnsServerTrayIcon
{
partial class AboutForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm));
this.VersionLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// VersionLabel
//
this.VersionLabel.AutoSize = true;
this.VersionLabel.Location = new System.Drawing.Point(24, 23);
this.VersionLabel.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.VersionLabel.Name = "VersionLabel";
this.VersionLabel.Size = new System.Drawing.Size(0, 25);
this.VersionLabel.TabIndex = 0;
//
// AboutForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(656, 142);
this.Controls.Add(this.VersionLabel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.Name = "AboutForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label VersionLabel;
}
}

View File

@@ -0,0 +1,33 @@
using DnsServerTrayIcon.Properties;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace DnsServerTrayIcon
{
public partial class AboutForm : Form
{
public AboutForm()
{
InitializeComponent();
Image image = Image.FromFile("Favicon.ico");
var bitmap = new Bitmap(image);
Icon = Icon.FromHandle(bitmap.GetHicon());
VersionLabel.Text = Resources.ServiceName;
VersionLabel.Text += "\r\n";
VersionLabel.Text += GetLegalCopyright();
VersionLabel.Text += "\r\n";
VersionLabel.Text += Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName) + " " + Assembly.GetExecutingAssembly().GetBuildVersion();
}
private string GetLegalCopyright()
{
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
return versionInfo.LegalCopyright;
}
}
}

View File

@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAUAICAQAAAAAADoAgAAVgAAACAgAAAAAAAAqAgAAD4DAAAwMAAAAAAAAKgOAADmCwAAEBAQAAAA
AAAoAQAAjhoAABAQAAAAAAAAaAUAALYbAAAoAAAAIAAAAEAAAAABAAQAAAAAAIACAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A
/wD//wAA////AMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzP//zP//////////////zMz/
/8z//////////////8zM///M///////////////MzP//zP//////////////zMz//8zMzMzMzMz//8zM
zMzM///MzMzMzMzM///MzMzMzP//////////zP//zP//zMz//////////8z//8z//8zM///////////M
///M///MzP//////////zP//zP//zMz//8zMzMzMzMz//8z//8zM///MzMzMzMzM///M///MzP//zP//
zMzMzP//zP//zMz//8z//8zMzMz//8z//8zM///M///MzMzM///M///MzP//zP//zMzMzP//zP//zMz/
/8z//8zMzMzMzMz//8zM///M///MzMzMzMzM///MzP//zP//zP//////////zMz//8z//8z/////////
/8zM///M///M///////////MzP//zP//zP//////////zMzMzMz//8zMzMzMzMz//8zMzMzM///MzMzM
zMzM///MzP//////////////zP//zMz//////////////8z//8zM///////////////M///MzP//////
////////zP//zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMz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CZ/wAAmf8zAJnM
ZgCZ/5kAmf/MAJn//wDMAAAAmQAzAMwAZgDMAJkAzADMAJkzAADMMzMAzDNmAMwzmQDMM8wAzDP/AMxm
AADMZjMAmWZmAMxmmQDMZswAmWb/AMyZAADMmTMAzJlmAMyZmQDMmcwAzJn/AMzMAADMzDMAzMxmAMzM
mQDMzMwAzMz/AMz/AADM/zMAmf9mAMz/mQDM/8wAzP//AMwAMwD/AGYA/wCZAMwzAAD/MzMA/zNmAP8z
mQD/M8wA/zP/AP9mAAD/ZjMAzGZmAP9mmQD/ZswAzGb/AP+ZAAD/mTMA/5lmAP+ZmQD/mcwA/5n/AP/M
AAD/zDMA/8xmAP/MmQD/zMwA/8z/AP//MwDM/2YA//+ZAP//zABmZv8AZv9mAGb//wD/ZmYA/2b/AP//
ZgAhAKUAX19fAHd3dwCGhoYAlpaWAMvLywCysrIA19fXAN3d3QDj4+MA6urqAPHx8QD4+PgA8Pv/AKSg
oACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////ANXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV
1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1f/////V1f//////////////////
///////////V1dXV/////9XV/////////////////////////////9XV1dX/////1dX/////////////
////////////////1dXV1f/////V1f/////////////////////////////V1dXV/////9XV1dXV1dXV
1dXV1dXV/////9XV1dXV1dXV1dX/////1dXV1dXV1dXV1dXV1dX/////1dXV1dXV1dXV1f//////////
///////////V1f/////V1f/////V1dXV/////////////////////9XV/////9XV/////9XV1dX/////
////////////////1dX/////1dX/////1dXV1f/////////////////////V1f/////V1f/////V1dXV
/////9XV1dXV1dXV1dXV1dXV/////9XV/////9XV1dX/////1dXV1dXV1dXV1dXV1dX/////1dX/////
1dXV1f/////V1f/////V1dXV1dXV1f/////V1f/////V1dXV/////9XV/////9XV1dXV1dXV/////9XV
/////9XV1dX/////1dX/////1dXV1dXV1dX/////1dX/////1dXV1f/////V1f/////V1dXV1dXV1f//
///V1f/////V1dXV/////9XV/////9XV1dXV1dXV1dXV1dXV/////9XV1dX/////1dX/////1dXV1dXV
1dXV1dXV1dX/////1dXV1f/////V1f/////V1f/////////////////////V1dXV/////9XV/////9XV
/////////////////////9XV1dX/////1dX/////1dX/////////////////////1dXV1f/////V1f//
///V1f/////////////////////V1dXV1dXV1dXV/////9XV1dXV1dXV1dXV1dXV/////9XV1dXV1dXV
1dX/////1dXV1dXV1dXV1dXV1dX/////1dXV1f/////////////////////////////V1f/////V1dXV
/////////////////////////////9XV/////9XV1dX/////////////////////////////1dX/////
1dXV1f/////////////////////////////V1f/////V1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV
1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAwAAAAYAAAAAEA
CAAAAAAAgAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAMDc
wADwyqYABAQEAAgICAAMDAwAERERABYWFgAcHBwAIiIiACkpKQBVVVUATU1NAEJCQgA5OTkAgHz/AFBQ
/wCTANYA/+zMAMbW7wDW5+cAkKmtAAAAMwAAAGYAAACZAAAAzAAAMwAAADMzAAAzZgAAM5kAADPMAAAz
/wAAZgAAAGYzAABmZgAAZpkAAGbMAABm/wAAmQAAAJkzAACZZgAAmZkAAJnMAACZ/wAAzAAAAMwzAADM
ZgAAzJkAAMzMAADM/wAA/2YAAP+ZAAD/zAAzAAAAMwAzADMAZgAzAJkAMwDMADMA/wAzMwAAMzMzADMz
ZgAzM5kAMzPMADMz/wAzZgAAM2Y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XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV
1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV////
////1dXV////////////////////////////////////////////1dXV1dXV////////1dXV////////
////////////////////////////////////1dXV1dXV////////1dXV////////////////////////
////////////////////1dXV1dXV////////1dXV////////////////////////////////////////
////1dXV1dXV////////1dXV////////////////////////////////////////////1dXV1dXV////
////1dXV////////////////////////////////////////////1dXV1dXV////////1dXV1dXV1dXV
1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV
////////1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV
1dXV1dXV1dXV////////////////////////////////1dXV////////1dXV////////1dXV1dXV////
////////////////////////////1dXV////////1dXV////////1dXV1dXV////////////////////
////////////1dXV////////1dXV////////1dXV1dXV////////////////////////////////1dXV
////////1dXV////////1dXV1dXV////////////////////////////////1dXV////////1dXV////
////1dXV1dXV////////////////////////////////1dXV////////1dXV////////1dXV1dXV////
////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV////////1dXV1dXV////////1dXV1dXV1dXV
1dXV1dXV1dXV1dXV////////1dXV////////1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV
////////1dXV////////1dXV1dXV////////1dXV////////1dXV1dXV1dXV1dXV////////1dXV////
////1dXV1dXV////////1dXV////////1dXV1dXV1dXV1dXV////////1dXV////////1dXV1dXV////
////1dXV////////1dXV1dXV1dXV1dXV////////1dXV////////1dXV1dXV////////1dXV////////
1dXV1dXV1dXV1dXV////////1dXV////////1dXV1dXV////////1dXV////////1dXV1dXV1dXV1dXV
////////1dXV////////1dXV1dXV////////1dXV////////1dXV1dXV1dXV1dXV////////1dXV////
////1dXV1dXV////////1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV////
////1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV////////1dXV////////
1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV////////1dXV////////1dXV////////////
////////////////////1dXV1dXV////////1dXV////////1dXV////////////////////////////
////1dXV1dXV////////1dXV////////1dXV////////////////////////////////1dXV1dXV////
////1dXV////////1dXV////////////////////////////////1dXV1dXV////////1dXV////////
1dXV////////////////////////////////1dXV1dXV////////1dXV////////1dXV////////////
////////////////////1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////
////1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV1dXV
1dXV1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////1dXV1dXV////////////////////
////////////////////////1dXV////////1dXV1dXV////////////////////////////////////
////////1dXV////////1dXV1dXV////////////////////////////////////////////1dXV////
////1dXV1dXV////////////////////////////////////////////1dXV////////1dXV1dXV////
////////////////////////////////////////1dXV////////1dXV1dXV////////////////////
////////////////////////1dXV////////1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV
1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV
1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXVAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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//1f//////////////1dX//9XV1dXV1dX//9XV
1dXV///////////V///V///V1f//////////1f//1f//1dX//9XV1dXV1dX//9X//9XV///V///V1dXV
///V///V1f//1f//1dXV1f//1f//1dX//9X//9XV1dXV1dX//9XV///V///V///////////V1f//1f//
1f//////////1dXV1dX//9XV1dXV1dX//9XV///////////////V///V1f//////////////1f//1dXV
1dXV1dXV1dXV1dXV1dUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
</value>
</data>
</root>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@@ -0,0 +1,39 @@
using System;
using System.IO;
using System.Reflection;
namespace DnsServerTrayIcon
{
public static class BuildAssemblyExtensions
{
public static DateTime GetLinkerTime(this Assembly assembly, TimeZoneInfo target = null)
{
var filePath = assembly.Location;
const int c_PeHeaderOffset = 60;
const int c_LinkerTimestampOffset = 8;
var buffer = new byte[2048];
using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
stream.Read(buffer, 0, 2048);
var offset = BitConverter.ToInt32(buffer, c_PeHeaderOffset);
var secondsSince1970 = BitConverter.ToInt32(buffer, offset + c_LinkerTimestampOffset);
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var linkTimeUtc = epoch.AddSeconds(secondsSince1970);
var tz = target ?? TimeZoneInfo.Local;
var localTime = TimeZoneInfo.ConvertTimeFromUtc(linkTimeUtc, tz);
return localTime;
}
public static string GetBuildVersion(this Assembly assembly)
{
var linkTimeLocal = assembly.GetLinkerTime(TimeZoneInfo.Utc);
return new Version(1, 0, 0,
((int)new TimeSpan(linkTimeLocal.Hour, linkTimeLocal.Minute, linkTimeLocal.Second).TotalSeconds) / 2).ToString();
}
}
}

View File

@@ -0,0 +1,14 @@
using System.Reflection;
using System.Windows.Forms;
namespace DnsServerTrayIcon
{
public static class ContextMenuNotifyIconExtensions
{
public static void ShowContextMenu(this NotifyIcon notifyIcon)
{
MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
methodInfo.Invoke(notifyIcon, null);
}
}
}

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2F91BD07-2CEE-47FA-8486-457B54612B4C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>DnsServerTrayIcon</RootNamespace>
<AssemblyName>DnsServerTrayIcon</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AboutForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutForm.Designer.cs">
<DependentUpon>AboutForm.cs</DependentUpon>
</Compile>
<Compile Include="BuildAssemblyExtensions.cs" />
<Compile Include="ContextMenuNotifyIconExtensions.cs" />
<Compile Include="MainApplicationContext.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindowsServiceController.cs" />
<EmbeddedResource Include="AboutForm.resx">
<DependentUpon>AboutForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DnsService\DnsService.csproj">
<Project>{7873b2b8-01ba-48bc-b4b0-0857ffd873c9}</Project>
<Name>DnsService</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -0,0 +1,199 @@
using DnsServerTrayIcon.Properties;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace DnsServerTrayIcon
{
public class MainApplicationContext : ApplicationContext
{
private readonly WindowsServiceController _service = new WindowsServiceController("DnsService");
private NotifyIcon TrayIcon;
private ContextMenuStrip TrayIconContextMenu;
private ToolStripMenuItem DashboardMenuItem;
private ToolStripMenuItem ServiceMenuItem;
private ToolStripMenuItem StartServiceMenuItem;
private ToolStripMenuItem RestartServiceMenuItem;
private ToolStripMenuItem StopServiceMenuItem;
private ToolStripMenuItem AboutMenuItem;
private ToolStripSeparator DividerMenuItem;
private ToolStripMenuItem ExitMenuItem;
public MainApplicationContext()
{
Application.ApplicationExit += new EventHandler(OnApplicationExit);
InitializeComponent();
}
private void InitializeComponent()
{
//
// TrayIconContextMenu
//
TrayIconContextMenu = new ContextMenuStrip();
TrayIconContextMenu.SuspendLayout();
//
// TrayIcon
//
var resources = new ComponentResourceManager(typeof(AboutForm));
TrayIcon = new NotifyIcon();
TrayIcon.Icon = (Icon)resources.GetObject("$this.Icon");
TrayIcon.Visible = true;
TrayIcon.MouseUp += TrayIcon_MouseUp;
TrayIcon.ContextMenuStrip = TrayIconContextMenu;
TrayIcon.Text = Resources.ServiceName;
//
// DashboardMenuItem
//
DashboardMenuItem = new ToolStripMenuItem();
DashboardMenuItem.Name = "DashboardMenuItem";
DashboardMenuItem.Text = Resources.DashboardMenuItem;
DashboardMenuItem.Click += new EventHandler(DashboardMenuItem_Click);
//
// ServiceMenuItem
//
ServiceMenuItem = new ToolStripMenuItem();
ServiceMenuItem.Name = "ServiceMenuItem";
ServiceMenuItem.Text = Resources.ServiceMenuItem;
ServiceMenuItem.MouseHover += new EventHandler(ServiceMenuItem_MouseHover);
// Prove the user feedback that there is a sub menu.
ServiceMenuItem.DropDownItems.Add(new ToolStripMenuItem());
StartServiceMenuItem = new ToolStripMenuItem(Resources.ServiceStartMenuItem);
StartServiceMenuItem.Click += new EventHandler(StartServiceMenuItem_Click);
RestartServiceMenuItem = new ToolStripMenuItem(Resources.ServiceRestartMenuItem);
RestartServiceMenuItem.Click += new EventHandler(RestartServiceMenuItem_Click);
StopServiceMenuItem = new ToolStripMenuItem(Resources.ServiceStopMenuItem);
StopServiceMenuItem.Click += new EventHandler(StopServiceMenuItem_Click);
//
// AboutMenuItem
//
AboutMenuItem = new ToolStripMenuItem();
AboutMenuItem.Name = "AboutMenuItem";
AboutMenuItem.Text = Resources.AboutMenuItem;
AboutMenuItem.Click += new EventHandler(AboutMenuItem_Click);
//
// DividerMenuItem
//
DividerMenuItem = new ToolStripSeparator();
//
// CloseMenuItem
//
ExitMenuItem = new ToolStripMenuItem();
ExitMenuItem.Name = "ExitMenuItem";
ExitMenuItem.Text = Resources.ExitMenuItem;
ExitMenuItem.Click += new EventHandler(ExitMenuItem_Click);
TrayIconContextMenu.ResumeLayout(false);
}
private void TrayIcon_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
BuildContextMenu();
TrayIcon.ShowContextMenu();
}
}
private void BuildContextMenu()
{
TrayIconContextMenu.Hide();
TrayIconContextMenu.Items.Clear();
TrayIconContextMenu.Items.Add(DashboardMenuItem);
if (_service.IsInstalled)
TrayIconContextMenu.Items.Add(ServiceMenuItem);
TrayIconContextMenu.Items.AddRange(new ToolStripItem[]
{
DividerMenuItem,
AboutMenuItem,
DividerMenuItem,
ExitMenuItem
});
}
private void ServiceMenuItem_MouseHover(object sender, EventArgs e)
{
ServiceMenuItem.DropDownItems.Clear();
if (_service.IsRunning)
{
ServiceMenuItem.DropDownItems.Add(RestartServiceMenuItem);
ServiceMenuItem.DropDownItems.Add(StopServiceMenuItem);
}
else
{
ServiceMenuItem.DropDownItems.Add(StartServiceMenuItem);
}
ServiceMenuItem.ShowDropDown();
}
private void StartServiceMenuItem_Click(object sender, EventArgs e)
{
_service.Start();
}
private void RestartServiceMenuItem_Click(object sender, EventArgs e)
{
_service.Restart();
}
private void StopServiceMenuItem_Click(object sender, EventArgs e)
{
_service.Stop();
}
private void OnApplicationExit(object sender, EventArgs e)
{
try
{
// Clean up so that the icon will be removed when the application is closed.
TrayIcon.Visible = false;
}
catch (NullReferenceException)
{
// The application is probably closing so safe to ignore.
}
}
private void DashboardMenuItem_Click(object sender, EventArgs e)
{
//TODO: Parse the config file to determine the port.
Process.Start("http://127.0.0.1:5380");
}
private void AboutMenuItem_Click(object sender, EventArgs e)
{
var aboutForm = new AboutForm();
aboutForm.ShowDialog();
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show(
Resources.AreYouSureYouWantToQuit,
Resources.Quit,
MessageBoxButtons.YesNo,
MessageBoxIcon.None,
MessageBoxDefaultButton.Button2);
if (dialogResult == DialogResult.Yes)
{
Application.Exit();
}
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Windows.Forms;
namespace DnsServerTrayIcon
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new MainApplicationContext());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DnsServerTrayIcon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Technitium")]
[assembly: AssemblyProduct("DnsServerTrayIcon")]
[assembly: AssemblyCopyright("Copyright © Technitium 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2f91bd07-2cee-47fa-8486-457b54612b4c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,162 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DnsServerTrayIcon.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DnsServerTrayIcon.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to A&amp;bout....
/// </summary>
internal static string AboutMenuItem {
get {
return ResourceManager.GetString("AboutMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to If you quit Technitium DNS Server Tray Icon, Technitium DNS Server will continue to run in the background, are you sure you want to quit?.
/// </summary>
internal static string AreYouSureYouWantToQuit {
get {
return ResourceManager.GetString("AreYouSureYouWantToQuit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to D&amp;ashboard....
/// </summary>
internal static string DashboardMenuItem {
get {
return ResourceManager.GetString("DashboardMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string ErrorOccurred {
get {
return ResourceManager.GetString("ErrorOccurred", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to E&amp;xit.
/// </summary>
internal static string ExitMenuItem {
get {
return ResourceManager.GetString("ExitMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Quit Technitium DNS Server Tray Icon?.
/// </summary>
internal static string Quit {
get {
return ResourceManager.GetString("Quit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Service.
/// </summary>
internal static string ServiceMenuItem {
get {
return ResourceManager.GetString("ServiceMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Technitium DNS Server.
/// </summary>
internal static string ServiceName {
get {
return ResourceManager.GetString("ServiceName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Restart.
/// </summary>
internal static string ServiceRestartMenuItem {
get {
return ResourceManager.GetString("ServiceRestartMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start.
/// </summary>
internal static string ServiceStartMenuItem {
get {
return ResourceManager.GetString("ServiceStartMenuItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Stop.
/// </summary>
internal static string ServiceStopMenuItem {
get {
return ResourceManager.GetString("ServiceStopMenuItem", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AboutMenuItem" xml:space="preserve">
<value>A&amp;bout...</value>
</data>
<data name="AreYouSureYouWantToQuit" xml:space="preserve">
<value>If you quit Technitium DNS Server Tray Icon, Technitium DNS Server will continue to run in the background, are you sure you want to quit?</value>
</data>
<data name="DashboardMenuItem" xml:space="preserve">
<value>D&amp;ashboard...</value>
</data>
<data name="ErrorOccurred" xml:space="preserve">
<value />
</data>
<data name="ExitMenuItem" xml:space="preserve">
<value>E&amp;xit</value>
</data>
<data name="Quit" xml:space="preserve">
<value>Quit Technitium DNS Server Tray Icon?</value>
</data>
<data name="ServiceMenuItem" xml:space="preserve">
<value>Service</value>
</data>
<data name="ServiceName" xml:space="preserve">
<value>Technitium DNS Server</value>
</data>
<data name="ServiceRestartMenuItem" xml:space="preserve">
<value>Restart</value>
</data>
<data name="ServiceStartMenuItem" xml:space="preserve">
<value>Start</value>
</data>
<data name="ServiceStopMenuItem" xml:space="preserve">
<value>Stop</value>
</data>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DnsServerTrayIcon.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,72 @@
using System.Linq;
using System.ServiceProcess;
namespace DnsServerTrayIcon
{
public class WindowsServiceController
{
private readonly string _serviceName;
public WindowsServiceController(string serviceName)
{
_serviceName = serviceName;
}
public void Restart()
{
Stop();
Start();
}
public void Stop()
{
try
{
using (var service = new ServiceController(_serviceName))
{
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}
}
catch
{ }
}
public void Start()
{
try
{
using (var service = new ServiceController(_serviceName))
{
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running);
}
}
catch
{ }
}
public bool IsRunning => Status == ServiceControllerStatus.Running;
public bool IsStopped => Status == ServiceControllerStatus.Stopped;
public ServiceControllerStatus Status
{
get
{
using (var service = new ServiceController(_serviceName))
{
return service.Status;
}
}
}
public bool IsInstalled
{
get
{
return ServiceController.GetServices().Any(s => s.ServiceName == _serviceName);
}
}
}
}