Exemplo n.º 1
0
 /// <inheritdoc />
 protected override void OnViewModelChanged()
 {
     if (ChatMessageList != null)
     {
         var storyboard = new Storyboard();
         storyboard.AddFadeIn(1);
         storyboard.Begin(ChatMessageList);
         MessageText.Focus();
     }
 }
Exemplo n.º 2
0
        protected override void OnViewModelChanged()
        {
            if (ChatMessageList == null)
            {
                return;
            }

            var storyboard = new Storyboard();

            storyboard.AddFadeIn(1, @from: true);
            storyboard.Begin(ChatMessageList);

            MessageText.Focus();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Fired when viewmodel changes
        /// </summary>
        protected override void OnViewModelChanged()
        {
            //make sure UI exists
            if (ChatMessageList == null)
            {
                return;
            }
            var storyboard = new Storyboard();

            storyboard.AddFadeIn(1);
            storyboard.Begin(ChatMessageList);

            //make the message text box focused
            MessageText.Focus();
        }
Exemplo n.º 4
0
        protected override void OnViewModelChanged()
        {
            if (ChatMessageList == null)
            {
                return;
            }

            // fade in chat messages list
            var storyboard = new Storyboard();

            //storyboard.AddFadeIn(1);
            storyboard.Begin(ChatMessageList);

            // set focus to message box
            MessageText.Focus();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Fired when the view model changes
        /// </summary>
        protected override void OnViewModelChanged()
        {
            // Make sure UI exists first
            if (ChatMessageList == null)
            {
                return;
            }

            // Fade in chat message list
            var storyboard = new Storyboard();

            storyboard.AddFadeIn(1, from: true);
            storyboard.Begin(ChatMessageList);

            // Make the message box focused
            MessageText.Focus();
        }
Exemplo n.º 6
0
 private void MessageText_DragDrop(object sender, DragEventArgs e)
 {
     MessageText.SelectedText = "[" + dragColumn + "] ";
     MessageText.Focus();
 }
Exemplo n.º 7
0
 private void ColumnsGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     MessageText.SelectedText = "[" + ColumnsGrid.CurrentRow.Cells[0].Value.ToString() + "] ";
     MessageText.Focus();
 }
Exemplo n.º 8
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            if (MessageText.Text.Length == 0)
            {
                return;
            }

            ShowProgressBar(AppResources.Chat_ProgressSendingMessage);

            sendButton.IsEnabled = false;

            try {
                gtalk.SendMessage(to, MessageText.Text, data => Dispatcher.BeginInvoke(() => {
                    HideProgressBar();

                    var bubble       = new SentChatBubble();
                    bubble.Text      = MessageText.Text;
                    bubble.TimeStamp = DateTime.Now;

                    App.Current.GtalkHelper.AddRecentContact(currentContact);

                    MessageList.Children.Add(bubble);

                    sendButton.IsEnabled = true;

                    MessageList.UpdateLayout();
                    Scroller.UpdateLayout();
                    Scroller.ScrollToVerticalOffset(Scroller.ExtentHeight);

                    lock (chatLog) {
                        while (chatLog.Count >= GoogleTalkHelper.MaximumChatLogSize)
                        {
                            chatLog.RemoveAt(0);
                        }
                        chatLog.Add(new Message {
                            Body     = MessageText.Text,
                            Outbound = true,
                            Time     = DateTime.Now,
                            OTR      = otr
                        });
                    }

                    MessageText.Text = "";
                    // Refocus text box to reset text suggestions.
                    // Only refocus is it's currently focused.
                    if (System.Windows.Input.FocusManager.GetFocusedElement() == MessageText)
                    {
                        this.Focus();
                        MessageText.Focus();
                    }

                    FlurryWP7SDK.Api.LogEvent("Chat - Chat sent");
                }), error => {
                    HideProgressBar();
                    if (error.StartsWith("403"))
                    {
                        settings.Remove("token");
                        settings.Remove("rootUrl");
                        gtalkHelper.LoginIfNeeded();
                    }
                    else
                    {
                        Dispatcher.BeginInvoke(
                            () => {
                            sendButton.IsEnabled = true;
                            gtalkHelper.ShowToast(AppResources.Chat_ErrorMessageNotSent);
                        }
                            );
                    }
                });
            } catch (InvalidOperationException) {
                Dispatcher.BeginInvoke(
                    () => {
                    HideProgressBar();
                    MessageBox.Show(
                        AppResources.Chat_ErrorAuthExpiredBody,
                        AppResources.Chat_ErrorAuthExpiredTitle,
                        MessageBoxButton.OK
                        );
                    App.Current.RootFrame.Navigate(new Uri("/Pages/Login.xaml", UriKind.Relative));
                }
                    );
            }
        }
Exemplo n.º 9
0
 private void Border_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     MessageText.Focus();
 }