public MainWindowViewModel() { Logger.Info("Initializing..."); // DB Context (SQLite) var context = new MainDbContext(); // Create ViewModel collection from the models Companies = context.Companies .ToObservable() .Select(x => new CompanyViewModel(x)) .ToReactiveCollection(); // SelectFileCommand is fired from click event of button through EventToReactiveCommand. // SelectedFilename will be set after a file selected from OpenFileDialog through OpenFileDialogConverter. SelectedFilename = SelectFileCommand .Select(filename => filename) .ToReadOnlyReactiveProperty(); // ReactiveCommand (can execute when SelectedFilename is set) StartCommand = SelectedFilename.Select(x => !string.IsNullOrWhiteSpace(x)).ToReactiveCommand <string>(); StartCommand.Subscribe(async _ => { var res = await ConfirmationRequest.RaiseAsync(new Confirmation { Title = "Demo", Content = "Are you sure?" }); if (res.Confirmed) { await NotificationRequest.RaiseAsync(new Notification { Title = "Demo", Content = "Done!" }); } }); Logger.Info("Initialized."); }
public MainWindowVM(IUIService uIService) { MediaEnded = new RoutedCommand(ProcessMediaEnded); _playProcessor = new PlayProcessor(); _playProcessor.CurrentVideoSourceChanged += PlayProcessorCurrentVideoSourceChanged; _uiService = uIService; LoadSchedule = new SelectFileCommand(uIService, ProcessLoadScheduleFile); }
public Files(SQLiteConnection connection) { _connection = connection; _insertFile = new InsertFileCommand(_connection); _deleteFile = new DeleteFileCommand(_connection); _selectFile = new SelectFileCommand(_connection); _touchFile = new TouchFileCommand(_connection); _clean = new CleanCommand(_connection); }
public ValidationViewModel() { IsWorking = false; SelectRequirement = new SelectFileCommand(RequirementFileInfo, this); SelectSubmission = new SelectFileCommand(SubmissionFileInfo, this) { IncludeIfc = true }; SelectReport = new SelectReportFileCommand(ReportFileInfo, this); ExportOnValidated = false; OpenOnExported = false; Validate = new ValidateCommand(this); ExportFacility = new FacilitySaveCommand(this); ValidateAndSave = new ValidateAndSaveCommand(this); SaveModelFacility = new SubmittedFacilitySaveCommand(this); }