diff --git a/FemboyInstaller/FemboyInstaller.vdproj b/FemboyInstaller/FemboyInstaller.vdproj index 908e6a7..3585a77 100644 --- a/FemboyInstaller/FemboyInstaller.vdproj +++ b/FemboyInstaller/FemboyInstaller.vdproj @@ -93,12 +93,24 @@ } "Entry" { + "MsmKey" = "8:_89C6893B8CE24B97A5B9FBE20DC47AE5" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_C7272BF4A9D24FD39D08ABB04570B03C" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { + "MsmKey" = "8:_CA9E161B9664471B86DC3E674B2C3E37" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_EBEE36C33EDCA5A5ABEBF8285F4E5150" "OwnerKey" = "8:_46C8C60227CD93D9A3ADA497BA320E90" "MsmSig" = "8:_UNDEFINED" @@ -239,7 +251,7 @@ { "Name" = "8:.NET Framework" "Message" = "8:[VSDNETMSG]" - "FrameworkVersion" = "8:.NETFramework,Version=v4.0,Profile=Client" + "FrameworkVersion" = "8:.NETFramework,Version=v3.0" "AllowLaterVersions" = "11:FALSE" "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=131000" } @@ -422,6 +434,46 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_89C6893B8CE24B97A5B9FBE20DC47AE5" + { + "SourcePath" = "8:..\\FemboyWatchdog\\media\\beep.wav" + "TargetName" = "8:beep.wav" + "Tag" = "8:" + "Folder" = "8:_6CC34141C38547F1960B28776AFE013A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CA9E161B9664471B86DC3E674B2C3E37" + { + "SourcePath" = "8:..\\FemboyWatchdog\\media\\klaxon.wav" + "TargetName" = "8:klaxon.wav" + "Tag" = "8:" + "Folder" = "8:_6CC34141C38547F1960B28776AFE013A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_EBEE36C33EDCA5A5ABEBF8285F4E5150" { "AssemblyRegister" = "3:1" @@ -511,6 +563,17 @@ "Property" = "8:TARGETDIR" "Folders" { + "{9EF0B969-E518-4E46-987F-47570745A589}:_6CC34141C38547F1960B28776AFE013A" + { + "Name" = "8:media" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_2F6493A357C84CC6A5D7796898769E45" + "Folders" + { + } + } } } "{1525181F-901A-416C-8A58-119130FE478E}:_E3FA4026E3914317A7CCE3DFB7BF7A85" @@ -562,15 +625,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:FemboyWatchdog" - "ProductCode" = "8:{C882488C-8174-4E3C-AC32-6152755025CE}" - "PackageCode" = "8:{2782296D-C54B-4CAD-8DE9-FC3459327BC4}" + "ProductCode" = "8:{4560E035-D9FD-4A3E-AD0C-0C92F99B2AC7}" + "PackageCode" = "8:{7F6425A9-589D-4803-92D1-C7C5D2F61ED5}" "UpgradeCode" = "8:{85E61D1C-4678-4F3E-898C-C62A75112C1A}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:1.0.0" + "ProductVersion" = "8:0.3.0" "Manufacturer" = "8:FemboyFinancial" "ARPHELPTELEPHONE" = "8:+1 (925) 765-8478" "ARPHELPLINK" = "8:http://ff.howfeed.biz/" @@ -1081,8 +1144,8 @@ "Type" = "3:15" "ContextData" = "8:" "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1258" + "Setting" = "3:2" + "Value" = "8:Please restart your computer to finish installation." "DefaultValue" = "8:#1258" "UsePlugInResources" = "11:TRUE" } diff --git a/FemboyWatchdog/AboutBox.Designer.cs b/FemboyWatchdog/AboutBox.Designer.cs new file mode 100644 index 0000000..0e0d499 --- /dev/null +++ b/FemboyWatchdog/AboutBox.Designer.cs @@ -0,0 +1,185 @@ +namespace FemboyWatchdog +{ + partial class AboutBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.logoPictureBox = new System.Windows.Forms.PictureBox(); + this.labelProductName = new System.Windows.Forms.Label(); + this.labelVersion = new System.Windows.Forms.Label(); + this.labelCopyright = new System.Windows.Forms.Label(); + this.labelCompanyName = new System.Windows.Forms.Label(); + this.textBoxDescription = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 2; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); + this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); + this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); + this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); + this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); + this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); + this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); + this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 6; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.Size = new System.Drawing.Size(417, 265); + this.tableLayoutPanel.TabIndex = 0; + // + // logoPictureBox + // + this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logoPictureBox.Image = global::FemboyWatchdog.Properties.Resources.ff; + this.logoPictureBox.Location = new System.Drawing.Point(3, 3); + this.logoPictureBox.Name = "logoPictureBox"; + this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); + this.logoPictureBox.Size = new System.Drawing.Size(131, 259); + this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.logoPictureBox.TabIndex = 12; + this.logoPictureBox.TabStop = false; + // + // labelProductName + // + this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelProductName.Location = new System.Drawing.Point(143, 0); + this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17); + this.labelProductName.Name = "labelProductName"; + this.labelProductName.Size = new System.Drawing.Size(271, 17); + this.labelProductName.TabIndex = 19; + this.labelProductName.Text = "Product Name"; + this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelVersion + // + this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelVersion.Location = new System.Drawing.Point(143, 26); + this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(271, 17); + this.labelVersion.TabIndex = 0; + this.labelVersion.Text = "Version"; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCopyright + // + this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelCopyright.Location = new System.Drawing.Point(143, 52); + this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17); + this.labelCopyright.Name = "labelCopyright"; + this.labelCopyright.Size = new System.Drawing.Size(271, 17); + this.labelCopyright.TabIndex = 21; + this.labelCopyright.Text = "Copyright"; + this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCompanyName + // + this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelCompanyName.Location = new System.Drawing.Point(143, 78); + this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17); + this.labelCompanyName.Name = "labelCompanyName"; + this.labelCompanyName.Size = new System.Drawing.Size(271, 17); + this.labelCompanyName.TabIndex = 22; + this.labelCompanyName.Text = "Company Name"; + this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxDescription + // + this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxDescription.Location = new System.Drawing.Point(143, 107); + this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); + this.textBoxDescription.Multiline = true; + this.textBoxDescription.Name = "textBoxDescription"; + this.textBoxDescription.ReadOnly = true; + this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBoxDescription.Size = new System.Drawing.Size(271, 126); + this.textBoxDescription.TabIndex = 23; + this.textBoxDescription.TabStop = false; + this.textBoxDescription.Text = "Description"; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(339, 239); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + // + // AboutBox + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(435, 283); + this.Controls.Add(this.tableLayoutPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutBox"; + this.Padding = new System.Windows.Forms.Padding(9); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "AboutBox"; + this.tableLayoutPanel.ResumeLayout(false); + this.tableLayoutPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.PictureBox logoPictureBox; + private System.Windows.Forms.Label labelProductName; + private System.Windows.Forms.Label labelVersion; + private System.Windows.Forms.Label labelCopyright; + private System.Windows.Forms.Label labelCompanyName; + private System.Windows.Forms.TextBox textBoxDescription; + private System.Windows.Forms.Button okButton; + } +} diff --git a/FemboyWatchdog/AboutBox.cs b/FemboyWatchdog/AboutBox.cs new file mode 100644 index 0000000..d3779df --- /dev/null +++ b/FemboyWatchdog/AboutBox.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; + +namespace FemboyWatchdog +{ + partial class AboutBox : Form + { + public AboutBox() + { + InitializeComponent(); + this.Text = String.Format("About {0}", AssemblyTitle); + this.labelProductName.Text = AssemblyProduct; + this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); + this.labelCopyright.Text = AssemblyCopyright + " " + AssemblyCompany; + this.labelCompanyName.Text = "All rights reversed."; + this.textBoxDescription.Text = AssemblyDescription; + } + + #region Assembly Attribute Accessors + + public string AssemblyTitle + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + if (attributes.Length > 0) + { + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + if (titleAttribute.Title != "") + { + return titleAttribute.Title; + } + } + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + + public string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + public string AssemblyDescription + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + if (attributes.Length == 0) + { + return ""; + } + return ((AssemblyDescriptionAttribute)attributes[0]).Description; + } + } + + public string AssemblyProduct + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + if (attributes.Length == 0) + { + return ""; + } + return ((AssemblyProductAttribute)attributes[0]).Product; + } + } + + public string AssemblyCopyright + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + if (attributes.Length == 0) + { + return ""; + } + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + } + + public string AssemblyCompany + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); + if (attributes.Length == 0) + { + return ""; + } + return ((AssemblyCompanyAttribute)attributes[0]).Company; + } + } + #endregion + } +} diff --git a/FemboyWatchdog/AboutBox.resx b/FemboyWatchdog/AboutBox.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/FemboyWatchdog/AboutBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FemboyWatchdog/FemboyWatchdog.csproj b/FemboyWatchdog/FemboyWatchdog.csproj index dbf86c5..d9140ca 100644 --- a/FemboyWatchdog/FemboyWatchdog.csproj +++ b/FemboyWatchdog/FemboyWatchdog.csproj @@ -14,6 +14,7 @@ 512 + false publish\ true Disk @@ -26,7 +27,6 @@ true 0 1.0.0.%2a - false false true @@ -49,6 +49,10 @@ prompt 4 + + + + ..\packages\AForge.2.2.5\lib\AForge.dll @@ -79,22 +83,49 @@ True + + + + Form + + + AboutBox.cs + - + + + Form + + + MeetingNotification.cs + + + + Form + + + Monitor.cs + Form Toolbar.cs + + AboutBox.cs + + + MeetingNotification.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -105,6 +136,9 @@ Resources.resx True + + Monitor.cs + Toolbar.cs @@ -141,6 +175,10 @@ PreserveNewest + + PreserveNewest + + diff --git a/FemboyWatchdog/LocationTracker.cs b/FemboyWatchdog/LocationProvider.cs similarity index 90% rename from FemboyWatchdog/LocationTracker.cs rename to FemboyWatchdog/LocationProvider.cs index bdeaa65..0cc5e5a 100644 --- a/FemboyWatchdog/LocationTracker.cs +++ b/FemboyWatchdog/LocationProvider.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json; namespace FemboyWatchdog { - class LocationTracker + class LocationProvider { private WebClient _wcIp; private WebClient _wcLocation; @@ -23,7 +23,7 @@ namespace FemboyWatchdog } - public LocationTracker(double interval = 15.0) + public LocationProvider(double interval = 15.0) { _wcIp = new WebClient(); _wcLocation = new WebClient(); @@ -70,7 +70,7 @@ namespace FemboyWatchdog catch (JsonSerializationException err) { } } - void ip_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) + private void ip_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Cancelled || e.Error != null) return; @@ -82,7 +82,7 @@ namespace FemboyWatchdog string.Format( "http://api.ipstack.com/{0}?access_key={1}&fields=latitude,longitude,region_name,country_name,city", e.Result, - "31d59064bb7ef00a9daff4794b73118c" + Properties.Settings.Default.IpStackApiToken ) )); } diff --git a/FemboyWatchdog/MeetingNotification.Designer.cs b/FemboyWatchdog/MeetingNotification.Designer.cs new file mode 100644 index 0000000..caad22e --- /dev/null +++ b/FemboyWatchdog/MeetingNotification.Designer.cs @@ -0,0 +1,73 @@ +namespace FemboyWatchdog +{ + partial class MeetingNotification + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.alertLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // alertLabel + // + this.alertLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.alertLabel.BackColor = System.Drawing.Color.Yellow; + this.alertLabel.Font = new System.Drawing.Font("Arial", 32.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.alertLabel.Location = new System.Drawing.Point(10, 10); + this.alertLabel.Name = "alertLabel"; + this.alertLabel.Size = new System.Drawing.Size(480, 230); + this.alertLabel.TabIndex = 0; + this.alertLabel.Text = "ALERT: A COMPANY MEETING IS TAKING PLACE"; + this.alertLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // MeetingNotification + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Red; + this.ClientSize = new System.Drawing.Size(500, 250); + this.Controls.Add(this.alertLabel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "MeetingNotification"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "MeetingNotification"; + this.TopMost = true; + this.Load += new System.EventHandler(this.MeetingNotification_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label alertLabel; + + } +} \ No newline at end of file diff --git a/FemboyWatchdog/MeetingNotification.cs b/FemboyWatchdog/MeetingNotification.cs new file mode 100644 index 0000000..aaf2857 --- /dev/null +++ b/FemboyWatchdog/MeetingNotification.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Media; +using System.Text; +using System.Windows.Forms; + +namespace FemboyWatchdog +{ + public partial class MeetingNotification : Form + { + private Timer _flasher; + private int _timesFlashed; + + public MeetingNotification() + { + InitializeComponent(); + + _flasher = new Timer(); + _flasher.Interval = 500; + _flasher.Tick += new EventHandler(_flasher_Tick); + + _timesFlashed = 0; + } + + private void _flasher_Tick(object sender, EventArgs e) + { + if (++_timesFlashed > 10) + { + Close(); + return; + } + + if (Visible) + { + Hide(); + } + else + { + Show(); + } + } + + private void MeetingNotification_Load(object sender, EventArgs e) + { + _flasher.Start(); + SoundPlayer snd = new SoundPlayer(@"media\klaxon.wav"); + snd.Play(); + } + } +} diff --git a/FemboyWatchdog/MeetingNotification.resx b/FemboyWatchdog/MeetingNotification.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/FemboyWatchdog/MeetingNotification.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FemboyWatchdog/MeetingProvider.cs b/FemboyWatchdog/MeetingProvider.cs new file mode 100644 index 0000000..b77d385 --- /dev/null +++ b/FemboyWatchdog/MeetingProvider.cs @@ -0,0 +1,134 @@ +using System; +using System.Net; +using System.Windows.Forms; +using Newtonsoft.Json; + +namespace FemboyWatchdog +{ + class MeetingProvider + { + private WebClient _meetingChecker; + private WebClient _meetingCreator; + private Timer _timer; + private MeetingInfo _meetInfo; + private DateTime _lastMeetingResponseTime = DateTime.MinValue; + private double _checkInterval; + private const double _DATETIME_EPSILON = 30.0; + public bool Checking { get; private set; } + + public event EventHandler MeetingStarted; + + internal class MeetingInfo : EventArgs + { + public DateTime LastMeetingTime; + public string Error; + } + + public MeetingProvider(double interval = 5.0) + { + _meetingChecker = new WebClient(); + _meetingChecker.DownloadStringCompleted += new DownloadStringCompletedEventHandler(_meetingChecker_DownloadStringCompleted); + + _meetingCreator = new WebClient(); + _meetingCreator.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; + _meetingCreator.UploadStringCompleted += new UploadStringCompletedEventHandler(_meetingCreator_UploadStringCompleted); + + _checkInterval = interval; + Checking = false; + } + + private void _meetingCreator_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) + { + // apparently headers get unset if you reuse the WebClient + _meetingCreator.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; + + if (e.Cancelled || e.Error != null) + return; + + try + { + MeetingInfo response = JsonConvert.DeserializeObject(e.Result); + + if (response.Error != null) + return; + + _meetInfo = response; + } + catch (JsonSerializationException err) { } + } + + public void StartMeeting() + { + _meetingCreator.UploadStringAsync( + new Uri(Properties.Settings.Default.FemboyApiBaseUrl + "meet"), + "token=" + Properties.Settings.Default.FemboyApiToken + ); + } + + public void StartChecking() + { + if (Checking) + return; + + _timer = new Timer(); + _timer.Interval = Convert.ToInt32(_checkInterval * 1000); + _timer.Tick += new EventHandler(_timer_Tick); + _timer.Start(); + + Checking = true; + } + + private void _meetingChecker_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) + { + if (e.Cancelled || e.Error != null) + return; + + try + { + MeetingInfo response = JsonConvert.DeserializeObject(e.Result); + + if (response.Error != null) + return; + + _meetInfo = response; + + // if a meeting is happened long ago, we don't care about it. + // also, avoid reacting twice to the same meeting. + if (Math.Abs((DateTime.UtcNow - _meetInfo.LastMeetingTime).TotalSeconds) <= _DATETIME_EPSILON + && (DateTime.UtcNow - _lastMeetingResponseTime).TotalSeconds >= _checkInterval) + { + _lastMeetingResponseTime = _meetInfo.LastMeetingTime; + OnMeetingStarted(_meetInfo); + } + } + catch (JsonSerializationException err) { } + } + + protected virtual void OnMeetingStarted(MeetingInfo e) + { + EventHandler handler = MeetingStarted; + if (handler != null) + { + handler(this, e); + } + } + + private void _timer_Tick(object sender, EventArgs e) + { + if (!_meetingChecker.IsBusy) + { + try + { + _meetingChecker.DownloadStringAsync(new Uri( + string.Format( + "{0}meet/?token={1}", + Properties.Settings.Default.FemboyApiBaseUrl, + Properties.Settings.Default.FemboyApiToken + ) + )); + } + catch (WebException err) { } + } + } + } +} diff --git a/FemboyWatchdog/Monitor.Designer.cs b/FemboyWatchdog/Monitor.Designer.cs new file mode 100644 index 0000000..30b7fea --- /dev/null +++ b/FemboyWatchdog/Monitor.Designer.cs @@ -0,0 +1,99 @@ +using AForge.Controls; + +namespace FemboyWatchdog +{ + partial class Monitor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + + CloseCurrentVideoSource(); + GlobalHooks.UnhookWindowsHookEx(_hookID); + + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.vsp = new AForge.Controls.VideoSourcePlayer(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.Color.Red; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(183, 13); + this.label1.TabIndex = 0; + this.label1.Text = "YOU ARE BEING MONITORED"; + // + // vsp + // + this.vsp.Location = new System.Drawing.Point(217, 9); + this.vsp.Name = "vsp"; + this.vsp.Size = new System.Drawing.Size(256, 144); + this.vsp.TabIndex = 1; + this.vsp.VideoSource = null; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Yellow; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(12, 76); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(187, 13); + this.label2.TabIndex = 2; + this.label2.Text = "\"SMILE!\" YOU\'RE ON CAMERA"; + this.label2.Visible = false; + // + // Monitor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(488, 164); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.vsp); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Monitor"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "FemboyWatchdog Monitor"; + this.TopMost = true; + this.TransparencyKey = System.Drawing.SystemColors.Control; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private AForge.Controls.VideoSourcePlayer vsp; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/FemboyWatchdog/Monitor.cs b/FemboyWatchdog/Monitor.cs new file mode 100644 index 0000000..878d6a5 --- /dev/null +++ b/FemboyWatchdog/Monitor.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Media; +using System.Net; +using System.Runtime.InteropServices; +using System.Speech.Synthesis; +using System.Text; +using System.Windows.Forms; +using AForge.Video; +using AForge.Video.DirectShow; + +namespace FemboyWatchdog +{ + public partial class Monitor : Form + { + private DateTime clockIn = DateTime.Now; + + private LocationProvider tracker; + + private FilterInfoCollection videoDevices; + private VideoCaptureDevice videoDevice; + private VideoCapabilities[] videoCapabilities; + + private Timer labelBlinkTimer; + private Timer ttsTimer; + private Timer mousemvmtTimer; + private int mousemvmtCount = 0; + /* mouse movements come in as a stream, so we'll say a mouse movement is "over" by waiting + a certain time with no movement */ + private Timer lastmousemvmtTimer; + + private SpeechSynthesizer ss; + + private SolidBrush brush = new SolidBrush(Color.Red); + private Font font = new Font(FontFamily.GenericSansSerif, 24); + + private GlobalHooks.LowLevelMouseProc _proc; + private static IntPtr _hookID = IntPtr.Zero; + + + public Monitor() + { + _proc = OnMouseMessage; + GlobalHooks.SetHook(_proc); + InitializeComponent(); + + ss = new SpeechSynthesizer(); + + tracker = new LocationProvider(); + + ttsTimer = new Timer(); + ttsTimer.Interval = 15000; + labelBlinkTimer = new Timer(); + labelBlinkTimer.Interval = 1000; + mousemvmtTimer = new Timer(); + mousemvmtTimer.Interval = 60000; + mousemvmtTimer.Start(); + lastmousemvmtTimer = new Timer(); + lastmousemvmtTimer.Interval = 500; + + // hook events + vsp.NewFrame += new AForge.Controls.VideoSourcePlayer.NewFrameHandler(vsp_NewFrame); + ttsTimer.Tick += new EventHandler(ttsTimer_Tick); + labelBlinkTimer.Tick += new EventHandler(labelBlinkTimer_Tick); + mousemvmtTimer.Tick += new EventHandler(mousemvmtTimer_Tick); + lastmousemvmtTimer.Tick += new EventHandler(lastmousemvmtTimer_Tick); + + OpenCamera(); + ttsTimer.Start(); + } + + private void lastmousemvmtTimer_Tick(object sender, EventArgs e) + { + ++mousemvmtCount; + lastmousemvmtTimer.Stop(); + } + + private void mousemvmtTimer_Tick(object sender, EventArgs e) + { + int movements = mousemvmtCount; + // need to reset the count before showing dialogs because a non-response means it will never get reset + mousemvmtCount = 0; + if (movements < 5) + { + SoundPlayer snd = new SoundPlayer(@"media\beep.wav"); + snd.Play(); + DialogResult answer = MessageBox.Show( + this, + string.Format("WORKER: Your productivity ({0}) is below 5 mouse movements/minute. Are you sleeping?", mousemvmtCount), + "EMPLOYEE ALERT", + MessageBoxButtons.YesNo, + MessageBoxIcon.Exclamation + ); + if (answer == DialogResult.Yes) + { + MessageBox.Show( + this, + "Expect a formal termination letter from human resources soon.", + "YOU'RE FIRED!", + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + } + } + + private IntPtr OnMouseMessage(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0 && (GlobalHooks.MouseMessages)wParam == GlobalHooks.MouseMessages.WM_MOUSEMOVE) + { + if (!lastmousemvmtTimer.Enabled) + lastmousemvmtTimer.Start(); + } + return GlobalHooks.CallNextHookEx(_hookID, nCode, wParam, lParam); + } + + private void OpenCamera() + { + try + { + videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); + if (videoDevices.Count != 0) + { + videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString); + } + else + { + /* + MessageBox.Show(this, "Camera device not found! Get a webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-2); + */ + vsp.Dispose(); + return; + } + videoCapabilities = videoDevice.VideoCapabilities; + if (videoCapabilities.Length == 0) + { + /* + MessageBox.Show(this, "Camera does not support video capture! Get a better webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-3); + */ + vsp.Dispose(); + return; + } + + // adjust VSP's resolution so as to not stretch the picture + double aspectRatio = 1.0 * videoCapabilities[0].FrameSize.Width / videoCapabilities[0].FrameSize.Height; + vsp.Size = new System.Drawing.Size(Convert.ToInt32(aspectRatio * 144), 144); + + OpenVideoSource(videoDevice); + } + catch (Exception err) + { + /* + MessageBox.Show(this, err.ToString(), "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-1); + */ + vsp.Dispose(); + } + } + + private void labelBlinkTimer_Tick(object sender, EventArgs e) + { + this.label2.Visible = !this.label2.Visible; + } + + private void ttsTimer_Tick(object sender, EventArgs e) + { + string msg = "You are being monitored."; + if (tracker.LocationData != null) + msg += string.Format(" Your location is: {0}, {1}", tracker.LocationData.latitude, tracker.LocationData.longitude); + ss.SpeakAsync(msg); + } + + public void OpenVideoSource(IVideoSource source) + { + try + { + // set busy cursor + this.Cursor = Cursors.WaitCursor; + // stop current video source + CloseCurrentVideoSource(); + // start new video source + vsp.VideoSource = source; + vsp.Start(); + this.Cursor = Cursors.Default; + labelBlinkTimer.Start(); + } + catch { } + } + + public void CloseCurrentVideoSource() + { + try + { + if (vsp.VideoSource != null) + { + vsp.SignalToStop(); + // wait ~ 3 seconds + for (int i = 0; i < 30; i++) + { + if (!vsp.IsRunning) + break; + System.Threading.Thread.Sleep(100); + } + if (vsp.IsRunning) + { + vsp.Stop(); + } + vsp.VideoSource = null; + labelBlinkTimer.Stop(); + } + } + catch { } + } + + private void vsp_NewFrame(object sender, ref Bitmap image) + { + try + { + DateTime now = DateTime.Now; + Graphics g = Graphics.FromImage(image); + // paint current time + g.DrawString(now.ToString(), font, brush, new Point(5, 5)); + g.DrawString("Clock in time: " + clockIn.ToString(), font, brush, new Point(5, image.Height - font.Height - 5)); + } + catch + { } + } + } +} diff --git a/FemboyWatchdog/Monitor.resx b/FemboyWatchdog/Monitor.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/FemboyWatchdog/Monitor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FemboyWatchdog/Program.cs b/FemboyWatchdog/Program.cs index 77bba6b..dfc2321 100644 --- a/FemboyWatchdog/Program.cs +++ b/FemboyWatchdog/Program.cs @@ -1,9 +1,32 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Windows.Forms; namespace FemboyWatchdog { + public class MultiFormContext : ApplicationContext + { + private int openForms; + public MultiFormContext(params Form[] forms) + { + openForms = forms.Length; + + foreach (var form in forms) + { + form.FormClosed += (s, args) => + { + //When we have closed the last of the "starting" forms, + //end the program. + if (Interlocked.Decrement(ref openForms) == 0) + ExitThread(); + }; + + form.Show(); + } + } + } + static class Program { /// @@ -14,7 +37,7 @@ namespace FemboyWatchdog { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Toolbar()); + Application.Run(new MultiFormContext(new Monitor(), new Toolbar())); } } } diff --git a/FemboyWatchdog/Properties/AssemblyInfo.cs b/FemboyWatchdog/Properties/AssemblyInfo.cs index 6e1079f..bf0d5f7 100644 --- a/FemboyWatchdog/Properties/AssemblyInfo.cs +++ b/FemboyWatchdog/Properties/AssemblyInfo.cs @@ -6,9 +6,9 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FemboyWatchdog")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("FemboyWatchdog is the ultimate corporate surveillance mechanism!")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("FemboyFinancial Holdings Co., Ltd.")] [assembly: AssemblyProduct("FemboyWatchdog")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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")] +[assembly: AssemblyVersion("0.0.3.0")] +[assembly: AssemblyFileVersion("0.0.3.0")] diff --git a/FemboyWatchdog/Properties/Resources.Designer.cs b/FemboyWatchdog/Properties/Resources.Designer.cs index 836395a..52a4d0c 100644 --- a/FemboyWatchdog/Properties/Resources.Designer.cs +++ b/FemboyWatchdog/Properties/Resources.Designer.cs @@ -59,5 +59,15 @@ namespace FemboyWatchdog.Properties { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ff { + get { + object obj = ResourceManager.GetObject("ff", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/FemboyWatchdog/Properties/Resources.resx b/FemboyWatchdog/Properties/Resources.resx index af7dbeb..ab2aff8 100644 --- a/FemboyWatchdog/Properties/Resources.resx +++ b/FemboyWatchdog/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -114,4 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ff.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/FemboyWatchdog/Properties/Settings.Designer.cs b/FemboyWatchdog/Properties/Settings.Designer.cs index 786af43..3b64a48 100644 --- a/FemboyWatchdog/Properties/Settings.Designer.cs +++ b/FemboyWatchdog/Properties/Settings.Designer.cs @@ -22,5 +22,32 @@ namespace FemboyWatchdog.Properties { return defaultInstance; } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("http://howfeed.biz/api/")] + public string FemboyApiBaseUrl { + get { + return ((string)(this["FemboyApiBaseUrl"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1445")] + public string FemboyApiToken { + get { + return ((string)(this["FemboyApiToken"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("31d59064bb7ef00a9daff4794b73118c")] + public string IpStackApiToken { + get { + return ((string)(this["IpStackApiToken"])); + } + } } } diff --git a/FemboyWatchdog/Properties/Settings.settings b/FemboyWatchdog/Properties/Settings.settings index 8e615f2..4332a09 100644 --- a/FemboyWatchdog/Properties/Settings.settings +++ b/FemboyWatchdog/Properties/Settings.settings @@ -1,5 +1,15 @@  - + - + + + http://howfeed.biz/api/ + + + 1445 + + + 31d59064bb7ef00a9daff4794b73118c + + \ No newline at end of file diff --git a/FemboyWatchdog/Resources/ff.png b/FemboyWatchdog/Resources/ff.png new file mode 100644 index 0000000..51c3c76 Binary files /dev/null and b/FemboyWatchdog/Resources/ff.png differ diff --git a/FemboyWatchdog/Toolbar.Designer.cs b/FemboyWatchdog/Toolbar.Designer.cs index bb6b361..8204034 100644 --- a/FemboyWatchdog/Toolbar.Designer.cs +++ b/FemboyWatchdog/Toolbar.Designer.cs @@ -1,6 +1,4 @@ -using AForge.Controls; - -namespace FemboyWatchdog +namespace FemboyWatchdog { partial class Toolbar { @@ -19,10 +17,6 @@ namespace FemboyWatchdog { components.Dispose(); } - - CloseCurrentVideoSource(); - GlobalHooks.UnhookWindowsHookEx(_hookID); - base.Dispose(disposing); } @@ -34,57 +28,92 @@ namespace FemboyWatchdog /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.vsp = new AForge.Controls.VideoSourcePlayer(); - this.label2 = new System.Windows.Forms.Label(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.meetingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.callAMeetingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // - // label1 + // menuStrip1 // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Red; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(183, 13); - this.label1.TabIndex = 0; - this.label1.Text = "YOU ARE BEING MONITORED"; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.meetingToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(400, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + this.menuStrip1.MouseEnter += new System.EventHandler(this.menuStrip1_MouseEnter); // - // vsp + // fileToolStripMenuItem // - this.vsp.Location = new System.Drawing.Point(217, 9); - this.vsp.Name = "vsp"; - this.vsp.Size = new System.Drawing.Size(256, 144); - this.vsp.TabIndex = 1; - this.vsp.VideoSource = null; + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; // - // label2 + // exitToolStripMenuItem // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Yellow; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(12, 76); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(187, 13); - this.label2.TabIndex = 2; - this.label2.Text = "\"SMILE!\" YOU\'RE ON CAMERA"; - this.label2.Visible = false; + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22); + this.exitToolStripMenuItem.Text = "Exit"; + // + // meetingToolStripMenuItem + // + this.meetingToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.callAMeetingToolStripMenuItem}); + this.meetingToolStripMenuItem.Name = "meetingToolStripMenuItem"; + this.meetingToolStripMenuItem.Size = new System.Drawing.Size(63, 20); + this.meetingToolStripMenuItem.Text = "Meeting"; + // + // callAMeetingToolStripMenuItem + // + this.callAMeetingToolStripMenuItem.Name = "callAMeetingToolStripMenuItem"; + this.callAMeetingToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.callAMeetingToolStripMenuItem.Text = "Call a Meeting"; + this.callAMeetingToolStripMenuItem.Click += new System.EventHandler(this.callAMeetingToolStripMenuItem_Click); + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // // Toolbar // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(488, 164); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.vsp); + this.BackColor = System.Drawing.Color.Lime; + this.ClientSize = new System.Drawing.Size(400, 24); + this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MainMenuStrip = this.menuStrip1; this.Name = "Toolbar"; + this.ShowIcon = false; this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "Toolbar"; + this.Text = "FemboyWatchdog Toolbar"; this.TopMost = true; - this.TransparencyKey = System.Drawing.SystemColors.Control; + this.TransparencyKey = System.Drawing.Color.Lime; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -92,8 +121,13 @@ namespace FemboyWatchdog #endregion - private System.Windows.Forms.Label label1; - private AForge.Controls.VideoSourcePlayer vsp; - private System.Windows.Forms.Label label2; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem meetingToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem callAMeetingToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + } } \ No newline at end of file diff --git a/FemboyWatchdog/Toolbar.cs b/FemboyWatchdog/Toolbar.cs index 89a91b0..392b67d 100644 --- a/FemboyWatchdog/Toolbar.cs +++ b/FemboyWatchdog/Toolbar.cs @@ -1,232 +1,47 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Data; using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Media; -using System.Net; -using System.Runtime.InteropServices; -using System.Speech.Synthesis; using System.Text; using System.Windows.Forms; -using AForge.Video; -using AForge.Video.DirectShow; namespace FemboyWatchdog { public partial class Toolbar : Form { - private DateTime clockIn = DateTime.Now; - private LocationTracker tracker; - - private FilterInfoCollection videoDevices; - private VideoCaptureDevice videoDevice; - private VideoCapabilities[] videoCapabilities; - - private Timer labelBlinkTimer; - private Timer ttsTimer; - private Timer mousemvmtTimer; - private int mousemvmtCount = 0; - /* mouse movements come in as a stream, so we'll say a mouse movement is "over" by waiting - a certain time with no movement */ - private Timer lastmousemvmtTimer; - - private SpeechSynthesizer ss; - - private SolidBrush brush = new SolidBrush(Color.Red); - private Font font = new Font(FontFamily.GenericSansSerif, 24); - - private GlobalHooks.LowLevelMouseProc _proc; - private static IntPtr _hookID = IntPtr.Zero; - + private MeetingProvider meetings; public Toolbar() { - _proc = OnMouseMessage; - GlobalHooks.SetHook(_proc); InitializeComponent(); + Location = new Point((Screen.PrimaryScreen.Bounds.Width - Width) / 2, 0); - ss = new SpeechSynthesizer(); - - tracker = new LocationTracker(); - - ttsTimer = new Timer(); - ttsTimer.Interval = 15000; - labelBlinkTimer = new Timer(); - labelBlinkTimer.Interval = 1000; - mousemvmtTimer = new Timer(); - mousemvmtTimer.Interval = 60000; - mousemvmtTimer.Start(); - lastmousemvmtTimer = new Timer(); - lastmousemvmtTimer.Interval = 500; - - // hook events - vsp.NewFrame += new AForge.Controls.VideoSourcePlayer.NewFrameHandler(vsp_NewFrame); - ttsTimer.Tick += new EventHandler(ttsTimer_Tick); - labelBlinkTimer.Tick += new EventHandler(labelBlinkTimer_Tick); - mousemvmtTimer.Tick += new EventHandler(mousemoveTimer_Tick); - lastmousemvmtTimer.Tick += new EventHandler(lastmousemvmtTimer_Tick); - - OpenCamera(); - ttsTimer.Start(); + meetings = new MeetingProvider(); + meetings.MeetingStarted += new EventHandler(meetings_MeetingStarted); + meetings.StartChecking(); } - private void lastmousemvmtTimer_Tick(object sender, EventArgs e) + private void meetings_MeetingStarted(object sender, EventArgs e) { - ++mousemvmtCount; - lastmousemvmtTimer.Stop(); + MeetingNotification alert = new MeetingNotification(); + alert.Show(); } - private void mousemoveTimer_Tick(object sender, EventArgs e) + private void callAMeetingToolStripMenuItem_Click(object sender, EventArgs e) { - if (mousemvmtCount < 5) - { - SoundPlayer snd = new SoundPlayer(@"media\beep.wav"); - snd.Play(); - DialogResult answer = MessageBox.Show( - this, - string.Format("WORKER: Your productivity ({0}) is below 5 mouse movements/minute. Are you sleeping?", mousemvmtCount), - "EMPLOYEE ALERT", - MessageBoxButtons.YesNo, - MessageBoxIcon.Exclamation - ); - if (answer == DialogResult.Yes) - { - MessageBox.Show( - this, - "Expect a formal termination letter from human resources soon.", - "YOU'RE FIRED!", - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - } - mousemvmtCount = 0; + meetings.StartMeeting(); } - private IntPtr OnMouseMessage(int nCode, IntPtr wParam, IntPtr lParam) + private void menuStrip1_MouseEnter(object sender, EventArgs e) { - if (nCode >= 0 && (GlobalHooks.MouseMessages)wParam == GlobalHooks.MouseMessages.WM_MOUSEMOVE) - { - if (!lastmousemvmtTimer.Enabled) - lastmousemvmtTimer.Start(); - } - return GlobalHooks.CallNextHookEx(_hookID, nCode, wParam, lParam); + Focus(); } - private void OpenCamera() + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { - try - { - videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); - if (videoDevices.Count != 0) - { - videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString); - } - else - { - /* - MessageBox.Show(this, "Camera device not found! Get a webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); - Environment.Exit(-2); - */ - vsp.Dispose(); - return; - } - videoCapabilities = videoDevice.VideoCapabilities; - if (videoCapabilities.Length == 0) - { - /* - MessageBox.Show(this, "Camera does not support video capture! Get a better webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); - Environment.Exit(-3); - */ - vsp.Dispose(); - return; - } - - // adjust VSP's resolution so as to not stretch the picture - double aspectRatio = 1.0 * videoCapabilities[0].FrameSize.Width / videoCapabilities[0].FrameSize.Height; - vsp.Size = new System.Drawing.Size(Convert.ToInt32(aspectRatio * 144), 144); - - OpenVideoSource(videoDevice); - } - catch (Exception err) - { - /* - MessageBox.Show(this, err.ToString(), "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); - Environment.Exit(-1); - */ - vsp.Dispose(); - } - } - - private void labelBlinkTimer_Tick(object sender, EventArgs e) - { - this.label2.Visible = !this.label2.Visible; - } - - private void ttsTimer_Tick(object sender, EventArgs e) - { - string msg = "You are being monitored."; - if (tracker.LocationData != null) - msg += string.Format(" Your location is: {0}, {1}", tracker.LocationData.latitude, tracker.LocationData.longitude); - ss.SpeakAsync(msg); - } - - public void OpenVideoSource(IVideoSource source) - { - try - { - // set busy cursor - this.Cursor = Cursors.WaitCursor; - // stop current video source - CloseCurrentVideoSource(); - // start new video source - vsp.VideoSource = source; - vsp.Start(); - this.Cursor = Cursors.Default; - labelBlinkTimer.Start(); - } - catch { } - } - - public void CloseCurrentVideoSource() - { - try - { - if (vsp.VideoSource != null) - { - vsp.SignalToStop(); - // wait ~ 3 seconds - for (int i = 0; i < 30; i++) - { - if (!vsp.IsRunning) - break; - System.Threading.Thread.Sleep(100); - } - if (vsp.IsRunning) - { - vsp.Stop(); - } - vsp.VideoSource = null; - labelBlinkTimer.Stop(); - } - } - catch { } - } - - private void vsp_NewFrame(object sender, ref Bitmap image) - { - try - { - DateTime now = DateTime.Now; - Graphics g = Graphics.FromImage(image); - // paint current time - g.DrawString(now.ToString(), font, brush, new Point(5, 5)); - g.DrawString("Clock in time: " + clockIn.ToString(), font, brush, new Point(5, image.Height - font.Height - 5)); - } - catch - { } + AboutBox dialog = new AboutBox(); + dialog.ShowDialog(); } } } diff --git a/FemboyWatchdog/Toolbar.resx b/FemboyWatchdog/Toolbar.resx index 7080a7d..3e14bf8 100644 --- a/FemboyWatchdog/Toolbar.resx +++ b/FemboyWatchdog/Toolbar.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/FemboyWatchdog/app.config b/FemboyWatchdog/app.config index 7f5ee61..2cbdbeb 100644 --- a/FemboyWatchdog/app.config +++ b/FemboyWatchdog/app.config @@ -1,6 +1,22 @@ + +
+ + + + + http://howfeed.biz/api/ + + + 1445 + + + 31d59064bb7ef00a9daff4794b73118c + + + diff --git a/FemboyWatchdog/media/klaxon.wav b/FemboyWatchdog/media/klaxon.wav new file mode 100644 index 0000000..7853a2c Binary files /dev/null and b/FemboyWatchdog/media/klaxon.wav differ diff --git a/FemboyWatchdog/packages.config b/FemboyWatchdog/packages.config index 04c0b19..9183cfd 100644 --- a/FemboyWatchdog/packages.config +++ b/FemboyWatchdog/packages.config @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/README.md b/README.md index 2aa9e46..626dd66 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The ultimate corporate surveillance mechanism! ## User Requirements -- .NET Framework 3.5 +- .NET Framework 3.0 - Windows XP and up