diff --git a/LightController.cs b/LightController.cs
index e80b9e0..f3b1567 100644
--- a/LightController.cs
+++ b/LightController.cs
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
-using System.Timers;
using Common.Native;
-using SKYPE4COMLib;
using WorkIndicator.Delcom;
namespace WorkIndicator
@@ -23,8 +20,6 @@ namespace WorkIndicator
private static StoplightIndicator _stoplightIndicator;
private static bool _initialized;
private static Status _status = Status.Auto;
- private static Timer _retryTimer;
- private static Timer _updateTimer;
public static void Initialize()
{
@@ -32,11 +27,6 @@ namespace WorkIndicator
_stoplightIndicator.SetLight(StoplightIndicator.Light.Green, StoplightIndicator.LightState.On);
InitializeWindowDetection();
- InitializeSkypeDetection();
-
- _updateTimer = new Timer(Properties.Settings.Default.UpdateInterval.TotalMilliseconds) { AutoReset = false };
- _updateTimer.Elapsed += HandleUpdateTimerElapsed;
- _updateTimer.Start();
_initialized = true;
}
@@ -46,11 +36,8 @@ namespace WorkIndicator
if (!_initialized)
return;
- _updateTimer.Dispose();
-
TerminateWindowDetection();
- TerminateSkypeDetection();
-
+
_stoplightIndicator.SetLights(StoplightIndicator.LightState.Off, StoplightIndicator.LightState.Off, StoplightIndicator.LightState.Off);
_stoplightIndicator.Dispose();
@@ -75,13 +62,7 @@ namespace WorkIndicator
if (_status == Status.Auto)
{
- ISkype skype = _skype;
-
- if (skype != null && skype.ActiveCalls.Count > 0)
- {
- red = skype.Mute ? StoplightIndicator.LightState.On : StoplightIndicator.LightState.Blink;
- }
- else if (WindowHandles.Count > 0)
+ if (WindowHandles.Count > 0)
{
yellow = StoplightIndicator.LightState.On;
}
@@ -114,76 +95,6 @@ namespace WorkIndicator
_stoplightIndicator.SetLights(red, yellow, green);
}
- #region Skype detection
-
- private static Skype _skype;
-
- public static void InitializeSkypeDetection()
- {
- try
- {
- _skype = new Skype();
- _skype.Attach();
-
- var skype = (ISkype) _skype;
- skype.Mute = !skype.Mute;
- skype.Mute = !skype.Mute;
-
- _ISkypeEvents_Event skypeEvents = _skype;
-
- skypeEvents.CallStatus += HandleSkypeCallStatus;
- skypeEvents.Mute += HandleSkypeEventsMute;
-
- UpdateLights();
- }
- catch (Exception)
- {
- if (_retryTimer == null)
- {
- _retryTimer = new Timer(Properties.Settings.Default.RetryInterval.TotalMilliseconds) { AutoReset = false };
- _retryTimer.Elapsed += HandRetryTimerElapsed;
- }
-
- _retryTimer.Start();
- }
- }
-
- static void HandRetryTimerElapsed(object sender, ElapsedEventArgs e)
- {
- InitializeSkypeDetection();
- }
-
- private static void HandleUpdateTimerElapsed(object sender, ElapsedEventArgs e)
- {
- UpdateLights();
-
- _updateTimer.Start();
- }
-
- private static void HandleSkypeEventsMute(bool mute)
- {
- UpdateLights();
- }
-
- private static void HandleSkypeCallStatus(Call call, TCallStatus status)
- {
- UpdateLights();
- }
-
- public static void TerminateSkypeDetection()
- {
- _ISkypeEvents_Event skypeEvents = _skype;
-
- skypeEvents.CallStatus -= HandleSkypeCallStatus;
- skypeEvents.Mute -= HandleSkypeEventsMute;
-
- Marshal.ReleaseComObject(_skype);
-
- _skype = null;
- }
-
- #endregion
-
#region Window detection
private static readonly WinEvent.WinEventDelegate ProcDelegate = WinEventProc;
@@ -206,7 +117,7 @@ namespace WorkIndicator
WindowEventHooks.Add(hook);
}
- public static void TerminateWindowDetection()
+ private static void TerminateWindowDetection()
{
WindowEventHooks.ForEach(h => WinEvent.UnhookWinEvent(h));
}
@@ -239,10 +150,8 @@ namespace WorkIndicator
case WinEvent.Event.ObjectDestroy:
if (WindowHandles.Contains(hwnd))
- WindowHandles.Remove(hwnd);
-
- if (WindowMatchRegex.IsMatch(Functions.Window.GetText(hwnd)))
{
+ WindowHandles.Remove(hwnd);
UpdateLights();
}
diff --git a/WorkIndicator.csproj b/WorkIndicator.csproj
index d62ac0e..06c7b9d 100644
--- a/WorkIndicator.csproj
+++ b/WorkIndicator.csproj
@@ -188,17 +188,6 @@
-
-
- {03282B5D-B38F-469D-849A-09B0A7F4881B}
- 1
- 0
- 0
- tlbimp
- False
- True
-
-