From: <mp...@us...> - 2007-03-30 10:01:11
|
Revision: 262 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=262&view=rev Author: mpod_sf Date: 2007-03-30 03:01:07 -0700 (Fri, 30 Mar 2007) Log Message: ----------- Initial check-in of the My Refresh Plugin (works with MP SVN Build 13639 and higher) Added Paths: ----------- trunk/plugins/My Refresh/ trunk/plugins/My Refresh/MyRefresh.cs trunk/plugins/My Refresh/MyRefresh.csproj Added: trunk/plugins/My Refresh/MyRefresh.cs =================================================================== --- trunk/plugins/My Refresh/MyRefresh.cs (rev 0) +++ trunk/plugins/My Refresh/MyRefresh.cs 2007-03-30 10:01:07 UTC (rev 262) @@ -0,0 +1,144 @@ +namespace MediaPortal.Plugins +{ + using MediaPortal.GUI.Library; + using MediaPortal.Configuration; + using System; + using System.IO; + using System.Windows.Forms; + + public class MyRefresh : IPluginReceiver, IPlugin, ISetupForm + { + private string _language = string.Empty; + private string _refreshHotkeys = "Rr"; + + public string Author() + { + return "Smirnoff"; + } + + public bool CanEnable() + { + return true; + } + + public bool DefaultEnabled() + { + return true; + } + + public string Description() + { + return "Plugin to allow skinners to view skin changes without the need to restart, Press F5"; + } + + public bool GetHome(out string buttonText, out string buttonImage, out string buttonImageFocused, out string hoverImage) + { + string text; + hoverImage = text = ""; + buttonImageFocused = text; + buttonText = buttonImage = text; + return false; + } + + public int GetWindowId() + { + return 0; + } + + public bool HasSetup() + { + return false; + } + + private void OnAction(Action action) + { + if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf((char)action.m_key.KeyChar, 0) != -1)) + { + this.Refresh(false); + } + if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf('a', 0) != -1)) + { + this.Refresh(true); + } + } + + public string PluginName() + { + return "My Refresh"; + } + + private void Refresh(bool refreshEverything) + { + if (refreshEverything && File.Exists(GUIGraphicsContext.SkinCacheFolder + @"\packedgfx2.bxml")) + { + File.Delete(GUIGraphicsContext.SkinCacheFolder + @"\packedgfx2.bxml"); + } + if (refreshEverything) + { + GUITextureManager.Clear(); + GUITextureManager.Init(); + } + if (refreshEverything) + { + //GUILocalizeStrings.Clear(); + GUILocalizeStrings.Load(@"language\" + this._language + @"\strings.xml"); + } + if (refreshEverything) + { + GUIFontManager.LoadFonts(@"skin\" + GUIGraphicsContext.Skin + @"\fonts.xml"); + GUIFontManager.InitializeDeviceObjects(); + } + GUIControlFactory.ClearReferences(); + GUIControlFactory.LoadReferences(GUIGraphicsContext.Skin + @"\references.xml"); + GUIWindowManager.OnResize(); + GUIWindow window = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow); + if (GUIWindowManager.IsRouted) + { + window = GUIWindowManager.GetWindow(GUIWindowManager.RoutedWindow); + } + if (window != null) + { + window.Restore(); + GUIWindowManager.ActivateWindow(window.GetID); + } + } + + public void ShowPlugin() + { + } + + public void Start() + { + Log.Info("MyRefresh: Plugin started", new object[0]); + using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + this._language = settings.GetValueAsString("skin", "language", string.Empty); + } + if (this._language == string.Empty) + { + this._language = "English"; + } + GUIWindowManager.OnNewAction += new OnActionHandler(this.OnAction); + } + + public void Stop() + { + GUIWindowManager.OnNewAction -= new OnActionHandler(this.OnAction); + } + + public bool WndProc(ref Message msg) + { + if (msg.Msg != 0x101) + { + return false; + } + if (msg.WParam != ((IntPtr)0x74)) + { + return false; + } + this.Refresh((Control.ModifierKeys & Keys.Control) != Keys.None); + return true; + } + } +} + Added: trunk/plugins/My Refresh/MyRefresh.csproj =================================================================== --- trunk/plugins/My Refresh/MyRefresh.csproj (rev 0) +++ trunk/plugins/My Refresh/MyRefresh.csproj 2007-03-30 10:01:07 UTC (rev 262) @@ -0,0 +1,122 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectType>Local</ProjectType> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{0F2811BE-6B64-42B6-B374-B4ED04648825}</ProjectGuid> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ApplicationIcon> + </ApplicationIcon> + <AssemblyKeyContainerName> + </AssemblyKeyContainerName> + <AssemblyName>MyRefresh</AssemblyName> + <AssemblyOriginatorKeyFile> + </AssemblyOriginatorKeyFile> + <DefaultClientScript>JScript</DefaultClientScript> + <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> + <DefaultTargetSchema>IE50</DefaultTargetSchema> + <DelaySign>false</DelaySign> + <OutputType>Library</OutputType> + <RootNamespace>MyRefresh</RootNamespace> + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> + <StartupObject> + </StartupObject> + <FileUpgradeFlags> + </FileUpgradeFlags> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <OutputPath>bin\Debug\</OutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile> + </ConfigurationOverrideFile> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DocumentationFile> + </DocumentationFile> + <DebugSymbols>true</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn> + </NoWarn> + <Optimize>false</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>full</DebugType> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <OutputPath>bin\Release\</OutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile> + </ConfigurationOverrideFile> + <DefineConstants>TRACE</DefineConstants> + <DocumentationFile> + </DocumentationFile> + <DebugSymbols>false</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn> + </NoWarn> + <Optimize>true</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>none</DebugType> + <ErrorReport>prompt</ErrorReport> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <DebugType> + </DebugType> + <PlatformTarget>x86</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + <ItemGroup> + <Compile Include="MyRefresh.cs"> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Documents\Coding\Mediaportal Check\Core\Core.csproj"> + <Project>{02FFFC1F-2555-4B99-8B01-3432D0673855}</Project> + <Name>Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Documents\Coding\Mediaportal Check\Utils\Utils.csproj"> + <Project>{6DA0E4DF-6230-4642-98B5-E690BB6942BB}</Project> + <Name>Utils</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent> + </PreBuildEvent> + <PostBuildEvent> + </PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |