public NewEntityViewModel(IDataService <TEntity> service, IDialogService dialogService) { this.Create = ReactiveCommand.CreateFromTask(() => service.Add(this.CreateEntity())); this.Create.Subscribe(entity => dialogService.Close(entity)); this.Cancel = ReactiveCommand.Create(() => dialogService.Close()); }
/// <summary> /// Initializes the specified torrent entity task. /// </summary> /// <param name="torrentEntityTask">The torrent entity task.</param> /// <param name="torrents">The torrents.</param> public async void Initialize(Task <TorrentEntity> torrentEntityTask, ObservableCollection <TorrentEntity> torrents) { try { _torrentTask = torrentEntityTask; Torrent = null; IsWorking = true; InfoText = Res.LoadingTorrentMetadata; Torrent = await torrentEntityTask; IsWorking = false; InfoText = string.Empty; if (Torrent == null) { Torrent = null; _dialogService.ShowMessageBox(Res.InvalidTorrent, messageBoxImage: MessageBoxImage.Error); } else if (torrents.Any(t => t.TorrentUri.Equals(_torrent.TorrentUri))) { Torrent = null; _dialogService.ShowMessageBox(Res.TorrentAlreadyExist, messageBoxImage: MessageBoxImage.Error); } } catch (Exception) { Torrent = null; InfoText = string.Empty; IsWorking = false; _dialogService.ShowMessageBox(Res.InvalidTorrent, messageBoxImage: MessageBoxImage.Error); _dialogService.Close(this); } }
public EditEntityViewModel(IDataService <TEntity> dataService, IDialogService dialogService) { this.DataService = dataService; this.Apply = ReactiveCommand.CreateFromTask(() => dataService.Update(this.Entity)); this.Apply.Subscribe(_ => dialogService.Close(this.Entity)); this.Cancel = ReactiveCommand.Create(() => dialogService.Close()); this.WhenAnyValue(o => o.Value). Where(entity => entity != null). Subscribe(async entity => this.Entity = await dataService.GetById(entity.Id)); }
private void Close() { dialogService.Close(dialogViewModel); dialogViewModel = null; ShowCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); }
private void finish(bool changeNote) { if (changeNote) { _changed = true; _note.Text = _text; } _dialogService.Close(this); }
/// <summary> /// Saves the and close. /// </summary> public void SaveAndClose() { var settings = new ApplicationSettings { DownloadFolderPath = DownloadFolderPath, StopTorrentsWhenFinished = StopTorrentsWhenFinished, TurtleModeUploadLimit = UploadLimit.Equals("Unlimited") ? 0 : int.Parse(UploadLimit) * 1000, TurtleModeDownloadLimit = DownloadLimit.Equals("Unlimited") ? 0 : int.Parse(DownloadLimit) * 1000 }; _appSettingsService.ApplyNewValues(settings); _appSettingsService.SaveChanges(); _dialogService.Close(this); }
public DialogViewModel(IDialogService dialogService) { this.DialogService = dialogService; this.Close = ReactiveCommand.Create(() => dialogService.Close()); }
private void Close() { dialogService.Close(dialogViewModel); dialogViewModel = null; }
public void Close() { _dialogService.Close(this); }
public void ForceToCloseDialog() { dialogService.Result = true; dialogService.Close(); }
private void CancelCommandExecute() { dialogService.Close(); }
private void ButtonClose_Click(object sender, RoutedEventArgs e) { dialogService.Close(); }
private void finish(bool confirm) { _accepted = confirm; _dialogService.Close(this); }
private void finish() { _dialogService.Close(this); }
private void finish(bool createTab) { _createTab = createTab; _dialogService.Close(this); }