From: <nic...@us...> - 2013-10-22 17:51:39
|
Revision: 4665 http://sourceforge.net/p/mp-plugins/code/4665 Author: nicsergio Date: 2013-10-22 17:51:35 +0000 (Tue, 22 Oct 2013) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.resx Added Paths: ----------- trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png Added: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png =================================================================== (Binary files differ) Index: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png 2013-10-22 17:51:35 UTC (rev 4665) Property changes on: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowAdd.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png =================================================================== (Binary files differ) Index: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png 2013-10-22 17:51:35 UTC (rev 4665) Property changes on: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowDown.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png =================================================================== (Binary files differ) Index: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png 2013-10-22 17:51:35 UTC (rev 4665) Property changes on: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowRemove.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png =================================================================== (Binary files differ) Index: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png 2013-10-22 17:51:35 UTC (rev 4665) Property changes on: trunk/plugins/ShortCuter&SkinEditor/Release/ShortCuter/Screenshots/RowUp.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Modified: trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs 2013-10-22 17:51:35 UTC (rev 4665) @@ -227,7 +227,7 @@ i++; //La chiave (Name) dei nodi corrisponde all'indice della lista _skinLinks } } - public int GetSkinLinkIndex(TreeView treeView) //Ottenimento indice link per la skin selezionato nel treeview + public int GetSkinLinkIndex(TreeView treeView) //Ottenimento indice link per la skin corrispondente a nodo selezionato nel treeview { if (treeView.SelectedNode != null) return Convert.ToInt32(treeView.SelectedNode.Name); //<-- indice nodo selezionato (chiave) @@ -235,6 +235,17 @@ return -1; //<-- nessun nodo selezionato } + public void SetSkinLinkIndex(TreeView treeView, int linkIndex) //Selezione nodo treeview corrispondente ad indice link per la skin + { + try + { + treeView.SelectedNode = ((linkIndex >= 0) ? treeView.Nodes.Find(linkIndex.ToString(), true)[0] : null); + } + catch + { + treeView.SelectedNode = null; //--> in caso di errore: nessun nodo selezionato + } + } #endregion #region Proprietà Modified: trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs 2013-10-22 17:51:35 UTC (rev 4665) @@ -5,6 +5,11 @@ { internal static class Tools //Collezione utilità { + #region Dati statici + //Intestazione messaggi (nome assembly) + private static readonly string MessageHeader = Assembly.GetExecutingAssembly().GetName().Name.ToString(); + #endregion + #region Metodi pubblici statici public static void ErrorMessage(string description) //Emissione messaggio di errore (senza errore specifico) { @@ -14,12 +19,17 @@ { if (error.Length > 0) description += "\n\n[" + error + "]"; - MessageBox.Show(description, Assembly.GetExecutingAssembly().GetName().Name.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + MessageBox.Show(description, MessageHeader, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } public static void InfoMessage(string description) //Emissione messaggio informativo { - MessageBox.Show(description, Assembly.GetExecutingAssembly().GetName().Name.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); + MessageBox.Show(description, MessageHeader, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } + public static bool QuestionMessage(string question) //Emissione messaggio di conferma + { + DialogResult ret = MessageBox.Show(question, MessageHeader, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); + return (ret == DialogResult.OK); + } #endregion } } Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs 2013-10-22 17:51:35 UTC (rev 4665) @@ -53,6 +53,7 @@ this.rowRemoveButton = new System.Windows.Forms.Button(); this.rowAddButton = new System.Windows.Forms.Button(); this.propLeftPictureBox = new System.Windows.Forms.PictureBox(); + this.saveButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.shortCutsDataGridView)).BeginInit(); this.itemsTabControl.SuspendLayout(); this.linksTabPage.SuspendLayout(); @@ -237,19 +238,19 @@ // // updateButton // - this.updateButton.Location = new System.Drawing.Point(561, 221); + this.updateButton.Location = new System.Drawing.Point(513, 221); this.updateButton.Name = "updateButton"; - this.updateButton.Size = new System.Drawing.Size(211, 23); + this.updateButton.Size = new System.Drawing.Size(259, 23); this.updateButton.TabIndex = 32; - this.updateButton.Text = "Update and Close"; + this.updateButton.Text = "Save and Close"; this.updateButton.UseVisualStyleBackColor = true; this.updateButton.Click += new System.EventHandler(this.updateButton_Click); // // resetButton // - this.resetButton.Location = new System.Drawing.Point(561, 191); + this.resetButton.Location = new System.Drawing.Point(644, 191); this.resetButton.Name = "resetButton"; - this.resetButton.Size = new System.Drawing.Size(211, 23); + this.resetButton.Size = new System.Drawing.Size(128, 23); this.resetButton.TabIndex = 33; this.resetButton.Text = "Reset Configuration"; this.resetButton.UseVisualStyleBackColor = true; @@ -326,11 +327,22 @@ this.propLeftPictureBox.TabStop = false; this.propLeftPictureBox.Visible = false; // + // saveButton + // + this.saveButton.Location = new System.Drawing.Point(513, 191); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(128, 23); + this.saveButton.TabIndex = 36; + this.saveButton.Text = "Save Configuration"; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // // ShortCuterForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(784, 562); + this.Controls.Add(this.saveButton); this.Controls.Add(this.rowDownButton); this.Controls.Add(this.linkPropertiesGroupBox); this.Controls.Add(this.rowUpButton); @@ -390,6 +402,7 @@ private System.Windows.Forms.GroupBox loadParameterGroupBox; private System.Windows.Forms.Label loadParameterLabel; private System.Windows.Forms.TreeView skinLinksTreeView; + private System.Windows.Forms.Button saveButton; } } \ No newline at end of file Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs 2013-10-22 17:51:35 UTC (rev 4665) @@ -17,6 +17,7 @@ private Skin mySkin; //Istanza classe Skin (dati relativi alla skin di MediaPortal) private ShortCuts myShortCuts; //Istanza classe ShortCuts (dati relativi ai shortcuts configurati) private KeyboardHookWorker myHookWorker; //Istanza classe HookWorker (gestione hook di tastiera per immissione tasto [KeyCode] associato allo shortcut) + private bool unsavedChanges; //Presenza modifiche da salvare private bool forceCell; //Azione di forzatura valore cella WindowID dello shortcut #endregion @@ -167,8 +168,7 @@ { string loadParameter = Convert.ToString(shortCutsDataGridView.Rows[shortCutsDataGridView.CurrentRow.Index].Cells[6].Value); showIndex = mySkin.SkinLinks.FindIndex(x => x.WindowID == windowID && x.LoadParameter == loadParameter); - //Selezione eventuale link corrispondente a WindowID & LoadParameter - skinLinksTreeView.SelectedNode = ((showIndex >= 0) ? skinLinksTreeView.Nodes.Find(showIndex.ToString(), true)[0] : null); + mySkin.SetSkinLinkIndex(skinLinksTreeView, showIndex); //--> selezione eventuale link corrispondente a WindowID & LoadParameter } else { @@ -262,7 +262,15 @@ } private void ShortCuterForm_FormClosing(object sender, FormClosingEventArgs e) { - myHookWorker.Stop(); + if (unsavedChanges) //Se presenti modifiche non salvate + { //Richiesta conferma per chiusura applicazione + if (!Tools.QuestionMessage("Closing the application will lose unsaved changes...\nYou want to continue?")) + { + e.Cancel = true; //--> annullamento chiusura form + return; + } + } + myHookWorker.Stop(); //--> disattivazione hook di tastiera } #endregion #region Eventi Modifica Griglia @@ -324,6 +332,7 @@ #region Eventi Modifica Shortcuts private void myShortCutsItems_ListChanged(object sender, EventArgs e) { + unsavedChanges = true; rowRemoveButton.Enabled = (myShortCuts.Items.Count > 0); MoveItemsListButtonsEnable(); } @@ -425,17 +434,26 @@ shortCutsDataGridView.Rows[shortCutsDataGridView.CurrentRow.Index].Cells[1].Value = keyCode.ToString(); return true; } + private void saveButton_Click(object sender, EventArgs e) + { + if (myShortCuts.SaveConfig()) + unsavedChanges = false; + } private void updateButton_Click(object sender, EventArgs e) { if (myShortCuts.SaveConfig()) { + unsavedChanges = false; this.Close(); this.Dispose(); } } private void resetButton_Click(object sender, EventArgs e) { - myShortCuts.LoadConfig(true); + if (Tools.QuestionMessage("Configuration data will be overwritten...\nYou want to continue?")) + { + myShortCuts.LoadConfig(true); + } } private void infoPictureBox_Click(object sender, EventArgs e) { Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.resx =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.resx 2013-10-20 20:06:54 UTC (rev 4664) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.resx 2013-10-22 17:51:35 UTC (rev 4665) @@ -183,6 +183,9 @@ <metadata name="propLeftPictureBox.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="saveButton.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |