private void buttonAdd_Click(object sender, EventArgs e) { GameGenieCodeAddModForm lForm = new GameGenieCodeAddModForm(FGame); if (lForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var newCode = lForm.Code.ToUpper().Trim(); GameGenieCode lCode = null; foreach (GameGenieCode Code in checkedListBoxGameCode.Items) { if (Code.Code.ToUpper().Trim() == newCode) { lCode = Code; break; } } if (lCode != null) { if (Tasks.MessageForm.Show(Resources.Warning, Resources.GGCodeExists, Resources.sign_question, new Tasks.MessageForm.Button[] { Tasks.MessageForm.Button.Yes, Tasks.MessageForm.Button.No }, Tasks.MessageForm.DefaultButton.Button2) == Tasks.MessageForm.Button.Yes) //if (MessageBox.Show(this, Resources.GGCodeExists, Resources.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { lCode.Description = lForm.Description; FGameGenieDataBase.ModifyCode(lCode); } } else { GameGenieCode lNewCode = new GameGenieCode(newCode, lForm.Description); FGameGenieDataBase.AddCode(lNewCode); LoadGameGenieCodes(); } } }
public void AddCode(GameGenieCode ACode) { FModified = true; XmlNode lCodeNode = FXml.CreateElement("gamegenie"); GameNode.AppendChild(lCodeNode); XmlAttribute lAttribute; lAttribute = FXml.CreateAttribute("code"); lAttribute.Value = ACode.Code.ToUpper().Trim(); lCodeNode.Attributes.Append(lAttribute); lAttribute = FXml.CreateAttribute("description"); lAttribute.Value = ACode.Description; lCodeNode.Attributes.Append(lAttribute); if (FGameCodes == null) { FGameCodes = new List <GameGenieCode>(); } FGameCodes.Add(ACode); }
public void DeleteCode(GameGenieCode ACode) { XmlNode lCurCode = GameNode.SelectSingleNode(string.Format("gamegenie[@code='{0}']", ACode.Code.ToUpper().Trim())); if (lCurCode != null) { lCurCode.ParentNode.RemoveChild(lCurCode); } FGameCodes.Remove(ACode); FModified = true; }
public void ModifyCode(GameGenieCode ACode) { XmlNode lCurCode = GameNode.SelectSingleNode(string.Format("gamegenie[@code='{0}']", ACode.OldCode.ToUpper().Trim())); if (lCurCode != null) { lCurCode.Attributes.GetNamedItem("code").Value = ACode.Code.ToUpper().Trim(); lCurCode.Attributes.GetNamedItem("description").Value = ACode.Description; FModified = true; } }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { var i = (int)(sender as ToolStripMenuItem).Tag; GameGenieCode lCode = (GameGenieCode)checkedListBoxGameCode.Items[i]; if (MessageBox.Show(this, string.Format(Resources.GGCodeDelete, lCode.Description), Resources.AreYouSure, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { FGameGenieDataBase.DeleteCode(lCode); checkedListBoxGameCode.Items.Remove(lCode); } }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { var i = (int)(sender as ToolStripMenuItem).Tag; GameGenieCode lCode = (GameGenieCode)checkedListBoxGameCode.Items[i]; GameGenieCodeAddModForm lForm = new GameGenieCodeAddModForm(FGame); lForm.Code = lCode.Code; lForm.Description = lCode.Description; if (lForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { lCode.Code = lForm.Code; lCode.Description = lForm.Description; FGameGenieDataBase.ModifyCode(lCode); } }