public void PhotoSearchServiceCallback(PhotoSearchServiceResult photoSearchServiceResult) { //this.writeLogLine("status: " + status + " result: " + result); if (this.OnServiceCallBack != null) { PhotoSearchServiceCallBackEventArgs args = new PhotoSearchServiceCallBackEventArgs() { Result = photoSearchServiceResult }; this.OnServiceCallBack(this, args); } }
private void Context_OnServiceCallBack(object sender, PhotoSearchServiceCallBackEventArgs e) { this.IsJobRunning = false; PhotoSearchServiceResult serviceResult = e.Result; if (serviceResult.Type == PhotoSearchServiceResultType.OK) { Application.Current.Dispatcher.BeginInvoke(new Action(() => this.view.webBrowser.NavigateToString(serviceResult.Data.ToString()))); Application.Current.Dispatcher.BeginInvoke(new Action(() => this.resultHtml = serviceResult.Data.ToString())); } else if (serviceResult.Type == PhotoSearchServiceResultType.Cancel) { Application.Current.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(this.view, "Выполнение задачи прервано", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Exclamation))); } else if (serviceResult.Type == PhotoSearchServiceResultType.Confirmation) { MessageBoxResult dialogResult = MessageBoxResult.No; Application.Current.Dispatcher.Invoke(new Action(() => dialogResult = MessageBox.Show(serviceResult.Data.ToString() + Environment.NewLine + "Продолжить?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No))); if (dialogResult == MessageBoxResult.Yes) { this.startJob(true); } } else { Application.Current.Dispatcher.Invoke(new Action(() => MessageBox.Show(this.view, serviceResult.Data.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error))); } this.raiseCanExecuteChanged(); }
private void executeGetPersonsCommand(object obj) { try { Mouse.OverrideCursor = Cursors.Wait; if (this.family != null) { this.family = this.family.Trim(); } if (this.name != null) { this.name = this.name.Trim(); } GetPhotoFromKaskadParams jobParams = new GetPhotoFromKaskadParams(); jobParams.Family = this.family; jobParams.Name = this.name; jobParams.Birthday = this.birthday; jobParams.OperationDateStart = this.operationDateStart; jobParams.OperationDateEnd = operationDateEnd; jobParams.MashineName = Environment.MachineName; PhotoSearchServiceResult serviceResult = this.proxy.GetFhotoFromKaskad(jobParams); if (serviceResult.Type == PhotoSearchServiceResultType.Error) { Mouse.OverrideCursor = null; MessageBox.Show(this.view, serviceResult.Data.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; } //int count = dbWorker.GetBorderCrossedPersonsCount(this.family, this.name); //List<Person> list = dbWorker.GetBorderCrossedPersons(this.family, this.name, MAX_PERSONS_COUNT); List <Person> list = dbWorker.GetBorderCrossedPersons(this.family , this.name , this.birthday , this.operationDateStart , this.operationDateEnd , MAX_PERSONS_COUNT); if (list != null) { list.Sort((x, y) => x.FullName.CompareTo(y.FullName)); } this.Persons = list; Mouse.OverrideCursor = null; if (list.Count == MAX_PERSONS_COUNT) { MessageBox.Show(this.view, "Превышено допустимое количество записей." + " Чтобы получить точный результат, пожалуйста, скорректируйте параметры запроса.", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } } catch (FaultException <string> exception) { Mouse.OverrideCursor = null; MessageBox.Show(this.view, exception.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception error) { Mouse.OverrideCursor = null; MessageBox.Show(this.view, error.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }