/// <summary> /// /// </summary> /// <param name="hWndOwner"></param> /// <returns></returns> protected override bool RunDialog(IntPtr hWndOwner) { HistoryEditorDialogBox dialogInstance = null; bool okTriggered = false; try { dialogInstance = new HistoryEditorDialogBox(); dialogInstance.Owner = (Form.FromHandle(hWndOwner) as Form); dialogInstance.HistoryEntry = this.entry; dialogInstance.LanguageSelectorVisible = localised; if (dialogInstance.ShowDialog() == DialogResult.OK) { okTriggered = true; this.entry = dialogInstance.HistoryEntry; this.Save(this, new HistoryEditorDialogBoxSaveEventArgs(entry)); //this.Reset(); // reset the entry after it's been finished with } } finally { if (dialogInstance != null) { dialogInstance.Dispose(); } } return(okTriggered); }
/// <summary> /// /// </summary> /// <param name="entry"></param> public void SetEntry(ModHistoryEntry entry) { if (entry.ChangeLog.Count == 0) { entry.ChangeLog.Add(new ModHistoryChangeLog(), "en"); } //TODO: //textBoxEntry.Text = entry.HistoryChanges.GetValue().Replace("\r","").Replace("\n", "\r\n"); MODVersionMajor.Value = entry.Version.Major; MODVersionMinor.Value = entry.Version.Minor; MODVersionRevision.Value = entry.Version.Revision; MODVersionRelease.Text = entry.Version.Release.ToString(); ModVersionStage.Text = entry.Version.Stage.ToString(); MODHistorydtp.Value = entry.Date; comboBoxLanguages.Items.Clear(); comboBoxLanguages.Text = ""; foreach (DictionaryEntry de in entry.ChangeLog) { comboBoxLanguages.Items.Add((string)de.Key); if (comboBoxLanguages.Items.Count == 1) { comboBoxLanguages.SelectedIndex = 0; listViewModChanges.Clear(); foreach (string change in ((ModHistoryChangeLog)de.Value)) { listViewModChanges.Items.Add(change.Split('\n')[0]); } } } this.entry = entry; }
/// <summary> /// /// </summary> public HistoryEditorDialogBox() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // entry = new ModHistoryEntry(); entry.ChangeLog = new ModHistoryChangeLogLocalised(); }
/// <summary> /// /// </summary> public override void Reset() { this.entry = new ModHistoryEntry(); this.index = -1; }
/// <summary> /// /// </summary> /// <param name="entry"></param> public HistoryEditorDialogBoxSaveEventArgs(ModHistoryEntry entry) { this.Entry = entry; }