Skip to content

Commit ecb2e05

Browse files
committed
Updates from the original code
Redesigned the UI. Now it is more compact. Added minimize to tray. Now the app will minimize to the notification tray. Added support for more status changes: DoNotDisturb + TemporarilyAway + Offline. Workaround for email issues (hardcoded to Last email from list) - MAY NOT WORK FOR YOU OUT OF THE BOX
1 parent bac3ce8 commit ecb2e05

File tree

8 files changed

+1253
-36
lines changed

8 files changed

+1253
-36
lines changed

Logic/ChangeAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private void ChangeImage(string email, ContactAvailability status)
2727
if (_mf.lvList.InvokeRequired)
2828
{
2929
ImageCallBack d = new ImageCallBack(ChangeImage);
30-
_mf.Invoke(d, new object[] { email, status });
30+
this._mf.Invoke(d, new object[] { email, status });
3131
}
3232
else
3333
{

Logic/EmailManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using Microsoft.Office.Interop.Outlook;
67

78
namespace LyncTracker.Logic
89
{

Logic/Tracker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void Callback(IAsyncResult ar)
4141
_cList.Add(c);
4242
c.ContactInformationChanged+= c_ContactInformationChanged;
4343
ContactAvailability availEnum = (ContactAvailability)c.GetContactInformation(ContactInformationType.Availability);
44-
_cn.SendStatusChange((string)((List<object>)c.GetContactInformation(ContactInformationType.EmailAddresses)).First(), availEnum);
44+
_cn.SendStatusChange((string)((List<object>)c.GetContactInformation(ContactInformationType.EmailAddresses)).Last(), availEnum);
4545
}
4646
catch
4747
{
@@ -120,7 +120,7 @@ void c_ContactInformationChanged(object sender, ContactInformationChangedEventAr
120120

121121
Contact c = ((Contact)sender);
122122
List<object> list = (List<object>)(((Contact)sender).GetContactInformation(ContactInformationType.EmailAddresses));
123-
_cn.SendStatusChange((string)list.First(), ((string)c.GetContactInformation(ContactInformationType.LastName)),
123+
_cn.SendStatusChange((string)list.Last(), ((string)c.GetContactInformation(ContactInformationType.LastName)),
124124
((string)c.GetContactInformation(ContactInformationType.FirstName)),
125125
availEnum, DateTime.Now.ToLocalTime());
126126
}

LyncTracker.csproj

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,35 @@
114114
<None Include="Resources\yellow.png" />
115115
<None Include="Resources\green.png" />
116116
</ItemGroup>
117+
<ItemGroup>
118+
<COMReference Include="Microsoft.Office.Core">
119+
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
120+
<VersionMajor>2</VersionMajor>
121+
<VersionMinor>8</VersionMinor>
122+
<Lcid>0</Lcid>
123+
<WrapperTool>primary</WrapperTool>
124+
<Isolated>False</Isolated>
125+
<EmbedInteropTypes>True</EmbedInteropTypes>
126+
</COMReference>
127+
<COMReference Include="Microsoft.Office.Interop.Outlook1">
128+
<Guid>{00062FFF-0000-0000-C000-000000000046}</Guid>
129+
<VersionMajor>9</VersionMajor>
130+
<VersionMinor>6</VersionMinor>
131+
<Lcid>0</Lcid>
132+
<WrapperTool>primary</WrapperTool>
133+
<Isolated>False</Isolated>
134+
<EmbedInteropTypes>True</EmbedInteropTypes>
135+
</COMReference>
136+
<COMReference Include="stdole">
137+
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
138+
<VersionMajor>2</VersionMajor>
139+
<VersionMinor>0</VersionMinor>
140+
<Lcid>0</Lcid>
141+
<WrapperTool>primary</WrapperTool>
142+
<Isolated>False</Isolated>
143+
<EmbedInteropTypes>True</EmbedInteropTypes>
144+
</COMReference>
145+
</ItemGroup>
117146
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
118147
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
119148
Other similar extension points exist, see Microsoft.Common.targets.

MainForm.Designer.cs

Lines changed: 48 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MainForm.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,16 @@ private List<ContactAvailability> GetStatusList()
117117
statusList.Add(ContactAvailability.FreeIdle);
118118
}
119119
if (checkedList.Any(it=>it.Text=="Away"))
120+
{
120121
statusList.Add(ContactAvailability.Away);
122+
statusList.Add(ContactAvailability.TemporarilyAway);
123+
statusList.Add(ContactAvailability.Offline);
124+
}
121125
if (clbStatuses.CheckedItems.ContainsKey("Busy"))
122126
{
123127
statusList.Add(ContactAvailability.Busy);
124128
statusList.Add(ContactAvailability.BusyIdle);
129+
statusList.Add(ContactAvailability.DoNotDisturb);
125130
}
126131
if (clbStatuses.CheckedItems.ContainsKey("Do not disturb"))
127132
statusList.Add(ContactAvailability.DoNotDisturb);
@@ -152,5 +157,27 @@ private void bSearch_Click(object sender, EventArgs e)
152157
tbLog.Text = sfdSave.FileName.Contains(".csv") ? sfdSave.FileName : sfdSave.FileName+".csv";
153158
}
154159

160+
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
161+
{
162+
this.Show();
163+
this.WindowState = FormWindowState.Normal;
164+
}
165+
166+
private void MainForm_Resize(object sender, EventArgs e)
167+
{
168+
notifyIcon1.BalloonTipTitle = "Lync Tracker";
169+
notifyIcon1.BalloonTipText = "Lync Tracker is still running in background!";
170+
171+
if (FormWindowState.Minimized == this.WindowState)
172+
{
173+
notifyIcon1.Visible = true;
174+
notifyIcon1.ShowBalloonTip(500);
175+
this.Hide();
176+
}
177+
else if (FormWindowState.Normal == this.WindowState)
178+
{
179+
notifyIcon1.Visible = false;
180+
}
181+
}
155182
}
156183
}

0 commit comments

Comments
 (0)