public SearchRosterList(DispatchingCollection<ObservableCollection<Attendance>, Attendance> source, ListBox listBox, TextBox searchTextBox) : base(source, listBox) { _searchTextBox = searchTextBox; ContactsView.SortDescriptions.Add(new SortDescription("Person.Name", ListSortDirection.Ascending)); }
public SearchRosterList(DispatchingCollection <ObservableCollection <Attendance>, Attendance> source, ListBox listBox, TextBox searchTextBox) : base(source, listBox) { _searchTextBox = searchTextBox; ContactsView.SortDescriptions.Add(new SortDescription("Person.Name", ListSortDirection.Ascending)); }
internal EngagementWindow(GwupeClientAppContext appContext, DispatchingCollection <ObservableCollection <Notification>, Notification> notificationList, Engagement engagement) { InitializeComponent(); _appContext = appContext; Engagement = engagement; engagement.PropertyChanged += EngagementOnPropertyChanged; try { ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionOpened += EngagementOnRDPConnectionAccepted; ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionClosed += EngagementOnRDPConnectionClosed; } catch (Exception e) { Logger.Error("Failed to link into function RemoteDesktop : " + e.Message, e); } _notificationView = new CollectionViewSource { Source = notificationList }; _notificationView.Filter += NotificationFilter; _notificationView.View.Refresh(); notificationList.CollectionChanged += NotificationListOnCollectionChanged; //SetTunnelIndicator(Engagement.IncomingTunnel, IncomingTunnelIndicator); //SetTunnelIndicator(Engagement.OutgoingTunnel, OutgoingTunnelIndicator); ShowChat(); _ewDataContext = new EngagementWindowDataContext(_appContext, engagement); DataContext = _ewDataContext; }
internal EngagementWindow(GwupeClientAppContext appContext, DispatchingCollection<ObservableCollection<Notification>, Notification> notificationList, Engagement engagement) { InitializeComponent(); _appContext = appContext; Engagement = engagement; engagement.PropertyChanged += EngagementOnPropertyChanged; try { ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionOpened += EngagementOnRDPConnectionAccepted; ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionClosed += EngagementOnRDPConnectionClosed; } catch (Exception e) { Logger.Error("Failed to link into function RemoteDesktop : " + e.Message, e); } _notificationView = new CollectionViewSource { Source = notificationList }; _notificationView.Filter += NotificationFilter; _notificationView.View.Refresh(); notificationList.CollectionChanged += NotificationListOnCollectionChanged; //SetTunnelIndicator(Engagement.IncomingTunnel, IncomingTunnelIndicator); //SetTunnelIndicator(Engagement.OutgoingTunnel, OutgoingTunnelIndicator); ShowChat(); _ewDataContext = new EngagementWindowDataContext(_appContext, engagement); DataContext = _ewDataContext; }
public void AddRange() { var batchCollection = new DispatchingCollection <int>(); using (var actual = batchCollection.SubscribeAll()) { var expectedChanges = new List <EventArgs> { CachedEventArgs.CountPropertyChanged, CachedEventArgs.IndexerPropertyChanged, CachedEventArgs.NotifyCollectionReset, }; batchCollection.AddRange(new[] { 1, 2 }); CollectionAssert.AreEqual(new[] { 1, 2 }, batchCollection); CollectionAssert.AreEqual(expectedChanges, actual, EventArgsComparer.Default); batchCollection.AddRange(new[] { 3, 4 }); CollectionAssert.AreEqual(new[] { 1, 2, 3, 4 }, batchCollection); expectedChanges.AddRange( new EventArgs[] { CachedEventArgs.CountPropertyChanged, CachedEventArgs.IndexerPropertyChanged, CachedEventArgs.NotifyCollectionReset, }); CollectionAssert.AreEqual(expectedChanges, actual, EventArgsComparer.Default); } }
public EngagementWindowList(GwupeClientAppContext appContext, DispatchingCollection <ObservableCollection <Notification>, Notification> notificationList, PropertyChangedEventHandler propertyChangeHandler, Dispatcher dispatcher) : base(dispatcher) { this._appContext = appContext; this._notificationList = notificationList; _propertyChangeHandler = propertyChangeHandler; }
protected RosterList(DispatchingCollection<ObservableCollection<Attendance>, Attendance> rosterCollection, ListBox listBox) { RosterCollection = rosterCollection; _listBox = listBox; // Setup the view on this list, so offline people are offline, sorting is correct etc. ContactsView = new CollectionViewSource { Source = rosterCollection }; ContactsView.Filter += FilterEventHandler; rosterCollection.UnderlyingCollection.CollectionChanged += ContactCollectionChanged; }
public TeamManagement() { this.InitializeComponent(); Teams = new DispatchingCollection<ObservableCollection<Components.Person.Team>, Components.Person.Team>(GwupeClientAppContext.CurrentAppContext.TeamManager.Teams, Dispatcher); _dataContext = new TeamManagementData(this); _uiHelper = new UiHelper(Dispatcher,Disabler,null,null); TeamList.ItemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.SelectedEvent, new RoutedEventHandler(TeamSelected))); DataContext = _dataContext; GwupeClientAppContext.CurrentAppContext.TeamManager.Teams.CollectionChanged += TeamsOnCollectionChanged; }
public TeamManagement() { this.InitializeComponent(); Teams = new DispatchingCollection <ObservableCollection <Components.Person.Team>, Components.Person.Team>(GwupeClientAppContext.CurrentAppContext.TeamManager.Teams, Dispatcher); _dataContext = new TeamManagementData(this); _uiHelper = new UiHelper(Dispatcher, Disabler, null, null); TeamList.ItemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.SelectedEvent, new RoutedEventHandler(TeamSelected))); DataContext = _dataContext; GwupeClientAppContext.CurrentAppContext.TeamManager.Teams.CollectionChanged += TeamsOnCollectionChanged; }
protected RosterList(DispatchingCollection <ObservableCollection <Attendance>, Attendance> rosterCollection, ListBox listBox) { RosterCollection = rosterCollection; _listBox = listBox; // Setup the view on this list, so offline people are offline, sorting is correct etc. ContactsView = new CollectionViewSource { Source = rosterCollection }; ContactsView.Filter += FilterEventHandler; rosterCollection.UnderlyingCollection.CollectionChanged += ContactCollectionChanged; }
public static void Add() { var collection = new DispatchingCollection <int>(); var itemsControl = new ItemsControl { ItemsSource = collection }; CollectionAssert.IsEmpty(itemsControl.Items); collection.Add(1); CollectionAssert.AreEqual(new[] { 1 }, itemsControl.Items); }
public void SerializeRountrip() { var binaryFormatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { var ints = new DispatchingCollection <int> { 1, 2 }; binaryFormatter.Serialize(stream, ints); stream.Position = 0; var roundtripped = (DispatchingCollection <int>)binaryFormatter.Deserialize(stream); Assert.AreEqual(ints, roundtripped); } }
public static async Task WhenAddOnOtherThread() { var collection = new DispatchingCollection <int>(); var itemsControl = new ItemsControl { ItemsSource = collection }; CollectionAssert.IsEmpty(itemsControl.Items); await Task.Run(() => collection.Add(1)).ConfigureAwait(false); await Application.Current.Dispatcher.SimulateYield(); CollectionAssert.AreEqual(new[] { 1 }, itemsControl.Items); }
/// <summary> /// Setup the notification handling /// </summary> private void SetupNotificationHandler() { // Handle the notifications NotificationList = new DispatchingCollection <ObservableCollection <Notification>, Notification>( _appContext.NotificationManager.Notifications, Dispatcher); _notificationView = new CollectionViewSource { Source = NotificationList }; _notificationView.Filter += NotificationFilter; Notifications.ItemsSource = _notificationView.View; AlertList = new DispatchingCollection <ObservableCollection <Alert>, Alert>(_appContext.NotificationManager.Alerts, Dispatcher); Alerts.ItemsSource = AlertList; _appContext.NotificationManager.Notifications.CollectionChanged += NotificationsOnCollectionChanged; }
private void SetupRoster() { dispatchingCollection = new DispatchingCollection <ObservableCollection <Attendance>, Attendance>(_appContext.RosterManager.ServicePartyAttendanceList, Dispatcher); AllRosterList = new MainRosterList(dispatchingCollection, AllContacts); AllContacts.LostFocus += Contacts_LostFocus; AllContacts.DataContext = AllRosterList.ContactsView; ActiveRosterList = new ActiveRosterList(dispatchingCollection, CurrentlyActiveContacts); CurrentlyActiveContacts.LostFocus += Contacts_LostFocus; CurrentlyActiveContacts.DataContext = ActiveRosterList.ContactsView; ActiveRosterList.ContactsView.View.CollectionChanged += ActiveRosterChanged; SearchRosterList = new SearchRosterList(dispatchingCollection, SearchContacts, SearchBox); SearchContacts.LostFocus += Contacts_LostFocus; SearchContacts.DataContext = SearchRosterList.ContactsView; }
public static void AddRangeSingle() { var reference = new ObservableCollection <int>(); using var expected = reference.SubscribeAll(); var batchCollection = new DispatchingCollection <int>(); using var actual = batchCollection.SubscribeAll(); reference.Add(1); batchCollection.AddRange(new[] { 1 }); CollectionAssert.AreEqual(reference, batchCollection); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); reference.Add(2); batchCollection.AddRange(new[] { 2 }); CollectionAssert.AreEqual(reference, batchCollection); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); }
public static void Remove() { var reference = new ObservableCollection <int> { 1, 2, 3 }; using var expected = reference.SubscribeAll(); var batchCollection = new DispatchingCollection <int>(reference); using var actual = batchCollection.SubscribeAll(); reference.Remove(1); batchCollection.Remove(1); CollectionAssert.AreEqual(reference, batchCollection); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); reference.Remove(2); batchCollection.Remove(2); CollectionAssert.AreEqual(reference, batchCollection); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); }
private void SetupRoster() { dispatchingCollection = new DispatchingCollection<ObservableCollection<Attendance>, Attendance>(_appContext.RosterManager.ServicePartyAttendanceList, Dispatcher); AllRosterList = new MainRosterList(dispatchingCollection, AllContacts); AllContacts.LostFocus += Contacts_LostFocus; AllContacts.DataContext = AllRosterList.ContactsView; ActiveRosterList = new ActiveRosterList(dispatchingCollection, CurrentlyActiveContacts); CurrentlyActiveContacts.LostFocus += Contacts_LostFocus; CurrentlyActiveContacts.DataContext = ActiveRosterList.ContactsView; ActiveRosterList.ContactsView.View.CollectionChanged += ActiveRosterChanged; SearchRosterList = new SearchRosterList(dispatchingCollection, SearchContacts, SearchBox); SearchContacts.LostFocus += Contacts_LostFocus; SearchContacts.DataContext = SearchRosterList.ContactsView; }
/// <summary> /// Setup the notification handling /// </summary> private void SetupNotificationHandler() { // Handle the notifications NotificationList = new DispatchingCollection<ObservableCollection<Notification>, Notification>( _appContext.NotificationManager.Notifications, Dispatcher); _notificationView = new CollectionViewSource { Source = NotificationList }; _notificationView.Filter += NotificationFilter; Notifications.ItemsSource = _notificationView.View; AlertList = new DispatchingCollection<ObservableCollection<Alert>, Alert>(_appContext.NotificationManager.Alerts, Dispatcher); Alerts.ItemsSource = AlertList; _appContext.NotificationManager.Notifications.CollectionChanged += NotificationsOnCollectionChanged; }
public ActiveRosterList(DispatchingCollection<ObservableCollection<Attendance>, Attendance> source, ListBox listBox) : base(source, listBox) { ContactsView.SortDescriptions.Add(new SortDescription("Attendance.Name", ListSortDirection.Ascending)); }
public ActiveRosterList(DispatchingCollection <ObservableCollection <Attendance>, Attendance> source, ListBox listBox) : base(source, listBox) { ContactsView.SortDescriptions.Add(new SortDescription("Attendance.Name", ListSortDirection.Ascending)); }