private void TypesToGroups() { foreach (var t in _types) { ObservablePluginGroup ng = new ObservablePluginGroup(t); _theList.Add(ng); _plugins.Where(p => p.SubType == t).ToList().ForEach(ng.Add); } }
public void Add_ShouldRaiseEvent() { var collectionChangedEventRaised = false; var source = new[] { 1, 2, 3 }; var group = new ObservableGroup <string, int>("key", source); ((INotifyCollectionChanged)group).CollectionChanged += (s, e) => collectionChangedEventRaised = true; group.Add(4); group.Key.Should().Be("key"); group.Should().BeEquivalentTo(new[] { 1, 2, 3, 4 }, option => option.WithStrictOrdering()); collectionChangedEventRaised.Should().BeTrue(); }
private void UpdateActivitesList() { _sortedActivities.Clear(); _timedActivities.Clear(); StringCollection viewed = _oData.ViewedActivities; _oData.ViewedActivities = new StringCollection(); foreach (IActivity a in _mData.Activities) { if (a.Type == (Enum)GAME.Modules.Warframe.Common.Missions.Enums.Type.Alert) { _timedActivities.Add(a); } String pName = Enum.GetName(a.Platform.GetType(), a.Platform); String tName = Enum.GetName(a.Type.GetType(), a.Type); String aName = a.Done ? "Done" : "Available"; if (!a.Viewed) { _newActivities = true; } if (viewed.Contains(a.Id)) { _oData.ViewedActivities.Add(a.Id); } ObservableAvailabilityGroup availabilityGroup = _sortedActivities.Where(g => g.GroupName == aName).FirstOrDefault(); if (availabilityGroup == null) { availabilityGroup = new ObservableAvailabilityGroup(aName, _sortedActivities.PathToGroup + aName); _sortedActivities.Add(availabilityGroup); } availabilityGroup.Expanded = (_oData.ExpandedExpanders.Contains(availabilityGroup.PathToGroup)? true : false); ObservablePlatformGroup platformGroup = availabilityGroup.Where(g => g.GroupName == pName).FirstOrDefault(); if (platformGroup == null) { platformGroup = new ObservablePlatformGroup(pName, availabilityGroup.PathToGroup + pName); availabilityGroup.Add(platformGroup); } platformGroup.Expanded = (_oData.ExpandedExpanders.Contains(platformGroup.PathToGroup) ? true : false); ObservableTypeGroup typeGroup = platformGroup.Where(g => g.GroupName == tName).FirstOrDefault(); if (typeGroup == null) { typeGroup = new ObservableTypeGroup(tName, platformGroup.PathToGroup + tName); platformGroup.Add(typeGroup); } typeGroup.Expanded = (_oData.ExpandedExpanders.Contains(typeGroup.PathToGroup) ? true : false); typeGroup.Add(a); } _sortedActivities.OrderBy(g => g.GroupName); foreach (var availabilityGroup in _sortedActivities) { availabilityGroup.OrderBy(g => g.GroupName); foreach (var platformGroup in availabilityGroup) { platformGroup.OrderBy(g => g.GroupName); foreach (var typeGroup in platformGroup) { if (typeGroup.GroupName == Enum.GetName(typeof(GAME.Modules.Warframe.Common.Missions.Enums.Type), GAME.Modules.Warframe.Common.Missions.Enums.Type.Alert)) { typeGroup.OrderBy(a => ((GAME.Modules.Warframe.Common.Missions.Models.Activity.Alert)a).TimeLeft); } else { typeGroup.OrderBy(a => a.PublishDate); } } } } if (_newActivities) { Uri u = new Uri(Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory + _oData.NewActivitySoundPath), UriKind.Absolute); _mediaPlayer.Open(u); _newActivities = false; } viewed.Clear(); }