From: <ze...@us...> - 2007-06-08 17:15:00
|
Revision: 493 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=493&view=rev Author: zebons Date: 2007-06-08 10:14:57 -0700 (Fri, 08 Jun 2007) Log Message: ----------- Add a setup to configure Key Skin reload Modified Paths: -------------- trunk/plugins/My Refresh/MyRefresh.cs Added Paths: ----------- trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs trunk/plugins/My Refresh/MyRefreshSetup.cs trunk/plugins/My Refresh/MyRefreshSetup.resx Modified: trunk/plugins/My Refresh/MyRefresh.cs =================================================================== --- trunk/plugins/My Refresh/MyRefresh.cs 2007-06-08 13:33:09 UTC (rev 492) +++ trunk/plugins/My Refresh/MyRefresh.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -1,20 +1,26 @@ +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; +using System; +using System.IO; +using System.Windows.Forms; + 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"; + private string _refreshHotkeys; public string Author() { return "Smirnoff"; } + public void ShowPlugin() + { + System.Windows.Forms.Form setup = new MyRefreshSetup(); + setup.ShowDialog(); + } public bool CanEnable() { @@ -33,7 +39,7 @@ public bool GetHome(out string buttonText, out string buttonImage, out string buttonImageFocused, out string hoverImage) { - string text; + string text; hoverImage = text = ""; buttonImageFocused = text; buttonText = buttonImage = text; @@ -47,12 +53,12 @@ public bool HasSetup() { - return false; + return true; } private void OnAction(Action action) { - if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf((char)action.m_key.KeyChar, 0) != -1)) + if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf((char)action.m_key.KeyChar, 0) != -1)) { this.Refresh(false); } @@ -103,17 +109,15 @@ } } - 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); + _refreshHotkeys = settings.GetValueAsString("MyRefresh", "HotKeys", "Ee%"); } + Log.Info("MyRefresh: _refreshHotkeys", _refreshHotkeys); if (this._language == string.Empty) { this._language = "English"; Added: trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -0,0 +1,72 @@ +namespace MediaPortal.Plugins +{ + partial class MyRefreshSetup + { + /// <summary> + /// Variable nécessaire au concepteur. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Nettoyage des ressources utilisées. + /// </summary> + /// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Code généré par le Concepteur Windows Form + + /// <summary> + /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas + /// le contenu de cette méthode avec l'éditeur de code. + /// </summary> + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.KeyList = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(29, 44); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(99, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Keys for skin reload"; + // + // KeyList + // + this.KeyList.Location = new System.Drawing.Point(148, 41); + this.KeyList.Name = "KeyList"; + this.KeyList.Size = new System.Drawing.Size(68, 20); + this.KeyList.TabIndex = 2; + // + // MyRefreshSetup + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(363, 130); + this.Controls.Add(this.KeyList); + this.Controls.Add(this.label1); + this.Name = "MyRefreshSetup"; + this.Text = "MyRefreshSetup"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MyRefreshSetup_FormClosing); + this.Load += new System.EventHandler(this.MyRefreshSetup_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox KeyList; + } +} \ No newline at end of file Added: trunk/plugins/My Refresh/MyRefreshSetup.cs =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.cs (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using MediaPortal.Util; +using MediaPortal.Configuration; + +namespace MediaPortal.Plugins +{ + public partial class MyRefreshSetup : Form + { + public MyRefreshSetup() + { + InitializeComponent(); + } + + private void MyRefreshSetup_Load(object sender, EventArgs e) + { + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + KeyList.Text = xmlreader.GetValueAsString("MyRefresh", "HotKeys", "Ee%"); + } + } + private void MyRefreshSetup_FormClosing(object sender, FormClosingEventArgs e) + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("MyRefresh", "HotKeys", KeyList.Text); + } + + } + } +} \ No newline at end of file Added: trunk/plugins/My Refresh/MyRefreshSetup.resx =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.resx (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.resx 2007-06-08 17:14:57 UTC (rev 493) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |