diff --git a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip index 669be9f1b..a06bf1330 100644 Binary files a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip and b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip differ diff --git a/Artemis/Artemis86Wrapper/Artemis86Wrapper.csproj b/Artemis/Artemis86Wrapper/Artemis86Wrapper.csproj index 3c7bbe96f..e8bfd36d6 100644 --- a/Artemis/Artemis86Wrapper/Artemis86Wrapper.csproj +++ b/Artemis/Artemis86Wrapper/Artemis86Wrapper.csproj @@ -49,6 +49,10 @@ 4 + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + @@ -59,12 +63,16 @@ + + - + + + diff --git a/Artemis/Artemis86Wrapper/Intergrations/IIntergrationManager.cs b/Artemis/Artemis86Wrapper/Intergrations/IIntergrationManager.cs new file mode 100644 index 000000000..cf9dbbacb --- /dev/null +++ b/Artemis/Artemis86Wrapper/Intergrations/IIntergrationManager.cs @@ -0,0 +1,10 @@ +namespace Artemis86Wrapper.Intergrations +{ + public interface IIntergrationManager + { + IIntergrationModel IntergrationModel { get; set; } + + void Start(); + void Stop(); + } +} \ No newline at end of file diff --git a/Artemis/Artemis86Wrapper/Intergrations/IIntergrationModel.cs b/Artemis/Artemis86Wrapper/Intergrations/IIntergrationModel.cs new file mode 100644 index 000000000..61dc70757 --- /dev/null +++ b/Artemis/Artemis86Wrapper/Intergrations/IIntergrationModel.cs @@ -0,0 +1,6 @@ +namespace Artemis86Wrapper.Intergrations +{ + public interface IIntergrationModel + { + } +} \ No newline at end of file diff --git a/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeManager.cs b/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeManager.cs new file mode 100644 index 000000000..fb146c659 --- /dev/null +++ b/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeManager.cs @@ -0,0 +1,59 @@ +using System; +using System.Timers; +using SKYPE4COMLib; + +namespace Artemis86Wrapper.Intergrations.Skype +{ + public class SkypeManager : IIntergrationManager + { + public SkypeManager() + { + IntergrationModel = new SkypeModel(); + LoopTimer = new Timer(5000); + LoopTimer.Elapsed += UpdateSkype; + } + + public SKYPE4COMLib.Skype Skype { get; set; } + public Timer LoopTimer { get; set; } + + public IIntergrationModel IntergrationModel { get; set; } + + public void Start() + { + Skype = new SKYPE4COMLib.Skype(); + Skype.Attach(); + + LoopTimer.Start(); + } + + public void Stop() + { + LoopTimer.Stop(); + Skype = null; + } + + private void UpdateSkype(object sender, ElapsedEventArgs e) + { + try + { + var model = (SkypeModel) IntergrationModel; + + model.Name = Skype.CurrentUser.FullName; + model.Status = Skype.CurrentUserStatus; + model.MissedCalls = Skype.MissedCalls.Count; + model.ActiveCalls = Skype.ActiveCalls.Count; + model.UnreadMessages = 0; + model.MissedCalls = model.MissedCalls = model.ActiveCalls; + foreach (ChatMessage skypeMissedMessage in Skype.MissedMessages) + if ((skypeMissedMessage.Type == TChatMessageType.cmeSaid) && + (skypeMissedMessage.Status != TChatMessageStatus.cmsRead) && + (skypeMissedMessage.FromHandle != Skype.CurrentUser.Handle)) + model.UnreadMessages++; + } + catch (Exception ex) + { + // TODO: Log exception to main program + } + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeModel.cs b/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeModel.cs new file mode 100644 index 000000000..b140f18a8 --- /dev/null +++ b/Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeModel.cs @@ -0,0 +1,13 @@ +using SKYPE4COMLib; + +namespace Artemis86Wrapper.Intergrations.Skype +{ + public class SkypeModel : IIntergrationModel + { + public string Name { get; set; } + public int UnreadMessages { get; set; } + public int MissedCalls { get; set; } + public int ActiveCalls { get; set; } + public TUserStatus Status { get; set; } + } +} \ No newline at end of file diff --git a/Artemis/Artemis86Wrapper/Program.cs b/Artemis/Artemis86Wrapper/Program.cs index a6fc53b57..779c38c3c 100644 --- a/Artemis/Artemis86Wrapper/Program.cs +++ b/Artemis/Artemis86Wrapper/Program.cs @@ -1,4 +1,5 @@ using System; +using Artemis86Wrapper.Intergrations.Skype; namespace Artemis86Wrapper { diff --git a/Artemis/Artemis86Wrapper/SkypeManager.cs b/Artemis/Artemis86Wrapper/SkypeManager.cs deleted file mode 100644 index 28e3bf88e..000000000 --- a/Artemis/Artemis86Wrapper/SkypeManager.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Timers; -using SKYPE4COMLib; - -namespace Artemis86Wrapper -{ - public class SkypeManager - { - private readonly Timer _loopTimer; - - public SkypeManager() - { - _loopTimer = new Timer(5000); - _loopTimer.Elapsed += UpdateSkype; - } - - public Skype Skype { get; set; } - - public void Start() - { - Skype = new Skype(); - _loopTimer.Start(); - } - - public void Stop() - { - _loopTimer.Stop(); - Skype = null; - } - - private void UpdateSkype(object sender, ElapsedEventArgs e) - { - Console.WriteLine("Missed messages: " + Skype.Messages.Count); - } - } -} \ No newline at end of file diff --git a/Artemis/Artemis86Wrapper/packages.config b/Artemis/Artemis86Wrapper/packages.config new file mode 100644 index 000000000..92824ba6e --- /dev/null +++ b/Artemis/Artemis86Wrapper/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file