예제 #1
0
        public WhisperWindow(Conversation conversation, Participant participant, SeriousBusinessCat seriousBusiness, string info)
        {
            this.conversation    = conversation;
            this.participant     = participant;
            this.seriousBusiness = seriousBusiness;

            InitializeComponent();

            this.DataContext = this;

            InitCommands();

            this.Activated += (s, e) => { FlashWindow.Stop(this); };

            lbWhispers.ItemsSource = _whispers;

            string bob = "neighbor cat";

            if (participant != null)
            {
                bob = participant.Contact.GetContactInformation(ContactInformationType.DisplayName).ToString();
            }

            textBlock.Text = bob;

            if (!string.IsNullOrEmpty(info))
            {
                textBlock.ToolTip = info;
            }

            this.Title = $"Whispering with {bob}";

            FocusManager.SetFocusedElement(this, tbMessage);
        }
예제 #2
0
        public void AddWhisper(Whisper whisper)
        {
            this.Dispatcher.Invoke(() => {
                _whispers.Add(whisper);

                if (IsLoaded)
                {
                    var border       = (Border)VisualTreeHelper.GetChild(lbWhispers, 0);
                    var scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(border, 0);
                    scrollViewer.ScrollToBottom();

                    if (!whisper.IsSelf && !this.IsActive)
                    {
                        FlashWindow.Flash(this);
                    }
                }
            });
        }