Exemplo n.º 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");
        }