diff --git a/FemboyInstaller/Download more FemboyFinancial software online!.url b/FemboyInstaller/Download more FemboyFinancial software online!.url index cd23aeb..8e5e80b 100644 --- a/FemboyInstaller/Download more FemboyFinancial software online!.url +++ b/FemboyInstaller/Download more FemboyFinancial software online!.url @@ -1,5 +1,5 @@ [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 [InternetShortcut] -URL=http://ff.howfeed.biz/Downloads/ +URL=http://femboyfinancial.jp/Downloads/ IDList= diff --git a/FemboyInstaller/FemboyInstaller.vdproj b/FemboyInstaller/FemboyInstaller.vdproj index 2d2e9c1..0dfa8bf 100644 --- a/FemboyInstaller/FemboyInstaller.vdproj +++ b/FemboyInstaller/FemboyInstaller.vdproj @@ -22,13 +22,7 @@ "Entry" { "MsmKey" = "8:_20E2146C791105F6934C30A65E1458CA" - "OwnerKey" = "8:_5909879E9BE44DDB371A14BD798CD400" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_20E2146C791105F6934C30A65E1458CA" - "OwnerKey" = "8:_46C8C60227CD93D9A3ADA497BA320E90" + "OwnerKey" = "8:_54602D10025C6F6766454C8F6B75F417" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -40,7 +34,13 @@ "Entry" { "MsmKey" = "8:_20E2146C791105F6934C30A65E1458CA" - "OwnerKey" = "8:_54602D10025C6F6766454C8F6B75F417" + "OwnerKey" = "8:_46C8C60227CD93D9A3ADA497BA320E90" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_20E2146C791105F6934C30A65E1458CA" + "OwnerKey" = "8:_5909879E9BE44DDB371A14BD798CD400" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -70,13 +70,13 @@ "Entry" { "MsmKey" = "8:_54602D10025C6F6766454C8F6B75F417" - "OwnerKey" = "8:_C7272BF4A9D24FD39D08ABB04570B03C" + "OwnerKey" = "8:_F7884CBCC5F6D4C1E8E353172B9C0BA6" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_54602D10025C6F6766454C8F6B75F417" - "OwnerKey" = "8:_F7884CBCC5F6D4C1E8E353172B9C0BA6" + "OwnerKey" = "8:_C7272BF4A9D24FD39D08ABB04570B03C" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -130,37 +130,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_20E2146C791105F6934C30A65E1458CA" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_EBEE36C33EDCA5A5ABEBF8285F4E5150" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_46C8C60227CD93D9A3ADA497BA320E90" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_54602D10025C6F6766454C8F6B75F417" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_5909879E9BE44DDB371A14BD798CD400" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_F7884CBCC5F6D4C1E8E353172B9C0BA6" + "OwnerKey" = "8:_C7272BF4A9D24FD39D08ABB04570B03C" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -172,7 +142,37 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_C7272BF4A9D24FD39D08ABB04570B03C" + "OwnerKey" = "8:_F7884CBCC5F6D4C1E8E353172B9C0BA6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_5909879E9BE44DDB371A14BD798CD400" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_54602D10025C6F6766454C8F6B75F417" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_46C8C60227CD93D9A3ADA497BA320E90" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_EBEE36C33EDCA5A5ABEBF8285F4E5150" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_20E2146C791105F6934C30A65E1458CA" "MsmSig" = "8:_UNDEFINED" } } @@ -237,6 +237,19 @@ "PrerequisitesLocation" = "2:1" "Url" = "8:" "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.0,Profile=Client" + { + "Name" = "8:Microsoft .NET Framework 4 Client Profile (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.0,Profile=Client" + } + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" + { + "Name" = "8:Windows Installer 3.1" + "ProductCode" = "8:Microsoft.Windows.Installer.3.1" + } + } } } } @@ -274,6 +287,11 @@ "AssemblyAsmDisplayName" = "8:AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb, processorArchitecture=MSIL" "ScatterAssemblies" { + "_20E2146C791105F6934C30A65E1458CA" + { + "Name" = "8:AForge.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.dll" "TargetName" = "8:" @@ -300,6 +318,11 @@ "AssemblyAsmDisplayName" = "8:AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b, processorArchitecture=MSIL" "ScatterAssemblies" { + "_46C8C60227CD93D9A3ADA497BA320E90" + { + "Name" = "8:AForge.Imaging.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.Imaging.dll" "TargetName" = "8:" @@ -326,6 +349,11 @@ "AssemblyAsmDisplayName" = "8:Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" "ScatterAssemblies" { + "_502B38277AF62ED70F770D10BD1FD65A" + { + "Name" = "8:Newtonsoft.Json.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:Newtonsoft.Json.dll" "TargetName" = "8:" @@ -352,6 +380,11 @@ "AssemblyAsmDisplayName" = "8:AForge.Video, Version=2.2.5.0, Culture=neutral, PublicKeyToken=cbfb6e07d173c401, processorArchitecture=MSIL" "ScatterAssemblies" { + "_54602D10025C6F6766454C8F6B75F417" + { + "Name" = "8:AForge.Video.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.Video.dll" "TargetName" = "8:" @@ -378,6 +411,11 @@ "AssemblyAsmDisplayName" = "8:AForge.Controls, Version=2.2.5.0, Culture=neutral, PublicKeyToken=a8ac264d1dc6b9d9, processorArchitecture=MSIL" "ScatterAssemblies" { + "_5909879E9BE44DDB371A14BD798CD400" + { + "Name" = "8:AForge.Controls.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.Controls.dll" "TargetName" = "8:" @@ -464,6 +502,11 @@ "AssemblyAsmDisplayName" = "8:AForge.Math, Version=2.2.5.0, Culture=neutral, PublicKeyToken=abba2e25397ee8c9, processorArchitecture=MSIL" "ScatterAssemblies" { + "_EBEE36C33EDCA5A5ABEBF8285F4E5150" + { + "Name" = "8:AForge.Math.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.Math.dll" "TargetName" = "8:" @@ -490,6 +533,11 @@ "AssemblyAsmDisplayName" = "8:AForge.Video.DirectShow, Version=2.2.5.0, Culture=neutral, PublicKeyToken=61ea4348d43881b7, processorArchitecture=MSIL" "ScatterAssemblies" { + "_F7884CBCC5F6D4C1E8E353172B9C0BA6" + { + "Name" = "8:AForge.Video.DirectShow.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:AForge.Video.DirectShow.dll" "TargetName" = "8:" @@ -598,15 +646,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:FemboyWatchdog" - "ProductCode" = "8:{75E1E013-157D-4EE1-98A4-AC33CB590ED8}" - "PackageCode" = "8:{296803F3-755E-4162-B807-73CF6C07DBEB}" + "ProductCode" = "8:{0DC9DD10-CAD3-4AB1-A53D-DD48AFA57549}" + "PackageCode" = "8:{B0FD6310-778F-4F24-961E-691BF3A69E5F}" "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:0.4.0" + "ProductVersion" = "8:0.5.0" "Manufacturer" = "8:FemboyFinancial" "ARPHELPTELEPHONE" = "8:+1 (925) 765-8478" "ARPHELPLINK" = "8:http://ff.howfeed.biz/" @@ -1134,7 +1182,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_C7272BF4A9D24FD39D08ABB04570B03C" { - "SourcePath" = "8:..\\FemboyWatchdog\\obj\\x86\\Release\\FemboyWatchdog.exe" + "SourcePath" = "8:..\\FemboyWatchdog\\obj\\x86\\Debug\\FemboyWatchdog.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_B09D9E8F0A6E4508BA26694479354890" diff --git a/FemboyWatchdog/FemboyWatchdog.csproj b/FemboyWatchdog/FemboyWatchdog.csproj index 693943c..d7093aa 100644 --- a/FemboyWatchdog/FemboyWatchdog.csproj +++ b/FemboyWatchdog/FemboyWatchdog.csproj @@ -78,6 +78,7 @@ ..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll True + ..\packages\Newtonsoft.Json.9.0.1\lib\net20\Newtonsoft.Json.dll True @@ -111,6 +112,13 @@ MeetingNotification.cs + + + Form + + + MemoViewer.cs + @@ -142,6 +150,9 @@ MeetingNotification.cs + + MemoViewer.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/FemboyWatchdog/MeetingProvider.cs b/FemboyWatchdog/MeetingProvider.cs index b77d385..6a8c66e 100644 --- a/FemboyWatchdog/MeetingProvider.cs +++ b/FemboyWatchdog/MeetingProvider.cs @@ -70,6 +70,8 @@ namespace FemboyWatchdog if (Checking) return; + _timer_Tick(this, null); + _timer = new Timer(); _timer.Interval = Convert.ToInt32(_checkInterval * 1000); _timer.Tick += new EventHandler(_timer_Tick); diff --git a/FemboyWatchdog/MemoProvider.cs b/FemboyWatchdog/MemoProvider.cs new file mode 100644 index 0000000..0555371 --- /dev/null +++ b/FemboyWatchdog/MemoProvider.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Windows.Forms; +using Newtonsoft.Json; + +namespace FemboyWatchdog +{ + public class MemoProvider + { + private WebClient _memoChecker; + private WebClient _memoCreator; + private Timer _timer; + public List Memos { get; private set; } + private DateTime _lastReceivedMemoTime; + private double _checkInterval; + public bool Checking { get; private set; } + + public event EventHandler NewMemo; + + public class Memo : EventArgs + { + public DateTime Time; + public string Message; + } + + internal class MemoError : EventArgs + { + public string Error; + } + + public MemoProvider(double interval = 5.0) + { + _memoChecker = new WebClient(); + _memoChecker.DownloadStringCompleted += new DownloadStringCompletedEventHandler(_memoChecker_DownloadStringCompleted); + + _memoCreator = new WebClient(); + _memoCreator.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; + _memoCreator.UploadStringCompleted += new UploadStringCompletedEventHandler(_memoCreator_UploadStringCompleted); + + Memos = new List(); + + _lastReceivedMemoTime = DateTime.UtcNow; + _checkInterval = interval; + Checking = false; + } + + private void _memoCreator_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) + { + // apparently headers get unset if you reuse the WebClient + _memoCreator.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; + + if (e.Cancelled || e.Error != null) + return; + + try + { + Memos = JsonConvert.DeserializeObject>(e.Result); + } + catch (JsonSerializationException err) + { + try + { + MemoError response = JsonConvert.DeserializeObject(e.Result); + MessageBox.Show(response.Error, "Error Sending Memo", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch (JsonSerializationException err2) + { + MessageBox.Show("Unknown deserialization error", "Error Sending Memo", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + public void PostNewMemo(string message) + { + _memoCreator.UploadStringAsync( + new Uri(Properties.Settings.Default.FemboyApiBaseUrl + "memo"), + string.Format("token={0}&message={1}", Properties.Settings.Default.FemboyApiToken, Uri.EscapeDataString(message)) + ); + + } + + public void StartChecking() + { + if (Checking) + return; + + _timer_Tick(this, null); + + _timer = new Timer(); + _timer.Interval = Convert.ToInt32(_checkInterval * 1000); + _timer.Tick += new EventHandler(_timer_Tick); + _timer.Start(); + + Checking = true; + } + + private bool FindNewMemos(Memo m) + { + return m.Time > _lastReceivedMemoTime; + } + + private void _memoChecker_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) + { + if (e.Cancelled || e.Error != null) + return; + + try + { + Memos = JsonConvert.DeserializeObject>(e.Result); + + foreach (Memo m in Memos.FindAll(FindNewMemos)) + { + _lastReceivedMemoTime = m.Time; + OnNewMemo(m); + } + } + catch (JsonSerializationException err) { } + } + + protected virtual void OnNewMemo(Memo m) + { + EventHandler handler = NewMemo; + if (handler != null) + { + handler(this, m); + } + } + + private void _timer_Tick(object sender, EventArgs e) + { + if (!_memoChecker.IsBusy) + { + try + { + _memoChecker.DownloadStringAsync(new Uri( + string.Format( + "{0}memo/?token={1}", + Properties.Settings.Default.FemboyApiBaseUrl, + Properties.Settings.Default.FemboyApiToken + ) + )); + } + catch (WebException err) { } + } + } + } +} diff --git a/FemboyWatchdog/MemoViewer.Designer.cs b/FemboyWatchdog/MemoViewer.Designer.cs new file mode 100644 index 0000000..274d0b5 --- /dev/null +++ b/FemboyWatchdog/MemoViewer.Designer.cs @@ -0,0 +1,79 @@ +namespace FemboyWatchdog +{ + partial class MemoViewer + { + /// + /// 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.button1 = new System.Windows.Forms.Button(); + this.memosList = new System.Windows.Forms.ListView(); + this.SuspendLayout(); + // + // button1 + // + this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.button1.Location = new System.Drawing.Point(210, 237); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Close"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // memosList + // + this.memosList.Location = new System.Drawing.Point(12, 12); + this.memosList.Name = "memosList"; + this.memosList.Size = new System.Drawing.Size(470, 219); + this.memosList.TabIndex = 1; + this.memosList.UseCompatibleStateImageBehavior = false; + this.memosList.View = System.Windows.Forms.View.Details; + // + // MemoViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.button1; + this.ClientSize = new System.Drawing.Size(494, 272); + this.Controls.Add(this.memosList); + this.Controls.Add(this.button1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.Name = "MemoViewer"; + this.ShowInTaskbar = false; + this.Text = "Viewing All Company Memos"; + this.TopMost = true; + this.Load += new System.EventHandler(this.MemoViewer_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ListView memosList; + } +} \ No newline at end of file diff --git a/FemboyWatchdog/MemoViewer.cs b/FemboyWatchdog/MemoViewer.cs new file mode 100644 index 0000000..cd463eb --- /dev/null +++ b/FemboyWatchdog/MemoViewer.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace FemboyWatchdog +{ + public partial class MemoViewer : Form + { + private List _memos; + + public MemoViewer(List memos) + { + InitializeComponent(); + + _memos = memos; + memosList.View = View.Details; + memosList.Columns.Add("Date", 150); + memosList.Columns.Add("Message", 300); + } + + private void button1_Click(object sender, EventArgs e) + { + Close(); + } + + private void MemoViewer_Load(object sender, EventArgs e) + { + foreach (MemoProvider.Memo memo in _memos) + { + string[] columns = { memo.Time.ToString(), memo.Message }; + ListViewItem li = new ListViewItem(columns); + memosList.Items.Add(li); + } + } + } +} diff --git a/FemboyWatchdog/MemoViewer.resx b/FemboyWatchdog/MemoViewer.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/FemboyWatchdog/MemoViewer.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/Properties/AssemblyInfo.cs b/FemboyWatchdog/Properties/AssemblyInfo.cs index 617496f..e72c86b 100644 --- a/FemboyWatchdog/Properties/AssemblyInfo.cs +++ b/FemboyWatchdog/Properties/AssemblyInfo.cs @@ -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("0.0.4.0")] -[assembly: AssemblyFileVersion("0.0.4.0")] +[assembly: AssemblyVersion("0.0.5.0")] +[assembly: AssemblyFileVersion("0.0.5.0")] diff --git a/FemboyWatchdog/Toolbar.Designer.cs b/FemboyWatchdog/Toolbar.Designer.cs index 8204034..13b685b 100644 --- a/FemboyWatchdog/Toolbar.Designer.cs +++ b/FemboyWatchdog/Toolbar.Designer.cs @@ -33,8 +33,12 @@ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.meetingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.callAMeetingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.postMemoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewPastMemosToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.memoLabel = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -46,7 +50,7 @@ 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.Size = new System.Drawing.Size(500, 24); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.MouseEnter += new System.EventHandler(this.menuStrip1_MouseEnter); @@ -68,18 +72,40 @@ // meetingToolStripMenuItem // this.meetingToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.callAMeetingToolStripMenuItem}); + this.callAMeetingToolStripMenuItem, + this.toolStripSeparator1, + this.postMemoToolStripMenuItem, + this.viewPastMemosToolStripMenuItem}); this.meetingToolStripMenuItem.Name = "meetingToolStripMenuItem"; - this.meetingToolStripMenuItem.Size = new System.Drawing.Size(63, 20); - this.meetingToolStripMenuItem.Text = "Meeting"; + this.meetingToolStripMenuItem.Size = new System.Drawing.Size(71, 20); + this.meetingToolStripMenuItem.Text = "Company"; // // callAMeetingToolStripMenuItem // this.callAMeetingToolStripMenuItem.Name = "callAMeetingToolStripMenuItem"; - this.callAMeetingToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.callAMeetingToolStripMenuItem.Size = new System.Drawing.Size(167, 22); this.callAMeetingToolStripMenuItem.Text = "Call a Meeting"; this.callAMeetingToolStripMenuItem.Click += new System.EventHandler(this.callAMeetingToolStripMenuItem_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(164, 6); + // + // postMemoToolStripMenuItem + // + this.postMemoToolStripMenuItem.Name = "postMemoToolStripMenuItem"; + this.postMemoToolStripMenuItem.Size = new System.Drawing.Size(167, 22); + this.postMemoToolStripMenuItem.Text = "Post a Memo..."; + this.postMemoToolStripMenuItem.Click += new System.EventHandler(this.postMemoToolStripMenuItem_Click); + // + // viewPastMemosToolStripMenuItem + // + this.viewPastMemosToolStripMenuItem.Name = "viewPastMemosToolStripMenuItem"; + this.viewPastMemosToolStripMenuItem.Size = new System.Drawing.Size(167, 22); + this.viewPastMemosToolStripMenuItem.Text = "View Past Memos"; + this.viewPastMemosToolStripMenuItem.Click += new System.EventHandler(this.viewPastMemosToolStripMenuItem_Click); + // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -91,16 +117,27 @@ // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // + // memoLabel + // + this.memoLabel.AutoSize = true; + this.memoLabel.BackColor = System.Drawing.Color.Chartreuse; + this.memoLabel.Location = new System.Drawing.Point(181, 6); + this.memoLabel.Name = "memoLabel"; + this.memoLabel.Size = new System.Drawing.Size(138, 13); + this.memoLabel.TabIndex = 2; + this.memoLabel.Text = "Loading Company Memos..."; + // // Toolbar // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Lime; - this.ClientSize = new System.Drawing.Size(400, 24); + this.ClientSize = new System.Drawing.Size(500, 24); + this.Controls.Add(this.memoLabel); this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MainMenuStrip = this.menuStrip1; @@ -128,6 +165,10 @@ private System.Windows.Forms.ToolStripMenuItem callAMeetingToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem postMemoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem viewPastMemosToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.Label memoLabel; } } \ No newline at end of file diff --git a/FemboyWatchdog/Toolbar.cs b/FemboyWatchdog/Toolbar.cs index 392b67d..72892bc 100644 --- a/FemboyWatchdog/Toolbar.cs +++ b/FemboyWatchdog/Toolbar.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.VisualBasic; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -11,6 +12,9 @@ namespace FemboyWatchdog public partial class Toolbar : Form { private MeetingProvider meetings; + private MemoProvider memos; + private Timer _labelTimer; + private int _memoIndex; public Toolbar() { @@ -20,6 +24,37 @@ namespace FemboyWatchdog meetings = new MeetingProvider(); meetings.MeetingStarted += new EventHandler(meetings_MeetingStarted); meetings.StartChecking(); + + memos = new MemoProvider(); + memos.NewMemo += new EventHandler(memos_NewMemo); + memos.StartChecking(); + + _memoIndex = 0; + + _labelTimer = new Timer(); + _labelTimer.Interval = 10000; + _labelTimer.Tick += new EventHandler(_labelTimer_Tick); + _labelTimer.Start(); + + memoLabel.Hide(); + } + + private void _labelTimer_Tick(object sender, EventArgs e) + { + if (memos.Memos.Count == 0) + { + memoLabel.Hide(); + } + else + { + memoLabel.Text = memos.Memos[_memoIndex++ % memos.Memos.Count].Message; + memoLabel.Show(); + } + } + + private void memos_NewMemo(object sender, MemoProvider.Memo m) + { + MessageBox.Show(m.Message, "NEW COMPANY MEMO", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void meetings_MeetingStarted(object sender, EventArgs e) @@ -43,5 +78,18 @@ namespace FemboyWatchdog AboutBox dialog = new AboutBox(); dialog.ShowDialog(); } + + private void postMemoToolStripMenuItem_Click(object sender, EventArgs e) + { + string message = Interaction.InputBox("Enter a messsage:", "Post a Memo"); + if (message.Length > 0) + memos.PostNewMemo(message); + } + + private void viewPastMemosToolStripMenuItem_Click(object sender, EventArgs e) + { + MemoViewer dialog = new MemoViewer(memos.Memos); + dialog.Show(); + } } }