/// <summary> Move an Entry from an old Index to an new Index. </summary> /// <param name="oldIndex">Old index.</param> /// <param name="newIndex">New index.</param> public void MoveImage(int oldIndex, int newIndex) { EntryImage entry = entriesImage[oldIndex]; RemoveImageAt(oldIndex); Insert(entry, newIndex); }
/// <summary> Insert the specified entry with a given index. </summary> /// <param name="entry">Entry.</param> /// <param name="index">Index.</param> private void Insert(EntryImage entry, int index) { if (index > entriesImage.Count) { return; } entriesImage.Insert(index, entry); }
private void CreateNewEntry(bool insertion = false) { if (indexToolbar == 0) { EntryImage entry = new EntryImage { key = "new entry", Localisations = new List <LocalisationImage> (), }; foreach (Language language in langManager.languages) { entry.Add(language.name); } if (insertion) { locManager.Add(entry, newIndex); index = newIndex; } else { locManager.Add(entry); index = locManager.entriesImage.Count - 1; } } else { EntryAudio entry = new EntryAudio { key = "new entry", Localisations = new List <LocalisationAudio> (), }; foreach (Language language in langManager.languages) { entry.Add(language.name); } if (insertion) { locManager.Add(entry, newIndex); index = newIndex; } else { locManager.Add(entry); index = locManager.entriesImage.Count - 1; } } listSize = (indexToolbar == 0) ? locManager.entriesImage.Count : locManager.entriesAudio.Count; SetTriggerList(); }
/// <summary> Insert the specified entry to the list. </summary> /// <param name="entry">Entry.</param> /// <param name="add">If set to <c>true</c> add or override.</param> private void Insert(EntryImage entry, bool add) { int i = FindEntryImage(entry.key); if (i >= 0) { if (add) { return; } entriesImage[i] = entry; } if (add) { entriesImage.Add(entry); } }
/// <summary> Refresh the specified entry. </summary> /// <param name="entry">Entry.</param> public void Refresh(EntryImage entry) { Insert(entry, false); }
/// <summary> Add the specified entry with a given index. </summary> /// <param name="entry">Entry.</param> /// <param name="index">Index.</param> public void Add(EntryImage entry, int index) { Insert(entry, index); }
/// <summary> Add the specified entry. </summary> /// <param name="entry">Entry.</param> public void Add(EntryImage entry) { Insert(entry, true); }
/// <summary> Remove the specified entry. </summary> /// <param name="entry">Entry.</param> public void Remove(EntryImage entry) { entriesImage.Remove(entry); }