コード例 #1
0
ファイル: Keyboard.cs プロジェクト: Klaudit/inbox2_desktop
        public static void Initialize()
        {
            _Flipper = new Flipper(TimeSpan.FromMilliseconds(300), delegate { });

            InterceptKeys.Hook();
            InterceptKeys.KeyPressed += InterceptKeys_KeyPressed;
        }
コード例 #2
0
        public SearchDockControl()
        {
            InitializeComponent();

            searchFlipper = new Flipper(TimeSpan.FromMilliseconds(500), ExecuteSearch);

            DataContext = this;
        }
コード例 #3
0
ファイル: Column.xaml.cs プロジェクト: Klaudit/inbox2_desktop
        public Column()
        {
            InitializeComponent();

            DataContext = this;

            selectionFlipper = new Flipper(TimeSpan.FromMilliseconds(400),
                    () => State.SelectedPersons.ReplaceWithCast(ContactsListView.SelectedItems));
        }
コード例 #4
0
        public StreamView()
        {
            using (new CodeTimer("StreamView/Constructor"))
            {
                InitializeComponent();

                selection = new List<Message>();
                dropHelper = new DropHelper(StreamListView);
                dropHelper.Drop += StreamListView_Drop;

                DataContext = this;

                viewFilter = ViewFilter.Current;
                viewFilter.Filter.FilterChanged += State_CurrentViewChanged;

                selectionFlipper = new Flipper(TimeSpan.FromMilliseconds(200),
                    () => State.SelectedMessages.ReplaceWithCast(StreamListView.SelectedItems));

                EventBroker.Subscribe(AppEvents.RebuildOverview,
                    () => Thread.CurrentThread.ExecuteOnUIThread(CreateChannelsSelection));

                VirtualMailBox.Current.InboxLoadComplete += delegate
                    {
                        using (new ThreadFlag())
                            StreamListView.SelectedIndex = 0;
                    };

                EventBroker.Subscribe(AppEvents.TabChanged, delegate(string newTab)
                    {
                        if (newTab == "DockControl")
                        {
                            // Switched to overview
                            isOverviewActive = true;

                            if (selection.Count > 0)
                                State.SelectedMessages.Replace(selection);
                        }
                        else
                        {
                            // Switched to any other tab
                            if (isOverviewActive)
                            {
                                // Save selection
                                selection.Clear();
                                selection.AddRange(State.SelectedMessages);
                            }

                            isOverviewActive = false;
                        }
                    });
            }
        }
コード例 #5
0
        public LabelsEditorControl()
        {
            InitializeComponent();

            InputCommands.Stub(this);

            _flipper = new Flipper(TimeSpan.FromMilliseconds(400), CheckExistingLabel);

            // If labels are updated from elsewhere in the message we are currently viewing
            // (and we are not the one causing the updated), rebuild the labels
            subscription = EventBroker.Subscribe(AppEvents.MessageLabelsUpdated,
                (Message message) => Thread.CurrentThread.ExecuteOnUIThread(delegate
                  	{
                  		if (message == Message && !Editor.IsFocused)
                  			Reset();
                  	}));
        }
コード例 #6
0
        public ConversationsState()
        {
            viewFilter = ViewFilter.Current;

            ActivityViewSource = new CollectionViewSource { Source = viewFilter.Messages };
            SelectedMessages = new AdvancedObservableCollection<Message>();

            SelectedMessages.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedMessage");

                OnSelectionChanged();
            };

            flipper = new Flipper(TimeSpan.FromSeconds(25), delegate
                {
                    // Todo run readstates syncornization if no receive task is currently running
                });
        }
コード例 #7
0
        public RecipientsEditorControl()
        {
            InitializeComponent();

            InputCommands.Stub(this);

            mailbox = VirtualMailBox.VirtualMailBox.Current;
            recipients = new AdvancedObservableCollection<SourceAddress>();

            wordFlipper = new Flipper(TimeSpan.FromMilliseconds(400), ProcessCurrentWord);
            autocompleteFlipper = new Flipper(TimeSpan.FromMilliseconds(500), SearchContacts);

            // Default the validation is enabled
            ValidationEnabled = true;

            DataContext = this;

            var channel = ChannelsManager.GetDefaultChannel();

            if (channel != null)
                TargetChannel = channel;
        }
コード例 #8
0
        public void Show(Message message)
        {
            // This is for our fake message
            if (message.MessageId < 0)
                return;

            this.message = message;

            QuickReplyAll.Text = String.Empty;

            // if document hasn't loaded (the first time), loadcomplete will take care of show for us
            if (initialized)
                BuildAndShowMessage();

            // When message is shown due to system selection, do not track the read action
            if (!ThreadFlag.IsSet)
                message.TrackAction(ActionType.Read);

            if (flipper != null)
                flipper.Dispose();

            // Mark message read if after setting is enabled
            var markReadAFter = SettingsManager.ClientSettings.AppConfiguration.MarkReadWhenViewingAfter;

            if (markReadAFter.HasValue)
            {
                flipper = new Flipper(TimeSpan.FromSeconds(markReadAFter.Value), delegate
                {
                    if (!message.IsRead)
                        message.MarkRead();
                });

                flipper.Delay();
            }
            else if (SettingsManager.ClientSettings.AppConfiguration.MarkReadWhenViewing)
                message.MarkRead();

            OnPropertyChanged("Message");
        }