From: <nic...@us...> - 2014-05-03 19:44:07
|
Revision: 4794 http://sourceforge.net/p/mp-plugins/code/4794 Author: nicsergio Date: 2014-05-03 19:44:02 +0000 (Sat, 03 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/SkinNavigatorConfig.Designer.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs 2014-05-03 17:38:29 UTC (rev 4793) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs 2014-05-03 19:44:02 UTC (rev 4794) @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; using MediaPortal.Configuration; using MediaPortal.GUI.Library; -using MediaPortal.Util; -using MediaPortal.Player; //using Action = MediaPortal.GUI.Library.Action; using My.Common; @@ -28,12 +24,12 @@ #region Implementazione IPlugin public void Start() //Avvio del plugin { - MpLog(false, "Plugin started"); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Info, "Plugin started")); if (LockKeys.ChangeCapsLock(myShortCuts.GeneralForcingCapsLock)) - MpLog(false, "CapsLock " + ((myShortCuts.GeneralForcingCapsLock == LockKeys.LockKeyActions.Off) ? "deactivated" : "activated")); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Info, "CapsLock " + ((myShortCuts.GeneralForcingCapsLock == LockKeys.LockKeyActions.Off) ? "deactivated" : "activated"))); if (LockKeys.ChangeNumLock(myShortCuts.GeneralForcingNumLock)) - MpLog(false, "NumLock " + ((myShortCuts.GeneralForcingNumLock == LockKeys.LockKeyActions.Off) ? "deactivated" : "activated")); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Info, "NumLock " + ((myShortCuts.GeneralForcingNumLock == LockKeys.LockKeyActions.Off) ? "deactivated" : "activated"))); string settingsFile = Config.GetFile(Config.Dir.Config, Tools.MyAssembly.Name + ".xml"); myShortCuts = new ShortCuts(settingsFile); //Creazione classe per gestione shorcuts @@ -45,9 +41,9 @@ RawInputHook rawInput = new RawInputHook(GUIGraphicsContext.form.Handle); //--> creazione hook mediante RawInput rawInput.KeyDown += new KeyEventHandler(rawInput_KeyDown); //--> sottoscrizione evento KeyDown } - catch + catch (Exception e) { - MpLog(true, "Error creating raw input hook"); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Error, "Error creating raw input hook", e)); } try @@ -55,36 +51,39 @@ //Sottoscrizione evento di attivazione finestra di MediaPortal GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnActivateWindow); } - catch + catch (Exception e) { - MpLog(true, "Error subscription ActivateWindow event"); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Error, "Error subscription ActivateWindow event", e)); } } else - MpLog(true, "Error loading configuration"); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Error, "Error loading configuration")); } public void Stop() //Terminazione del plugin { - MpLog(false, "Plugin stopped"); + MpLog(new LogEventArgs(LogEventArgs.LogLevels.Info, "Plugin stopped")); } #endregion - #region Metodi Pubblici - public static void MpLog(bool errorLog, string description) //Registrazione evento su log di MediaPortal (senza passare l'eccezione) + #region Metodi Privati + private void MpLog(LogEventArgs e) //Registrazione evento su log di MediaPortal { - MpLog(errorLog, description, null); - } - public static void MpLog(bool errorLog, string description, Exception e) //Registrazione evento su log di MediaPortal - { - description = LogPrefix + description; - if (errorLog) + string message = LogPrefix + e.LogMessage; + + switch (e.LogLevel) { - if (e != null) - description += " [" + e.Message + " (" + e.StackTrace + ")]"; - Log.Error(description); //--> log errore + case LogEventArgs.LogLevels.Error: + if (e.LogException != null) + message += " [" + e.LogException.Message + " (" + e.LogException.StackTrace + ")]"; + Log.Error(message); //--> log errore + break; + case LogEventArgs.LogLevels.Info: + Log.Info(message); //--> log messaggio informativo + break; + case LogEventArgs.LogLevels.Debug: + Log.Debug(message); //--> log informazione per debug + break; } - else - Log.Info(description); //--> log messaggio informativo } #endregion @@ -97,20 +96,9 @@ { myShortCuts.WindowChanged(windowID); //--> pubblicazione a gestore shortcuts } - private void myShortCuts_Log(object sender, LogEventArgs e) + private void myShortCuts_Log(object sender, LogEventArgs e) //Evento di log gestore shortcuts { - switch (e.LogLevel) - { - case LogEventArgs.LogLevels.Error: - if (e.LogException != null) - Tools.ErrorMessage(e.LogMessage, e.LogException.Message); //--> emissione finestra di errore (con descrizione errore) - else - Tools.ErrorMessage(e.LogMessage); //--> emissione finestra di errore - break; - case LogEventArgs.LogLevels.Info: - Tools.InfoMessage(e.LogMessage); //--> emissione finestra informativa - break; - } + MpLog(e); //--> log } #endregion } Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-03 17:38:29 UTC (rev 4793) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-03 19:44:02 UTC (rev 4794) @@ -1,23 +1,22 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using MediaPortal.GUI.Library; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Forms; using System.Xml; +using MediaPortal.GUI.Library; +using MediaPortal.Player; using MediaPortal.Profile; using MediaPortal.Util; -using MediaPortal.Player; -using My.Common; namespace ProcessPlugins.ShortCuter { #region Delegati/Classi - public delegate void LogEventHandler(object sender, LogEventArgs e); //Delegato per evento di log - public class LogEventArgs : EventArgs //Argomenti per evento di log + internal delegate void LogEventHandler(object sender, LogEventArgs e); //Delegato per evento di log + internal class LogEventArgs : EventArgs //Argomenti per evento di log { #region Dati private LogLevels _logLevel; //Livello di log @@ -57,15 +56,25 @@ private int _windowID; //Id finestra per visualizzazione in MediaPortal private string _loadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) - private const int TrailersPluginControlID = 11899; //Id controllo per attivazione plugin Trailers - private const int InvalidID = -1; //Id finestra invalido + private const int InvalidID = -1; //Id finestra invalido + private const int NavigatorID = -999; //Id per attivazione Skin Navigator + private const int TrailersControlID = 11899; //Id controllo per attivazione plugin Trailers #endregion #region Costruttore - public WindowLink() //Costruttore classe WindowLink + public WindowLink() : this(false) { } //Costruttore classe WindowLink (senza argomenti) + public WindowLink(bool skinNavigator) //Costruttore classe WindowLink { - _caption = "Link"; //--> inizializzazione titolo - _windowID = 0; //--> inizializzazione window ID + if (skinNavigator) //Se richiesta destinazione corrispondente a Skin Navigator + { + _caption = "Skin Navigator"; //--> titolo Skin Navigator + _windowID = NavigatorID; //--> window ID virtuale per attivazione Skin Navigator + } + else + { + _caption = "Link"; //--> inizializzazione titolo + _windowID = 0; //--> inizializzazione window ID + } _loadParameter = ""; //--> inizializzazione parametri di caricamento per visualizzazione } #endregion @@ -112,8 +121,8 @@ else //Richiamo schermata senza parametri di caricamento { GUIMessage msg; - if (_windowID == TrailersPluginControlID) //Se richiesta di attivazione plugin Trailers - msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, 0, TrailersPluginControlID, TrailersPluginControlID, 0, 0, null); + if (_windowID == TrailersControlID) //Se richiesta di attivazione plugin Trailers + msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, 0, TrailersControlID, TrailersControlID, 0, 0, null); else //Caso normale di attivazione finesta MediaPortal msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, _windowID, 0, null); @@ -159,13 +168,8 @@ #endregion #region Proprietà - public bool IsValid - { - get - { - return (this._windowID >= 0); //L'ID della finestra di MediaPortal deve essere valido - } - } + public bool IsValid { get { return (this._windowID > InvalidID) ; } } + public bool IsNavigator { get { return (this._windowID == NavigatorID); } } public string Caption { get { return this._caption; } set { this._caption = value; } } public int WindowID { get { return this._windowID; } set { this._windowID = value; } } public string LoadParameter { get { return this._loadParameter; } set { this._loadParameter = value; } } Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/SkinNavigatorConfig.Designer.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/SkinNavigatorConfig.Designer.cs 2014-05-03 17:38:29 UTC (rev 4793) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/SkinNavigatorConfig.Designer.cs 2014-05-03 19:44:02 UTC (rev 4794) @@ -52,7 +52,7 @@ this.MaximizeBox = false; this.Name = "SkinNavigatorConfig"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "SkinNavigatorConfig"; + this.Text = "Skin Navigator Configuration"; this.ResumeLayout(false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |