Ejemplo n.º 1
0
        private void RefreshLesson(LessonRealm lesson)
        {
            GroupedList <DateTime, LessonRealm> selectedDay = this.SelectedDay;

            this.ComposeLessons((IEnumerable <LessonRealm>) this._lessonDataService.GetLessons(this.ActiveProfileRealm.RolelessId, this.FirstDayOfWeek, this.LastDayOfWeek).OrderBy <LessonRealm, DateTime>((Func <LessonRealm, DateTime>)(x => x.StartTimeLocal)));
            this.SelectedDay = selectedDay;
        }
Ejemplo n.º 2
0
        private void CheckConsolidatedLists()
        {
            if (_consolidatedFunctions == null)
            {
                _consolidatedFunctions = new GroupedList <string, FFFunction>();
                _consolidatedClasses   = new GroupedList <string, FFClass>();
                _consolidatedPermExs   = new GroupedList <string, FFPermEx>();

                foreach (var file in _files.Values)
                {
                    foreach (var func in file.Functions)
                    {
                        if (!func.Visible)
                        {
                            continue;
                        }
                        _consolidatedFunctions.Add(func.Name, func);
                    }

                    var cls = file.Class;
                    if (cls != null)
                    {
                        _consolidatedClasses.Add(cls.Name, cls);
                    }

                    foreach (var permex in file.PermExs)
                    {
                        _consolidatedPermExs.Add(permex.Name, permex);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <XmlElementPath> GetParentElementPaths(string xml)
        {
            IDictionary <string, string> namespaces;
            var    path          = GetParentElementPathCore(xml, out namespaces);
            string lastNamespace = "";
            var    groups        = new GroupedList <string, QualifiedName>();

            foreach (QualifiedName qname in path.Elements)
            {
                groups.Add(qname.Namespace ?? "", qname);
                lastNamespace = qname.Namespace;
            }

            var orderedList = groups.ToList();

            orderedList.Sort((x, y) =>
            {
                if (x.Key == y.Key)
                {
                    return(0);
                }
                if (x.Key == lastNamespace)
                {
                    return(-1);
                }
                if (y.Key == lastNamespace)
                {
                    return(1);
                }
                return(x.Key.CompareTo(y.Key));
            });

            return(orderedList.Select(g => new XmlElementPath(g.ToArray())));
        }
Ejemplo n.º 4
0
        public static void CountItemsFrom(this CategoryList categories, GroupedList groupedList)
        {
            // count item in each category group

            foreach (var g in groupedList)
            {
                foreach (var c in categories.Where(c => c.Name == g.Key))
                {
                    c.NumOfItems = g.Count;
                }
            }
        }
Ejemplo n.º 5
0
        public void OnVisibleFileChanged(FFFile file)
        {
            _consolidatedFunctions = null;
            _consolidatedClasses   = null;
            _consolidatedPermExs   = null;

            var fileNameLower = file.FileName.ToLower();

            if (!_files.ContainsKey(fileNameLower))
            {
                _files[fileNameLower] = file;
            }
        }
Ejemplo n.º 6
0
 internal SongMatchData(
     AlbumMetadata mergedAlbum,
     TrackMetadata track,
     GroupedList matchOptions,
     int originalMergedIndex,
     int selectedMatchIndex)
 {
     this._mergedAlbum         = mergedAlbum;
     this._track               = track;
     this._matchOptions        = matchOptions;
     this._originalMergedIndex = originalMergedIndex;
     this._selectedMatchIndex  = selectedMatchIndex;
 }
Ejemplo n.º 7
0
        public static KeyedList GetOrAddGroup(this GroupedList list, string key)
        {
            // get group (keyed list) in grouped list with specified key
            // if no group is found, new group is created and returned

            if (list.Any(g => g.Key == key))
            {
                return(list.First(g => g.Key == key));
            }
            else
            {
                var newGroup = new KeyedList(key);
                list.Add(newGroup);
                return(newGroup);
            }
        }
Ejemplo n.º 8
0
        public static List <SongMatchData> GetSongMatchDataList(
            AlbumMetadata localAlbum,
            AlbumMetadata mergedAlbum,
            uint wmisAlbumTrackCount)
        {
            List <SongMatchData> songMatchDataList = new List <SongMatchData>((int)localAlbum.TrackCount);

            for (uint index = 0; index < localAlbum.TrackCount; ++index)
            {
                TrackMetadata track              = localAlbum.GetTrack(index);
                GroupedList   optionsForTrack    = GetOptionsForTrack(track, mergedAlbum, wmisAlbumTrackCount);
                int           fromAlbumMetadata  = GetTrackIndexFromAlbumMetadata(mergedAlbum, track.MediaId);
                int           selectedMatchIndex = fromAlbumMetadata < wmisAlbumTrackCount ? fromAlbumMetadata + 1 : -1;
                SongMatchData songMatchData      = new SongMatchData(mergedAlbum, track, optionsForTrack, fromAlbumMetadata, selectedMatchIndex);
                songMatchDataList.Add(songMatchData);
            }
            return(songMatchDataList);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Return the selected item index from grouped list
        /// </summary>
        /// <param name="selectedItem">Object of selected Item as GroupedListModel</param>
        /// <returns></returns>
        public static int SelectedIndex(GroupedListModel selectedItem)
        {
            int count = 0;

            var selectedParent = GroupedList.FirstOrDefault(x => x.Contains(selectedItem));

            var parentIndex = GroupedList.IndexOf(selectedParent);

            for (int i = 0; i < parentIndex; i++)
            {
                count += GroupedList[i].Count;
            }

            var index = (from groupedlist in GroupedList
                         from item in groupedlist
                         where item.Code == selectedItem.Code
                         select groupedlist.IndexOf(item)).FirstOrDefault();

            count += index;

            return(count);
        }
 public StringCompositionProvider()
 {
     this.partsSet = new GroupedList<string, string>();
     this.compositions = new Dictionary<string, string>();
 }
Ejemplo n.º 11
0
 public ExtensionRegistry()
 {
     this.extensions = new GroupedList<Type, object>();
 }
Ejemplo n.º 12
0
        private bool AdvanceEnum()
        {
            _atEnd = !_enum.MoveNext();

              if (_atEnd)
              {
            return false;
              }
              else
              {
            if (_numProcessed == 0)
            {
              _columns = _reader.Columns;
              if (_columns == null)
              {
            _columns = new string[_reader.ColumnCount];
            for (var i = 0; i < _columns.Length; i++)
            {
              _columns[i] = "Column " + (i + 1);
            }
              }
              else
              {
            var grouped = new GroupedList<string, string>();
            int valueCount;
            for (var i = 0; i < _columns.Length; i++)
            {
              valueCount = grouped.Add(_columns[i].ToLowerInvariant().Replace(' ', '_'), _columns[i]);
              if (valueCount > 1) _columns[i] = _columns[i] + " " + valueCount.ToString();
            }
              }
            }
            _numProcessed++;
            return true;
              }
        }
Ejemplo n.º 13
0
    public static IEnumerable<XmlElementPath> GetParentElementPaths(string xml)
    {
      var path = GetParentElementPathCore(xml);
      string lastNamespace = "";
      var groups = new GroupedList<string, QualifiedName>();
      foreach (QualifiedName qname in path.Elements)
      {
        groups.Add(qname.Namespace ?? "", qname);
        lastNamespace = qname.Namespace;
      }

      var orderedList = groups.ToList();
      orderedList.Sort((x, y) =>
      {
        if (x.Key == y.Key) return 0;
        if (x.Key == lastNamespace) return -1;
        if (y.Key == lastNamespace) return 1;
        return x.Key.CompareTo(y.Key);
      });

      return orderedList.Select(g => new XmlElementPath(g.ToArray())
      {
        Namespaces = path.Namespaces
      });
    }
Ejemplo n.º 14
0
 public ActorInventory()
 {
     Inventory = new GroupedList<InventoryItem>();
     TotalMoney = 0;
     EquippedItems = new Dictionary<EquipmentLocation, InventoryItem>();
 }