public void Update(DictItem di) { if (items.Remove(di.Caption)) { Add(di); } }
public void Load(string path) { items.Clear(); filePath = path; using (System.IO.StreamReader reader = new System.IO.StreamReader(path)) { string line; while ((line = reader.ReadLine()) != null) { if (!String.IsNullOrEmpty(line)) { DictItem di = new DictItem(); di.Read(line); items.Add(di.Caption, di); } } selectedIndex = 0; if (itemsChanged != null) { itemsChanged(new WordSetChange { Count = items.Count, OperationName = "Loaded" }); } } }
public void Update(DictItem di) { if (items.Remove(di.Caption)) { Add(di); if (updateItem != null) { updateItem(); } } }
public void Add(DictItem di) { try { items.Add(di.Caption, di); if (addItem != null) { addItem(di.Caption); } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString(), "Караул !!!", System.Windows.Forms.MessageBoxButtons.OK); } }
public void Add(DictItem di) { try { items.Add(di.Caption, di); if (itemsChanged != null) { itemsChanged(new WordSetChange { Count = items.Count, OperationName = "Append", Message = di.Caption }); } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString(), "Караул !!!", System.Windows.Forms.MessageBoxButtons.OK); } }
/// <summary> /// Загружает набор слов /// </summary> /// <param name="path">Размещение фала словаря</param> public void Load(string path) { items.Clear(); filePath = path; using (System.IO.StreamReader reader = new System.IO.StreamReader(path)) { string line; while ((line = reader.ReadLine()) != null) { if (!String.IsNullOrEmpty(line)) { DictItem di = new DictItem(); di.Read(line); items.Add(di.Caption, di); } } selectedIndex = 0; if (dictionaryLoaded != null) { dictionaryLoaded(items.Count); } } }