Esempio n. 1
0
        private void LeaveChat_Click(object sender, EventArgs e)
        {
            try
            {
                var op = new MessagesRemoveChatUser(App.Current.EntityService.CurrentUser.UserInfo.Uid, _currentId, isOk =>
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        if (!isOk)
                        {
                            MessageBox.Show(AppResources.CantRemoveThisUser);
                        }
                        else
                        {
                            try
                            {
                                App.Current.EntityService.UpdateDialogs();
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine("LeaveChat_Click->UpdateDialogs failed in ChatSettingsPage: " + ex.Message);
                            }

                            NavigationService.Navigate(new Uri(@"/Views/DialogsPage.xaml", UriKind.Relative));
                        }
                    });
                });
                op.Execute();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("LeaveChat_Click failed:" + ex.Message);
            }
        }
Esempio n. 2
0
        private void RemoveChatFriend_Click(object sender, EventArgs e)
        {
            var selected = _friends.Where(x => x.IsSelected);

            if (selected != null && selected.Any())
            {
                foreach (var user in selected)
                {
                    var op = new MessagesRemoveChatUser(user.Uid, _currentId, isOk =>
                    {
                        Dispatcher.BeginInvoke(() =>
                        {
                            if (isOk)
                            {
                                try
                                {
                                    _friends.Remove(user);
                                }
                                catch (Exception ex)
                                {
                                    Debug.WriteLine("RemoveChatFriend_Click failed:" + ex.Message + Environment.NewLine + ex.StackTrace);
                                }
                            }
                            else
                            {
                                MessageBox.Show(AppResources.CantRemoveThisUser);
                            }
                        });
                    });
                    op.Execute();
                }
            }
        }
Esempio n. 3
0
        private void LeaveChat_Click(object sender, EventArgs e)
        {
            try
            {
                var op = new MessagesRemoveChatUser(App.Current.EntityService.CurrentUser.UserInfo.Uid, _id, isOk =>
                {
                    if (!isOk)
                    {
                        MessageBox.Show(AppResources.CantRemoveThisUser);
                    }
                    else
                    {
                        // TODO Remove this dialog?? Clear history of this chat??
                        App.Current.EntityService.UpdateDialogs();

                        NavigationService.Navigate(new Uri(@"/Views/DialogsPage.xaml", UriKind.Relative));
                    }
                });
                op.Execute();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("LeaveChat_Click failed:" + ex.Message);
            }
        }