コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
 /// <summary> Refresh the specified entry. </summary>
 /// <param name="entry">Entry.</param>
 public void Refresh(EntryImage entry)
 {
     Insert(entry, false);
 }
コード例 #6
0
 /// <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);
 }
コード例 #7
0
 /// <summary> Add the specified entry. </summary>
 /// <param name="entry">Entry.</param>
 public void Add(EntryImage entry)
 {
     Insert(entry, true);
 }
コード例 #8
0
 /// <summary> Remove the specified entry. </summary>
 /// <param name="entry">Entry.</param>
 public void Remove(EntryImage entry)
 {
     entriesImage.Remove(entry);
 }