Пример #1
0
        private void SendFeedback()
        {
            try
            {
                object focusObj = FocusManager.GetFocusedElement();
                if (focusObj != null && focusObj is TextBox)
                {
                    var binding = (focusObj as TextBox).GetBindingExpression(TextBox.TextProperty);
                    binding.UpdateSource();
                    (focusObj as TextBox).IsEnabled = false;
                    (focusObj as TextBox).IsEnabled = true;
                    return;
                } 


                IsBusy = true;
                CapitalServiceClient client = new CapitalServiceClient();
                client.SendFeedbackCompleted += (s, e) => 
                {
                    IsBusy = false;
                    if (e.Error != null)
                        MessageBox.Show("Error sending feedback.", "Error", MessageBoxButton.OK);
                    else
                    {
                        MessageBoxResult result = MessageBox.Show("Thank You!");

                        Messenger.Default.Send(new NavigateBackMessage());
                    }
                };

                client.SendFeedbackAsync(new Feedback { 
                        Message = this.Message, 
                        ReportType = FeedbackItems[SelectedFeedbackIndex], 
                        UserId = GetUser().UserId });
            }
            catch
            {

            }
        }