private void UpdateTabItem(int index) { if (index == 1) { AgentStates.Clear(); tempAgents.ToList().ForEach(x => { if (!x.DefaultName.Equals("Buttons")) { AgentStates.Add(x); } }); Hide = tempAgents.FirstOrDefault(p => p.DefaultName == "Buttons"); HideOrDisable = Hide.Name.Equals("true", StringComparison.OrdinalIgnoreCase) ? true : false; } }
public static AsyncObservableCollection <T> SortEntries2 <T>(AsyncObservableCollection <T> entries) where T : ISortable, new() { //ObservableCollect doesn't have a Sort method, so we need to do our own (bad) one here. if (entries != null) { var sortedEntries = SortEntries2(entries.ToList()); //To preserve the original ObservableCollection object, copy the sorted entries back into it rather than creating a new one: for (int i = 0; i < entries.Count; i++) { entries[i] = sortedEntries[i]; } } return(entries); }
/// <summary> /// Loads the network plugins. /// </summary> private void loadNetworkPlugins() { _networks = new AsyncObservableCollection<NetworkProvider>(); IEnumerable<Type> availableProtocols = CoreIntelligence.PluginIntelligence.LoadedPluginTypes.Where(x => x.IsSubclassOf(typeof(EasySocial.FrameWork.Plugins.NetworkPlugins.BaseNetworkPlugin))); foreach (TableModels.System_Social_User2Protocol user2prot in User2Protocol.OrderBy(x => x.NetworkName)) { foreach (Type availableProtocol in availableProtocols) { EasySocial.FrameWork.Plugins.BasePlugin plug = CoreIntelligence.PluginIntelligence.TryCreatingInstance(availableProtocol); if (plug != null) { if (plug.Name == user2prot.NetworkName && user2prot.User == CoreIntelligence.UserIntelligence.Current.Username) { plug.Load(); _networks.Add(((EasySocial.FrameWork.Plugins.NetworkPlugins.BaseNetworkPlugin)plug).Network); } } } } _networks.ToList().ForEach(x => x.Contacts.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Contacts_CollectionChanged)); }