Пример #1
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");
        }
Пример #2
0
        protected virtual bool CheckReadStates(Message message, ChannelMessageHeader header)
        {
            // Channel doesn't support readstates, no point in checking
            if (!config.Charasteristics.SupportsReadStates)
                return false;

            // Message has been marked for channel update, ignore for now
            if (message.TargetMessageState.HasValue)
                return false;

            // Check readstate of message
            if (header.IsRead)
            {
                if (!message.IsRead)
                    message.MarkRead(false);
            }
            else
            {
                if (message.IsRead)
                    message.MarkUnread(false);
            }

            if (header.IsStarred)
            {
                // Star
                if (!message.IsStarred)
                    message.SetStarred(false);
            }
            else
            {
                // Unstar
                if (message.IsStarred)
                    message.SetUnstarred(false);
            }

            return true;
        }
Пример #3
0
        public MessageDetailView()
        {
            InitializeComponent();

            EventBroker.Subscribe(AppEvents.ShuttingDown, () => Thread.CurrentThread.ExecuteOnUIThread(delegate
            {
                if (message != null)
                {
                    // Mark message as read if setting is enabled during shutdown
                    if (SettingsManager.ClientSettings.AppConfiguration.MarkReadWhenViewing)
                    {
                        message.MarkRead();
                    }
                }
            }));

            EventBroker.Subscribe(AppEvents.TabChanged, delegate(string newTab)
            {
                // Visual fix
                QuickReplyAll.Height = 40;
            });

            DataContext = this;
        }
        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");
        }