Пример #1
0
 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));
 }
Пример #2
0
 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));
 }
Пример #3
0
 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;
 }
Пример #4
0
 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;
 }
Пример #7
0
 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;
 }
Пример #8
0
 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;
 }
Пример #9
0
 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;
 }
Пример #10
0
 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;
 }
Пример #11
0
        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);
            }
        }
Пример #13
0
        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);
        }
Пример #14
0
 /// <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;
 }
Пример #15
0
        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;
        }
Пример #16
0
        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);
        }
Пример #17
0
        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);
        }
Пример #18
0
        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;
        }
Пример #19
0
 /// <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;
 }
Пример #20
0
 public ActiveRosterList(DispatchingCollection<ObservableCollection<Attendance>, Attendance> source, ListBox listBox)
     : base(source, listBox)
 {
     ContactsView.SortDescriptions.Add(new SortDescription("Attendance.Name", ListSortDirection.Ascending));
 }
Пример #21
0
 public ActiveRosterList(DispatchingCollection <ObservableCollection <Attendance>, Attendance> source, ListBox listBox)
     : base(source, listBox)
 {
     ContactsView.SortDescriptions.Add(new SortDescription("Attendance.Name", ListSortDirection.Ascending));
 }