Beispiel #1
0
        public ViewFilter()
        {
            Filter = new Filter();
            Filter.FilterChanged += delegate { RebuildCurrentViewAsync(); };

            Messages = new ThreadSafeCollection<Message>();

            mailbox = VirtualMailBox.Current;
            mailbox.InboxLoadComplete += delegate
                {
                    // Perform a lock-free update on the UI-Thread.
                    // We should be safe because at this point there should be no async tasks
                    // running and all inserts should happen on the UI thread anyway.
                    Messages.Replace(GetMessagesInView(
                        mailbox.Messages.Where(IsMessageVisible).AsQueryable()).ToList());
                };

            signal = new AutoResetEvent(false);
            workerThread = new Thread(RenderView)
                {
                    Name = "View rendering thread",
                    IsBackground = true,
                    Priority = ThreadPriority.Normal
                };

            workerThread.Start();
        }
        public ContactsState()
        {
            mailbox = VirtualMailBox.Current;

            SelectedPersons = new AdvancedObservableCollection <Person>();

            PersonsViewSource = new CollectionViewSource {
                Source = VirtualMailBox.Current.Persons
            };
            PersonsViewSource.View.Filter = ContactsViewSourceFilter;

            Sort = new SortHelper(PersonsViewSource);
            Sort.LoadSettings();

            Filter = new FilterHelper(PersonsViewSource);

            SelectedPersons.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedPerson");

                OnSelectionChanged();
            };

            EventBroker.Subscribe(AppEvents.SyncContactsFinished, () => Thread.CurrentThread.ExecuteOnUIThread(() => PersonsViewSource.View.Refresh()));
        }
Beispiel #3
0
        public ViewFilter()
        {
            Filter = new Filter();
            Filter.FilterChanged += delegate { RebuildCurrentViewAsync(); };

            Messages = new ThreadSafeCollection <Message>();

            mailbox = VirtualMailBox.Current;
            mailbox.InboxLoadComplete += delegate
            {
                // Perform a lock-free update on the UI-Thread.
                // We should be safe because at this point there should be no async tasks
                // running and all inserts should happen on the UI thread anyway.
                Messages.Replace(GetMessagesInView(
                                     mailbox.Messages.Where(IsMessageVisible).AsQueryable()).ToList());
            };

            signal       = new AutoResetEvent(false);
            workerThread = new Thread(RenderView)
            {
                Name         = "View rendering thread",
                IsBackground = true,
                Priority     = ThreadPriority.Normal
            };

            workerThread.Start();
        }
        public DetailsView()
        {
            mailbox = VirtualMailBox.Current;

            InitializeComponent();

            DataContext = this;
        }
Beispiel #5
0
        public OverviewColumnTabItem()
        {
            mailbox = VirtualMailBox.Current;

            DataContext = this;

            EventBroker.Subscribe(AppEvents.SyncStatusUpdatesFinished,
                                  () => ThreadPool.QueueUserWorkItem(UpdateCountAsync));
        }
Beispiel #6
0
        public CoolSearch()
        {
            searchFlipper = new Flipper(TimeSpan.FromMilliseconds(500), InlineSearch);
            mailbox       = VirtualMailBox.Current;

            InitializeComponent();

            DataContext = this;
        }
        public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
            : base(config, channel)
        {
            this.config  = config;
            this.channel = channel;
            this.folder  = folder;
            this.range   = range;

            mailbox = VirtualMailBox.Current;
        }
Beispiel #8
0
        public SearchProfilesControl()
        {
            mailbox = VirtualMailBox.Current;

            InitializeComponent();

            DataContext = this;

            Profiles = new AdvancedObservableCollection <Profile>();
        }
Beispiel #9
0
        public DetailsView()
        {
            using (new CodeTimer("ColumnSearch/Constructor"))
            {
                dock          = new SearchDockControl();
                mailbox       = VirtualMailBox.Current;
                messages      = new ThreadSafeCollection <Message>();
                documents     = new ThreadSafeCollection <Document>();
                persons       = new ThreadSafeCollection <Person>();
                statusUpdates = new ThreadSafeCollection <UserStatus>();

                messagesViewSource = new CollectionViewSource {
                    Source = messages
                };
                messagesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending));

                documentsViewSource = new CollectionViewSource {
                    Source = documents
                };
                documentsViewSource.SortDescriptions.Add(new SortDescription("Filename", ListSortDirection.Ascending));

                personsViewSource = new CollectionViewSource {
                    Source = persons
                };
                personsViewSource.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));

                statusUpdatesViewSource = new CollectionViewSource {
                    Source = statusUpdates
                };
                statusUpdatesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending));

                InitializeComponent();

                MessagesColumn.OverrideViewSource(messagesViewSource);
                DocumentsColumn.OverrideViewSource(documentsViewSource);
                StatusUpdatesColumn.OverrideViewSource(statusUpdatesViewSource);

                dock.UpdateSearch += delegate
                {
                    LoadData(new ColumnSearchDataHelper {
                        SearchQuery = dock.SearchQuery
                    });
                };

                DataContext = this;
            }
        }
        public RealtimeStream(ChannelInstance channel, string keyword)
        {
            this.Channel = channel;
            this.Keyword = keyword;
            this.mailbox = VirtualMailBox.Current;

            this.markreadtimer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher)
            {
                Interval = TimeSpan.FromMilliseconds(400), IsEnabled = false
            };
            this.markreadtimer.Tick += MarkReadTimerTick;

            InitializeComponent();

            StreamStatusUpdatesSource = new CollectionViewSource {
                Source = State.StatusUpdates
            };
            MentionsStatusUpdatesSource = new CollectionViewSource {
                Source = State.StatusUpdates
            };

            StreamStatusUpdatesSource.SortDescriptions.Add(new SortDescription("ParentSortDate", ListSortDirection.Descending));
            StreamStatusUpdatesSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Ascending));
            StreamStatusUpdatesSource.View.Filter = StreamStatusUpdatesSourceFilter;

            MentionsStatusUpdatesSource.SortDescriptions.Add(new SortDescription("ParentSortDate", ListSortDirection.Descending));
            MentionsStatusUpdatesSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Ascending));
            MentionsStatusUpdatesSource.View.Filter = MentionsStatusUpdatesSourceFilter;

            DataContext = this;

            mailbox.InboxLoadComplete += delegate
            {
                StreamStatusUpdatesSource.View.Refresh();
                MentionsStatusUpdatesSource.View.Refresh();
            };

            EventBroker.Subscribe(AppEvents.SyncStatusUpdatesFinished, () => ThreadPool.QueueUserWorkItem(UpdateCountAsync));

            Responder.SetIsFirstResponder(SupportsMentions ? Stream2ListView : Stream1ListView, true);

            ThreadPool.QueueUserWorkItem(UpdateCountAsync);
        }
Beispiel #11
0
 public ContactMatcher(ChannelContact contact)
 {
     this.contact = contact;
     this.mailbox = VirtualMailBox.Current;
 }
 public SendMessageCommand(Message message)
 {
     this.message = message;
     this.mailbox = VirtualMailBox.Current;
 }
        public FoldersControl()
        {
            mailbox    = VirtualMailBox.Current;
            viewFilter = ViewFilter.Current;
            labels     = new ThreadSafeCollection <LabelsContainer>();

            LabelsViewSource = new CollectionViewSource {
                Source = labels
            };
            LabelsViewSource.SortDescriptions.Add(new SortDescription("Count", ListSortDirection.Descending));
            LabelsViewSource.View.Filter = IsLabelVisible;

            InitializeComponent();

            signal       = new AutoResetEvent(false);
            workerThread = new Thread(UpdateCounters)
            {
                Name         = "Counter update thread",
                IsBackground = true,
                Priority     = ThreadPriority.BelowNormal
            };

            workerThread.Start();

            DataContext = this;

            VirtualMailBox.Current.LoadComplete += delegate { UpdateCountersAsync(); };

            EventBroker.Subscribe(AppEvents.RebuildOverview, UpdateCountersAsync);
            EventBroker.Subscribe(AppEvents.ReceiveMessagesFinished, UpdateCountersAsync);
            EventBroker.Subscribe(AppEvents.MessageUpdated, UpdateCountersAsync);

            EventBroker.Subscribe(AppEvents.View, delegate(ActivityView view)
            {
                ClientState.Current.ViewController.MoveTo(WellKnownView.Overview);

                // Find the radio-button with the requested view
                LogicalTreeWalker.Walk(this, delegate(RadioButton rb)
                {
                    if (GetActivityView(rb) == view)
                    {
                        rb.IsChecked = true;
                    }
                });

                viewFilter.Filter.CurrentView = view;
                viewFilter.RebuildCurrentViewAsync();

                EventBroker.Publish(AppEvents.RequestFocus);
            });

            EventBroker.Subscribe(AppEvents.View, delegate(Label label)
            {
                EventBroker.Publish(AppEvents.View, ActivityView.Label);

                viewFilter.Filter.Label = label.Labelname;
                viewFilter.RebuildCurrentViewAsync();

                EventBroker.Publish(AppEvents.RequestFocus);
            });

            EventBroker.Subscribe(AppEvents.ShuttingDown, () => Thread.CurrentThread.ExecuteOnUIThread(delegate
            {
                // Save settings during shutdown
                SettingsManager.ClientSettings.AppConfiguration.ShowProductivityColumn = ProductivityExpander.IsExpanded;
                SettingsManager.ClientSettings.AppConfiguration.ShowLabelsColumn       = LabelsExpander.IsExpanded;
                SettingsManager.Save();
            }));

            EventBroker.Subscribe(AppEvents.LabelCreated, (string label) => labels.Add(new LabelsContainer(label)));
        }
Beispiel #14
0
 public UserStatusParser(ChannelConfiguration config)
 {
     this.config  = config;
     this.mailbox = VirtualMailBox.Current;
 }
Beispiel #15
0
 public ProfileMatcher(Message message)
 {
     this.message = message;
     this.mailbox = VirtualMailBox.Current;
 }
 public PurgeDataTask()
 {
     mailbox = VirtualMailBox.Current;
 }
Beispiel #17
0
 public RemoveChannelTask(ChannelConfiguration configuration, bool notify)
 {
     this.configuration = configuration;
     this.mailbox       = VirtualMailBox.Current;
     this.notify        = notify;
 }