private void DoEdit(MemoryEntry memoryEntry, bool isNew)
 {
     var dialog = new DialogEntryInfo(memoryEntry, _groups);
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         if (isNew)
         {
             _entries.Add(memoryEntry);
             _entries.Sort((e1, e2) => e1.Frequency.CompareTo(e2.Frequency));
         }
         _settingsPersister.PersistStoredFrequencies(_entries);
         if (!_groups.Contains(memoryEntry.GroupName))
         {
             _groups.Add(memoryEntry.GroupName);
             ProcessGroups(memoryEntry.GroupName);
         }
         else
         {
             if ((string)comboGroups.SelectedItem == AllGroups || (string)comboGroups.SelectedItem == memoryEntry.GroupName ||
                 ((string)comboGroups.SelectedItem == FavouriteGroup && memoryEntry.IsFavourite))
             {
                 if (isNew)
                     _displayedEntries.Add(memoryEntry);                            
             }
             else
                 comboGroups.SelectedItem = memoryEntry.GroupName;
         }
     }
 }
Esempio n. 2
0
        private void DoEdit(MemoryEntry memoryEntry, bool isNew)
        {
            var dialog = new DialogEntryInfo(memoryEntry, _groups);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (isNew)
                {
                    _entries.Add(memoryEntry);
                    _entries.Sort((e1, e2) => e1.Frequency.CompareTo(e2.Frequency));
                }
                _settingsPersister.PersistStoredFrequencies(_entries);
                if (!_groups.Contains(memoryEntry.GroupName))
                {
                    _groups.Add(memoryEntry.GroupName);
                    ProcessGroups(memoryEntry.GroupName);
                }
                else
                {
                    if ((string)comboGroups.SelectedItem == AllGroups || (string)comboGroups.SelectedItem == memoryEntry.GroupName ||
                        ((string)comboGroups.SelectedItem == FavouriteGroup && memoryEntry.IsFavourite))
                    {
                        if (isNew)
                        {
                            _displayedEntries.Add(memoryEntry);
                        }
                    }
                    else
                    {
                        comboGroups.SelectedItem = memoryEntry.GroupName;
                    }
                }
            }
        }
        private void DoEdit(MemoryEntry memoryEntry, bool isNew)
        {
            DialogEntryInfo dialogEntryInfo = new DialogEntryInfo(memoryEntry, this._groups);

            if (dialogEntryInfo.ShowDialog() == DialogResult.OK)
            {
                if (isNew)
                {
                    this._entries.Add(memoryEntry);
                    this._entries.Sort((MemoryEntry e1, MemoryEntry e2) => e1.Frequency.CompareTo(e2.Frequency));
                }
                this._settingsPersister.PersistStoredFrequencies(this._entries);
                if (!this._groups.Contains(memoryEntry.GroupName))
                {
                    this._groups.Add(memoryEntry.GroupName);
                    this.ProcessGroups(memoryEntry.GroupName);
                }
                else if ((string)this.comboGroups.SelectedItem == "[All Groups]" || (string)this.comboGroups.SelectedItem == memoryEntry.GroupName || ((string)this.comboGroups.SelectedItem == "[Favourites]" && memoryEntry.IsFavourite))
                {
                    if (isNew)
                    {
                        this._displayedEntries.Add(memoryEntry);
                    }
                }
                else
                {
                    this.comboGroups.SelectedItem = memoryEntry.GroupName;
                }
            }
        }