From: <nic...@us...> - 2014-05-08 15:04:19
|
Revision: 4799 http://sourceforge.net/p/mp-plugins/code/4799 Author: nicsergio Date: 2014-05-08 15:04:15 +0000 (Thu, 08 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-07 19:58:53 UTC (rev 4798) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-08 15:04:15 UTC (rev 4799) @@ -21,7 +21,7 @@ { #region Dati private LogLevels _logLevel; //Livello di log - private string _logMessage; //Messaggio di log + private string _logMessage; //Messaggio di log private Exception _logException; //Eventuale eccezione public enum LogLevels //Tipologie di livelli di log @@ -43,8 +43,8 @@ #endregion #region Proprietà - public LogLevels LogLevel { get { return this._logLevel; } } - public string LogMessage { get { return this._logMessage; } } + public LogLevels LogLevel { get { return this._logLevel; } } + public string LogMessage { get { return this._logMessage; } } public Exception LogException { get { return this._logException; } } #endregion } @@ -68,13 +68,13 @@ { if (skinNavigator) //Se richiesta destinazione corrispondente a Skin Navigator { - _caption = "Skin Navigator"; //--> titolo Skin Navigator - _windowID = NavigatorID; //--> Id finestra virtuale per attivazione Skin Navigator + _caption = "Skin Navigator"; //--> titolo Skin Navigator + _windowID = NavigatorID; //--> Id finestra virtuale per attivazione Skin Navigator } else { - _caption = "Link"; //--> inizializzazione titolo - _windowID = 0; //--> inizializzazione Id finestra + _caption = "Link"; //--> inizializzazione titolo + _windowID = 0; //--> inizializzazione Id finestra } _loadParameter = ""; //--> inizializzazione parametri di caricamento per visualizzazione } @@ -86,7 +86,7 @@ { if (_caption.Length > 0 && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Go to link destination, " + this.ToString())); - + try { GUIGraphicsContext.ResetLastActivity(); @@ -112,7 +112,7 @@ break; } else - break; + break; } if (loadParameterChange && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Debug, "GUIProperties replaced, LoadParameter=[" + loadParameter + "]")); @@ -133,7 +133,7 @@ } catch (Exception e) { - if (Log != null) + if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error going to window", e)); return false; //--> comando non completato } @@ -160,8 +160,8 @@ public WindowLink Clone() //Clonazione collegamento { WindowLink lnk = new WindowLink(); - lnk.Caption = _caption; - lnk.WindowID = _windowID; + lnk.Caption = _caption; + lnk.WindowID = _windowID; lnk.LoadParameter = _loadParameter; return lnk; } @@ -177,20 +177,20 @@ #endregion #region Proprietà - public bool IsValid { get { return (this._windowID > InvalidID || this.IsNavigator) ; } } - 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; } } - #endregion + public bool IsValid { get { return (this._windowID > InvalidID || this.IsNavigator); } } + 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; } } + #endregion } internal class KeyCombination //Classe combinazione di tasti { #region Dati private string _key; //Tasto (stringa corrispondente a KeyCode) - private bool _ctrl; //Utilizzo del modificatore "Ctrl" - combinazione di tasti - private bool _alt; //Utilizzo del modificatore "Alt" - combinazione di tasti - private bool _shift; //Utilizzo del modificatore "Shift" - combinazione di tasti + private bool _ctrl; //Utilizzo del modificatore "Ctrl" - combinazione di tasti + private bool _alt; //Utilizzo del modificatore "Alt" - combinazione di tasti + private bool _shift; //Utilizzo del modificatore "Shift" - combinazione di tasti private static readonly List<Keys> ModifierKeys = new List<Keys>(); //Lista dei tasti modificatori #endregion @@ -210,20 +210,20 @@ } public KeyCombination() //Costruttore classe KeyCombination { - _key = "A"; //--> inizializzazione tasto - _ctrl = true; //--> inizializzazione utilizzo del modificatore "Ctrl" - _alt = false; //--> inizializzazione utilizzo del modificatore "Alt" + _key = "A"; //--> inizializzazione tasto + _ctrl = true; //--> inizializzazione utilizzo del modificatore "Ctrl" + _alt = false; //--> inizializzazione utilizzo del modificatore "Alt" _shift = true; //--> inizializzazione utilizzo del modificatore "Shift" } public KeyCombination(KeyEventArgs k) //Costruttore classe KeyCombination da evento di pressione tasto { - _key = k.KeyCode.ToString(); //--> assegnazione tasto - _ctrl = k.Control; //--> utilizzo del modificatore "Ctrl" - _alt = k.Alt; //--> utilizzo del modificatore "Alt" + _key = k.KeyCode.ToString(); //--> assegnazione tasto + _ctrl = k.Control; //--> utilizzo del modificatore "Ctrl" + _alt = k.Alt; //--> utilizzo del modificatore "Alt" _shift = k.Shift; //--> utilizzo del modificatore "Shift" } #endregion - + #region Metodi Pubblici public static bool IsModifier(Keys key) //Verifica se un tasto corrisponde ad un modificatore { @@ -237,7 +237,7 @@ #region Proprietà public bool IsValid - { + { get { KeysConverter kc = new KeysConverter(); @@ -247,32 +247,32 @@ return (key != Keys.None && !ModifierKeys.Contains(key)); //--> verifica se la stringa corrisponde ad un tasto e che il tasto non sia un modificatore } } - public string Key { get { return this._key; } set { this._key = value; } } - public bool Ctrl { get { return this._ctrl; } set { this._ctrl = value; } } - public bool Alt { get { return this._alt; } set { this._alt = value; } } + public string Key { get { return this._key; } set { this._key = value; } } + public bool Ctrl { get { return this._ctrl; } set { this._ctrl = value; } } + public bool Alt { get { return this._alt; } set { this._alt = value; } } public bool Shift { get { return this._shift; } set { this._shift = value; } } - #endregion + #endregion } internal class ShortCut : INotifyPropertyChanged //Classe shortcut (scorciatoia da tastiera) con notifica variazione proprietà per binding su GridView { #region Dati - private string _caption; //Titolo link + private string _caption; //Titolo link private KeyCombination _keys; //Combinazione di tasti per attivazione shortcut - private WindowLink _destination; //Destinazione dello shortcut - private bool _return; //Ritorno a finestra precedente se si è già a destinazione - private string _soundEffect; //File relativo all'eventuale effetto sonoro + private WindowLink _destination; //Destinazione dello shortcut + private bool _return; //Ritorno a finestra precedente se si è già a destinazione + private string _soundEffect; //File relativo all'eventuale effetto sonoro #endregion #region Costruttore public ShortCut() : this(false) { } //Costruttore classe ShortCut (senza argomenti) public ShortCut(bool skinNavigator) //Costruttore classe ShortCut { - _caption = (skinNavigator ? "Skin Navigator" : "ShortCut"); //--> inizializzazione titolo - _keys = new KeyCombination(); //--> istanziazione classe KeyCombination - _destination = new WindowLink(skinNavigator); //--> istanziazione classe WindowLink + _caption = (skinNavigator ? "Skin Navigator" : "ShortCut"); //--> inizializzazione titolo + _keys = new KeyCombination(); //--> istanziazione classe KeyCombination + _destination = new WindowLink(skinNavigator); //--> istanziazione classe WindowLink _destination.Caption = ""; //--> reset caption destinazione (gestita caption shortcut) - _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione - _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro + _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione + _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro } #endregion @@ -290,13 +290,13 @@ { if (_caption.Length > 0 && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Go to shortcut destination, " + this.ToString())); - + try { if (_soundEffect.Length > 0 && !g_Player.Playing) Utils.PlaySound(_soundEffect, false, true); //--> eventuale effetto sonoro } - catch { } + catch { } return _destination.Go(Log); //--> visualizzazione finestra di destinazione } @@ -311,22 +311,22 @@ if (_soundEffect.Length > 0 && !g_Player.Playing) Utils.PlaySound("back.wav", false, true); //--> eventuale effetto sonoro } - catch { } + catch { } return _destination.GoPrevious(Log); //--> visualizzazione finestra precedente } public ShortCut Clone() //Clonazione shortcut { ShortCut sc = new ShortCut(); - sc.Caption = _caption; - sc.Key = _keys.Key; - sc.Ctrl = _keys.Ctrl; - sc.Alt = _keys.Alt; - sc.Shift = _keys.Shift; - sc.WindowID = _destination.WindowID; + sc.Caption = _caption; + sc.Key = _keys.Key; + sc.Ctrl = _keys.Ctrl; + sc.Alt = _keys.Alt; + sc.Shift = _keys.Shift; + sc.WindowID = _destination.WindowID; sc.LoadParameter = _destination.LoadParameter; - sc.Return = _return; - sc.SoundEffect = _soundEffect; + sc.Return = _return; + sc.SoundEffect = _soundEffect; return sc; } public override string ToString() //Override metodo ToString per stampare le proprietà dello shortcut @@ -340,17 +340,17 @@ #endregion #region Proprietà - public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } - public bool IsNavigator { get { return this._destination.IsNavigator; } } - public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } - public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } - public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } - public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } - public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } - public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } + public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } + public bool IsNavigator { get { return this._destination.IsNavigator; } } + public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } + public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } + public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } + public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } + public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } + public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } public string LoadParameter { get { return this._destination.LoadParameter; } set { this._destination.LoadParameter = value; this.NotifyPropertyChanged("LoadParameter"); } } - public bool Return { get { return this._return; } set { this._return = value; this.NotifyPropertyChanged("Return"); } } - public string SoundEffect { get { return this._soundEffect; } set { this._soundEffect = value; this.NotifyPropertyChanged("SoundEffect"); } } + public bool Return { get { return this._return; } set { this._return = value; this.NotifyPropertyChanged("Return"); } } + public string SoundEffect { get { return this._soundEffect; } set { this._soundEffect = value; this.NotifyPropertyChanged("SoundEffect"); } } #endregion } @@ -358,41 +358,41 @@ { #region Dati private string _caption; //Titolo finestra - private int _windowID; //Id finestra + private int _windowID; //Id finestra private string _xmlFile; //Nome del file xml corrispondente #endregion #region Costruttore public Window() //Costruttore classe Window { - _caption = ""; //--> inizializzazione titolo + _caption = ""; //--> inizializzazione titolo _windowID = 0; //--> inizializzazione Id finestra - _xmlFile = ""; //--> inizializzazione nome file xml + _xmlFile = ""; //--> inizializzazione nome file xml } #endregion #region Metodi Pubblici public override string ToString() { return (_caption); } //Override metodo ToString per riempire classi ListControl #endregion - + #region Proprietà - public string Caption { get { return this._caption; } set { this._caption = value; } } - public int WindowID { get { return this._windowID; } set { this._windowID = value; } } - public string XmlFile { get { return this._xmlFile; } set { this._xmlFile = value; } } - #endregion + public string Caption { get { return this._caption; } set { this._caption = value; } } + public int WindowID { get { return this._windowID; } set { this._windowID = value; } } + public string XmlFile { get { return this._xmlFile; } set { this._xmlFile = value; } } + #endregion } internal class NavItem //Classe elemento per navigazione { #region Dati - private string _caption; //Titolo link - private BindingList<Window> _windows = new BindingList<Window>(); + private string _caption; //Titolo link + private BindingList<Window> _windows = new BindingList<Window>(); private BindingList<WindowLink> _destinations = new BindingList<WindowLink>(); #endregion #region Costruttore public NavItem() //Costruttore classe Window { - _caption = "Navigator Group"; //--> inizializzazione titolo + _caption = "Navigator Group"; //--> inizializzazione titolo } #endregion @@ -414,52 +414,52 @@ #endregion #region Dati - private readonly string SettingsFile; //File di salvataggio impostazioni - private GeneralSettings _general = new GeneralSettings(); //Impostazioni generali plugin - private BindingList<ShortCut> _items = new BindingList<ShortCut>(); //Lista (con associazione dati) degli shortcuts configurati - private BindingList<NavItem> _navItems = new BindingList<NavItem>(); - private bool _initialized; //Classe inizializzata + private readonly string SettingsFile; //File di salvataggio impostazioni + private GeneralSettings _general = new GeneralSettings(); //Impostazioni generali plugin + private BindingList<ShortCut> _items = new BindingList<ShortCut>(); //Lista (con associazione dati) degli shortcuts configurati + private BindingList<NavItem> _navItems = new BindingList<NavItem>(); + private bool _initialized; //Classe inizializzata - private WindowLink lastDestination = new WindowLink(); //Dati ultima destinazione attivata dal plugin + private WindowLink lastDestination = new WindowLink(); //Dati ultima destinazione attivata dal plugin #endregion #region Costruttore public ShortCuts(string settingsFile) //Costruttore classe ShortCuts { - SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni + SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni _general.ForcingCapsLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Caps-Lock - _general.ForcingNumLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Num-Lock - _initialized = false; //--> reset classe inizializzata - lastDestination.Caption = "Last destination"; //--> titolo ultima destinazione + _general.ForcingNumLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Num-Lock + _initialized = false; //--> reset classe inizializzata + lastDestination.Caption = "Last destination"; //--> titolo ultima destinazione lastDestination.Reset(); //--> reset ultima destinazione attivata dal plugin } #endregion - + #region Metodi Privati private bool LoadDeprecatedConfig() //Caricamento configurazione obsoleta { using (Settings confReader = new Settings(SettingsFile)) { const string sectionName = "ShortCuterForm"; - const string capPrefix = "Titel"; - const string keyPrefix = "Key"; - const string widPrefix = "ID"; + const string capPrefix = "Titel"; + const string keyPrefix = "Key"; + const string widPrefix = "ID"; if (!confReader.HasSection<string>(sectionName)) return false; //--> se sezione non presente: il file non corrisponde - bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut + bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut { ShortCut sc = new ShortCut(); - sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); - sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); - sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); - sc.Ctrl = ctrl; - sc.Alt = false; - sc.Shift = shift; + sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); + sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); + sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); + sc.Ctrl = ctrl; + sc.Alt = false; + sc.Shift = shift; if (sc.IsValid) //Se shortcut valido _items.Add(sc); //--> aggiunta dello shortcut nella lista } @@ -468,7 +468,7 @@ } private List<ShortCut> GetShortCutsGroup(KeyCombination k) //Raccolta lista shortcut associati alla combinazione di tasti { - return _items.ToList().FindAll(x => x.Key == k.Key && x.Ctrl == k.Ctrl && x.Alt == k.Alt && x.Shift == k.Shift); + return _items.ToList().FindAll(x => x.Key == k.Key && x.Ctrl == k.Ctrl && x.Alt == k.Alt && x.Shift == k.Shift); } private bool AlreadyAtDestination(ShortCut sc) //Verifica se finestra attuale corrispondente a destinazione shortcut { @@ -498,7 +498,7 @@ else return false; //--> finestra attuale non corrispondente a destinazione shortcut } - private bool Navigation() + private void Navigation() //Gestione finestra di dialogo e navigazione alla destinazione selezionata { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); @@ -535,34 +535,31 @@ { dlgMenu.DoModal(actWindowID); if (dlgMenu.SelectedLabel >= 0 && dlgMenu.SelectedLabel < dlgLinks.Count) - return dlgLinks[dlgMenu.SelectedLabel].Go(Log); - else - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); - return false; - } + if (dlgLinks[dlgMenu.SelectedLabel].Go(Log)) + { + lastDestination.WindowID = dlgLinks[dlgMenu.SelectedLabel].WindowID; + lastDestination.LoadParameter = dlgLinks[dlgMenu.SelectedLabel].LoadParameter; + } + else + if (Log != null) + Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); } else - { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links found for Skin Navigator, window ID = " + actWindowID)); - return false; - } } catch (Exception e) { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error opening Skin Navigator dialog menu", e)); - return false; } } #endregion #region Metodi Pubblici public bool Initialize() //Inizializzazione - { - _initialized = LoadConfig(false); //--> caricamento configurazione (standard) shortcuts + { + _initialized = LoadConfig(false); //--> caricamento configurazione (standard) shortcuts if (!_initialized) { if (Log != null) @@ -576,7 +573,7 @@ } } return _initialized; - } + } public bool LoadConfig(bool defaultSettings) //Caricamento configurazione { _items.Clear(); //--> pulizia lista shortcuts @@ -617,7 +614,7 @@ innerNode = generalNode.SelectSingleNode("ResetNumLock"); //Necessario per compatibilità con file di configurazione V2.0.5.0 if (innerNode != null && Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText))) _general.ForcingNumLock = LockKeys.LockKeyActions.Off; - } + } } XmlNodeList nodeList = xmlFile.DocumentElement.SelectNodes("/ShortCuter/Items/Item"); foreach (XmlNode node in nodeList) //Iterazione per memorizzazione impostazioni shortcuts @@ -702,27 +699,27 @@ xmlSettings.WriteStartDocument(); xmlSettings.WriteStartElement("ShortCuter"); - xmlSettings.WriteStartElement("General"); - xmlSettings.WriteElementString("ForcingCapsLock", _general.ForcingCapsLock.ToString()); - xmlSettings.WriteElementString("ForcingNumLock", _general.ForcingNumLock.ToString()); + xmlSettings.WriteStartElement("General"); + xmlSettings.WriteElementString("ForcingCapsLock", _general.ForcingCapsLock.ToString()); + xmlSettings.WriteElementString("ForcingNumLock", _general.ForcingNumLock.ToString()); + xmlSettings.WriteEndElement(); + xmlSettings.WriteStartElement("Items"); + foreach (ShortCut sc in _items) //Iterazione per salvataggio sortcuts + { + xmlSettings.WriteStartElement("Item"); + xmlSettings.WriteElementString("Caption", sc.Caption); + xmlSettings.WriteElementString("Key", sc.Key); + xmlSettings.WriteElementString("Ctrl", Convert.ToInt16(sc.Ctrl).ToString()); + xmlSettings.WriteElementString("Alt", Convert.ToInt16(sc.Alt).ToString()); + xmlSettings.WriteElementString("Shift", Convert.ToInt16(sc.Shift).ToString()); + xmlSettings.WriteElementString("WindowID", sc.WindowID.ToString()); + xmlSettings.WriteElementString("LoadParameter", sc.LoadParameter); + xmlSettings.WriteElementString("Return", Convert.ToInt16(sc.Return).ToString()); + xmlSettings.WriteElementString("SoundEffect", sc.SoundEffect); xmlSettings.WriteEndElement(); - xmlSettings.WriteStartElement("Items"); - foreach (ShortCut sc in _items) //Iterazione per salvataggio sortcuts - { - xmlSettings.WriteStartElement("Item"); - xmlSettings.WriteElementString("Caption", sc.Caption); - xmlSettings.WriteElementString("Key", sc.Key); - xmlSettings.WriteElementString("Ctrl", Convert.ToInt16(sc.Ctrl).ToString()); - xmlSettings.WriteElementString("Alt", Convert.ToInt16(sc.Alt).ToString()); - xmlSettings.WriteElementString("Shift", Convert.ToInt16(sc.Shift).ToString()); - xmlSettings.WriteElementString("WindowID", sc.WindowID.ToString()); - xmlSettings.WriteElementString("LoadParameter", sc.LoadParameter); - xmlSettings.WriteElementString("Return", Convert.ToInt16(sc.Return).ToString()); - xmlSettings.WriteElementString("SoundEffect", sc.SoundEffect); - xmlSettings.WriteEndElement(); - } - xmlSettings.WriteEndElement(); + } xmlSettings.WriteEndElement(); + xmlSettings.WriteEndElement(); xmlSettings.Flush(); xmlSettings.Close(); @@ -735,7 +732,7 @@ } finally { - if (xmlSettings != null) + if (xmlSettings != null) xmlSettings.Close(); //--> eventuale chiusura oggetto XmlWriter } if (Log != null) @@ -751,63 +748,9 @@ if (scList != null && scList.Count > 0) //Se trovato almeno uno shortcut { if (scList.Find(x => x.IsNavigator) != null) //Se combinazione di tasti corrispondente a Skin Navigator - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); - - try - { - int actWindowID = (int)GUIWindowManager.ActiveWindow; - GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - dlgMenu.Reset(); - dlgMenu.SetHeading("Skin Navigator"); - dlgMenu.ShowQuickNumbers = false; - - List<WindowLink> dlgLinks = new List<WindowLink>(); - foreach (NavItem item in _navItems) //Iterazione per memorizzazione impostazioni shortcuts - { - if ((item.Windows.First(x => x.WindowID == actWindowID)) != null || item.Windows.Count == 0) - { - bool first = true; - foreach (WindowLink link in item.Destinations) //Iterazione per memorizzazione impostazioni shortcuts - { - if (first && dlgLinks.Count > 0) - { - dlgMenu.Add("---- ----"); - dlgLinks.Add(null); - first = false; - } - dlgMenu.Add(link.Caption); - dlgLinks.Add(link); - } - } - } - - if (dlgLinks.Count > 0) - { - dlgMenu.DoModal(actWindowID); - if (dlgMenu.SelectedLabel >= 0 && dlgMenu.SelectedLabel < dlgLinks.Count) - dlgLinks[dlgMenu.SelectedLabel].Go(Log); - else - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); - } - else - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links found for Skin Navigator, window ID = " + actWindowID)); - } - catch (Exception e) - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error opening Skin Navigator dialog menu", e)); - } - - - } + Navigation(); //--> gestione navigazione alla destinazione selezionata else //Shortcuts normali - { if (scList.Count == 1) //Shortcut a destinazione singola - { if (scList[0].Return && AlreadyAtDestination(scList[0])) //Se impostato flag di ritorno e finestra attuale corrispondente a destinazione scList[0].GoPrevious(Log); //--> visualizzazione finestra precedente else @@ -816,7 +759,6 @@ lastDestination.WindowID = scList[0].WindowID; //--> memorizzazione id finestra lastDestination.LoadParameter = scList[0].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati } - } else //Shortcut a destinazione multipla (ciclico) { int scIndex = 0; @@ -834,7 +776,6 @@ lastDestination.LoadParameter = scList[scIndex].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati } } - } } else //Combinazione di tasti non corrispondente a nessuno shortcut if (Log != null) @@ -853,10 +794,10 @@ #endregion #region Proprietà - public bool Initialized { get { return this._initialized; } } - public LockKeys.LockKeyActions GeneralForcingCapsLock { get { return this._general.ForcingCapsLock; } set { this._general.ForcingCapsLock = value; } } - public LockKeys.LockKeyActions GeneralForcingNumLock { get { return this._general.ForcingNumLock; } set { this._general.ForcingNumLock = value; } } - public BindingList<ShortCut> Items { get { return this._items; } } + public bool Initialized { get { return this._initialized; } } + public LockKeys.LockKeyActions GeneralForcingCapsLock { get { return this._general.ForcingCapsLock; } set { this._general.ForcingCapsLock = value; } } + public LockKeys.LockKeyActions GeneralForcingNumLock { get { return this._general.ForcingNumLock; } set { this._general.ForcingNumLock = value; } } + public BindingList<ShortCut> Items { get { return this._items; } } #endregion - } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |