From: <ba...@us...> - 2014-08-14 21:47:13
|
Revision: 4870 http://sourceforge.net/p/mp-plugins/code/4870 Author: bartev Date: 2014-08-14 21:47:03 +0000 (Thu, 14 Aug 2014) Log Message: ----------- Added direct scene trigger control and MP 1.8.x support Modified Paths: -------------- trunk/plugins/VeraControl/DialogActionTrigger.cs trunk/plugins/VeraControl/DialogDeviceControl.cs trunk/plugins/VeraControl/VeraControl.cs trunk/plugins/VeraControl/VeraControl.csproj trunk/plugins/VeraControl/VeraControl.sln Modified: trunk/plugins/VeraControl/DialogActionTrigger.cs =================================================================== --- trunk/plugins/VeraControl/DialogActionTrigger.cs 2014-08-14 21:45:58 UTC (rev 4869) +++ trunk/plugins/VeraControl/DialogActionTrigger.cs 2014-08-14 21:47:03 UTC (rev 4870) @@ -63,7 +63,18 @@ [SkinControlAttribute(50)] protected GUISpinButton _spMPStart = null; [SkinControlAttribute(51)] protected GUISpinButton _spMPSleep = null; [SkinControlAttribute(52)] protected GUISpinButton _spMPExit = null; - + + [SkinControlAttribute(60)] protected GUISpinButton _spNumkey0 = null; + [SkinControlAttribute(61)] protected GUISpinButton _spNumkey1 = null; + [SkinControlAttribute(62)] protected GUISpinButton _spNumkey2 = null; + [SkinControlAttribute(63)] protected GUISpinButton _spNumkey3 = null; + [SkinControlAttribute(64)] protected GUISpinButton _spNumkey4 = null; + [SkinControlAttribute(65)] protected GUISpinButton _spNumkey5 = null; + [SkinControlAttribute(66)] protected GUISpinButton _spNumkey6 = null; + [SkinControlAttribute(67)] protected GUISpinButton _spNumkey7 = null; + [SkinControlAttribute(68)] protected GUISpinButton _spNumkey8 = null; + [SkinControlAttribute(69)] protected GUISpinButton _spNumkey9 = null; + private VeraCommunication _vera = VeraCommunication.Instance; public DialogActionTrigger() @@ -84,7 +95,9 @@ _spRecStart, _spRecPause, _spRecResume, _spRecStop, _spRadioStart, _spRadioPause, _spRadioResume, _spRadioStop, _spUnknownStart, _spUnknownPause, _spUnknownResume, _spUnknownStop, - _spMPStart, _spMPSleep, _spMPExit + _spMPStart, _spMPSleep, _spMPExit, + _spNumkey0, _spNumkey1, _spNumkey2, _spNumkey3, _spNumkey4, + _spNumkey5, _spNumkey6, _spNumkey7, _spNumkey8, _spNumkey9 }; // (P)re load spin contor @@ -153,7 +166,9 @@ _spRecStart, _spRecPause, _spRecResume, _spRecStop, _spRadioStart, _spRadioPause, _spRadioResume, _spRadioStop, _spUnknownStart, _spUnknownPause, _spUnknownResume, _spUnknownStop, - _spMPStart, _spMPSleep, _spMPExit + _spMPStart, _spMPSleep, _spMPExit, + _spNumkey0, _spNumkey1, _spNumkey2, _spNumkey3, _spNumkey4, + _spNumkey5, _spNumkey6, _spNumkey7, _spNumkey8, _spNumkey9 }; for (int i = 0; i < spinList.Length; i++) { Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs =================================================================== --- trunk/plugins/VeraControl/DialogDeviceControl.cs 2014-08-14 21:45:58 UTC (rev 4869) +++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2014-08-14 21:47:03 UTC (rev 4870) @@ -9,6 +9,7 @@ * E-mail: ba...@ev... */ using System; +using System.Windows; using System.Threading; using System.Collections; using MediaPortal; Modified: trunk/plugins/VeraControl/VeraControl.cs =================================================================== --- trunk/plugins/VeraControl/VeraControl.cs 2014-08-14 21:45:58 UTC (rev 4869) +++ trunk/plugins/VeraControl/VeraControl.cs 2014-08-14 21:47:03 UTC (rev 4870) @@ -72,6 +72,17 @@ MP_SHUTDOWN, MP_EXIT, + NUMKEY_0, + NUMKEY_1, + NUMKEY_2, + NUMKEY_3, + NUMKEY_4, + NUMKEY_5, + NUMKEY_6, + NUMKEY_7, + NUMKEY_8, + NUMKEY_9, + LAST_ACTIONTRIGGER }; @@ -117,6 +128,7 @@ private long _lastSystemStatusChg = 0; private int _lastSystemStatusId = 0; + private int _directSceneState = 0; // 1 = 1 star = pressed, 2 = 2 stars pressen '0' - '9' num key pressen --> waiting for # to confirm public bool _enableSceneTrigger = false; private bool _autoSelectRoom = true; private bool _viewPerCategory = false; @@ -238,6 +250,7 @@ { _selectedRoom = ALL; _selectedSection = ALL; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings()) { @@ -327,12 +340,20 @@ { switch(action.wID) { // This switch is for debug purposes (set breakpoint on next switch to debug Actions add ignore mouse/key actions) - case Action.ActionType.ACTION_KEY_PRESSED: case Action.ActionType.ACTION_MOUSE_CLICK: case Action.ActionType.ACTION_MOUSE_DOUBLECLICK: case Action.ActionType.ACTION_MOUSE_MOVE: return; } + + + switch(action.wID) + { + + default: + break; + } + // Handle global action responders first (Scene triggers need to be handled also when we are not visible) switch(action.wID) { @@ -385,6 +406,80 @@ HandleActionTriggers(Actiontrigger.MP_SHUTDOWN); break; + // This case is for handling direct scene request **<num># + case Action.ActionType.ACTION_KEY_PRESSED: + // 1 = 1 star = pressed, 2 = 2 stars pressed, '0' - '9' num key pressed --> waiting for # to confirm + if (action.m_key.KeyChar == '*' && _directSceneState <= 1) + { + this._directSceneState++; + + // TODO: prevent key-pressed action from begin handled further by MP + break; + } + + if (_directSceneState == 2 && action.m_key.KeyChar >= '0' && action.m_key.KeyChar <= '9') + { + // Store selected scene key number + this._directSceneState = action.m_key.KeyChar; + + // TODO: prevent key-pressed action from begin handled further by MP + break; + } + + if (_directSceneState >= '0' && _directSceneState <= '9' && action.m_key.KeyChar == '#') + { + #region Yes we have a go for Scene execution! + Log.Info("Action Key pressed run scene for key: " + this._directSceneState); + switch (this._directSceneState) + { + case '0': + HandleActionTriggers(Actiontrigger.NUMKEY_0); + break; + + case '1': + HandleActionTriggers(Actiontrigger.NUMKEY_1); + break; + + case '2': + HandleActionTriggers(Actiontrigger.NUMKEY_2); + break; + + case '3': + HandleActionTriggers(Actiontrigger.NUMKEY_3); + break; + + case '4': + HandleActionTriggers(Actiontrigger.NUMKEY_4); + break; + + case '5': + HandleActionTriggers(Actiontrigger.NUMKEY_5); + break; + + case '6': + HandleActionTriggers(Actiontrigger.NUMKEY_6); + break; + + case '7': + HandleActionTriggers(Actiontrigger.NUMKEY_7); + break; + + case '8': + HandleActionTriggers(Actiontrigger.NUMKEY_8); + break; + + case '9': + HandleActionTriggers(Actiontrigger.NUMKEY_9); + break; + } + #endregion + // TODO: prevent key-pressed action from begin handled further by MP + } + + // Reset direct scene state + _directSceneState = 0; + break; + // Resume ? how to determine (Plug in init?) default: break; @@ -402,6 +497,7 @@ case Action.ActionType.ACTION_MOUSE_MOVE: break; + // Handle menu info key case Action.ActionType.ACTION_CONTEXT_MENU: case Action.ActionType.ACTION_SHOW_INFO: ShowInfoDialog(); Modified: trunk/plugins/VeraControl/VeraControl.csproj =================================================================== --- trunk/plugins/VeraControl/VeraControl.csproj 2014-08-14 21:45:58 UTC (rev 4869) +++ trunk/plugins/VeraControl/VeraControl.csproj 2014-08-14 21:47:03 UTC (rev 4870) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <PropertyGroup> <ProjectGuid>{B403D22F-BFFF-41F5-846E-E60586CFB39F}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -7,7 +7,7 @@ <OutputType>Library</OutputType> <RootNamespace>VeraControl</RootNamespace> <AssemblyName>VeraControl</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkProfile>Client</TargetFrameworkProfile> <AppDesignerFolder>Properties</AppDesignerFolder> <SourceAnalysisOverrideSettingsFile>C:\Users\Bart\AppData\Roaming\ICSharpCode/SharpDevelop4\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> @@ -47,29 +47,32 @@ </PropertyGroup> <ItemGroup> <Reference Include="Common.Utils"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> </Reference> <Reference Include="Core"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Core.dll</HintPath> </Reference> <Reference Include="Dialogs"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> </Reference> <Reference Include="MediaFoundation"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\MediaFoundation.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\MediaFoundation.dll</HintPath> </Reference> + <Reference Include="PresentationCore"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> <Reference Include="RemotePlugins"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\RemotePlugins.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\RemotePlugins.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Drawing" /> - <Reference Include="System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <Reference Include="System.Runtime.Serialization"> <RequiredTargetFramework>3.0</RequiredTargetFramework> </Reference> - <Reference Include="System.Runtime.Serialization.Formatters.Soap, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <Reference Include="System.Runtime.Serialization.Formatters.Soap" /> <Reference Include="System.ServiceModel.Web"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> @@ -77,16 +80,18 @@ <Reference Include="System.Web.Extensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> + <Reference Include="System.Windows" /> <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="Utils"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Utils.dll</HintPath> </Reference> <Reference Include="WindowPlugins"> - <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\WindowPlugins.dll</HintPath> + <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\plugins\Windows\WindowPlugins.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/VeraControl/VeraControl.sln =================================================================== --- trunk/plugins/VeraControl/VeraControl.sln 2014-08-14 21:45:58 UTC (rev 4869) +++ trunk/plugins/VeraControl/VeraControl.sln 2014-08-14 21:47:03 UTC (rev 4870) @@ -1,7 +1,7 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -# SharpDevelop 4.1.0.8000 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 4.4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VeraControl", "VeraControl.csproj", "{B403D22F-BFFF-41F5-846E-E60586CFB39F}" EndProject Global This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |