public static void Reload() { foreach (var domainDefinition in Domains.Values) { if (domainDefinition.Loaded) { domainDefinition.Records = RecordStructure.Load(domainDefinition.xmlPath); } } if (DomainLoaded != null) { DomainLoaded(null, EventArgs.Empty); } }
public static DomainDefinition Load(string p) { DomainDefinition define; if (!Domains.TryGetValue(p, out define)) { define = new DomainDefinition(p); Domains[p] = define; } if (!define.Loaded) { define.Records = RecordStructure.Load(define.xmlPath); define.Loaded = true; if (DomainLoaded != null) { DomainLoaded(define, EventArgs.Empty); } } return(define); }
/// <summary> /// The default constructor. /// </summary> public CriticalRecordsForm() { if (!RecordStructure.Loaded) { try { RecordStructure.Load(); } catch (Exception ex) { MessageBox.Show( "Could not parse RecordStructure.xml. Record-at-once editing will be unavailable.\n" + ex.Message, "Warning"); } } InitializeComponent(); cbxSeverity.DataSource = Enum.GetValues(typeof(CriticalRecordInfo.ConflictSeverity)); cbxSeverity.SelectedItem = CriticalRecordInfo.ConflictSeverity.Conflict; Properties.Settings.Default.windowPositions.GetWindowPosition("CREditor", this); }
private void InitializeToolStripFind() { var items = new[] { new ComboHelper <SearchType, string>(SearchType.EditorID, "Editor ID"), new ComboHelper <SearchType, string>(SearchType.FormID, "Form ID"), new ComboHelper <SearchType, string>(SearchType.FullSearch, "Full Search"), new ComboHelper <SearchType, string>(SearchType.TypeEditorIdSearch, "Name w/Type"), new ComboHelper <SearchType, string>(SearchType.TypeFullSearch, "Full w/Type"), new ComboHelper <SearchType, string>(SearchType.FormIDRef, "Form ID Ref."), }; this.toolStripIncrFindType.Items.Clear(); foreach (var itm in items) { this.toolStripIncrFindType.Items.Add(itm); } this.toolStripIncrFindType.SelectedIndex = 0; // toolStripIncrFindType.SelectedItem = toolStripIncrFindType.Items[0]; this.ResetSearch(); this.toolStripIncrFindStatus.Text = string.Empty; if (!RecordStructure.Loaded) { RecordStructure.Load(); } var recitems = RecordStructure.Records.Keys.OfType <object>().ToArray(); // var recitems = TESVSnip.Properties.Settings.Default.AllESMRecords != null // ? TESVSnip.Properties.Settings.Default.AllESMRecords.Trim().Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries).OfType<object>().ToArray() // : new object[0]; this.toolStripIncrFindTypeFilter.Sorted = true; this.toolStripIncrFindTypeFilter.Items.Clear(); this.toolStripIncrFindTypeFilter.Items.AddRange(recitems); this.toolStripIncrFindTypeFilter.SelectedIndex = 0; }
private void InitializeToolStripFind() { if (DesignMode) { return; } if (TESVSnip.Properties.Settings.Default.SearchMRUNameList == null) { TESVSnip.Properties.Settings.Default.SearchMRUNameList = new StringCollection(); } if (TESVSnip.Properties.Settings.Default.SearchMRUFormIDList == null) { TESVSnip.Properties.Settings.Default.SearchMRUFormIDList = new StringCollection(); } if (TESVSnip.Properties.Settings.Default.SearchMRUFullList == null) { TESVSnip.Properties.Settings.Default.SearchMRUFullList = new StringCollection(); } var items = new object[] { new MRUComboHelper <SearchType, string>(SearchType.EditorID, "Editor ID", TESVSnip.Properties.Settings.Default.SearchMRUNameList), new MRUComboHelper <SearchType, string>(SearchType.FormID, "Form ID", TESVSnip.Properties.Settings.Default.SearchMRUFormIDList), new MRUComboHelper <SearchType, string>(SearchType.FullSearch, "Full Search", TESVSnip.Properties.Settings.Default.SearchMRUFullList), new MRUComboHelper <SearchType, string>(SearchType.TypeEditorIdSearch, "Name w/Type", TESVSnip.Properties.Settings.Default.SearchMRUNameList), new MRUComboHelper <SearchType, string>(SearchType.TypeFullSearch, "Full w/Type", TESVSnip.Properties.Settings.Default.SearchMRUFullList), new MRUComboHelper <SearchType, string>(SearchType.FormIDRef, "Form ID Ref.", TESVSnip.Properties.Settings.Default.SearchMRUFormIDList), new MRUComboHelper <SearchType, string>(SearchType.BasicCriteriaRef, "Basic Search", new StringCollection()), }; toolStripIncrFindType.Items.Clear(); toolStripIncrFindType.Items.AddRange(items); int idx = 0; if (!string.IsNullOrEmpty(Properties.Settings.Default.LastSearchType)) { idx = toolStripIncrFindType.FindStringExact(Properties.Settings.Default.LastSearchType); } idx = idx >= 0 ? idx : 0; toolStripIncrFindType.SelectedIndex = idx; ResetSearch(); toolStripIncrFindStatus.Text = ""; if (!RecordStructure.Loaded) { RecordStructure.Load(); } toolStripIncrFindTypeFilter.Sorted = true; toolStripIncrFindTypeFilter.Items.Clear(); if (RecordStructure.Records != null) { var recitems = RecordStructure.Records.Keys.OfType <object>().ToArray(); toolStripIncrFindTypeFilter.Items.AddRange(recitems); } toolStripIncrFindTypeFilter.SelectedIndex = 0; backgroundWorker1.DoWork += backgroundWorker1_DoWork; backgroundWorker1.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted; backgroundWorker1.ProgressChanged += backgroundWorker1_ProgressChanged; }