public FFmpegCommandViewModel( IScreen hostScreen, ILogger <FFmpegCommandViewModel> logger, TaskListViewModel taskList) { HostScreen = hostScreen; _logger = logger; _taskList = taskList; CheckFFmpegStatusCommand = ReactiveCommand.CreateFromTask(CheckFFmpegStatusAsync); CutOpenFileCommand = ReactiveCommand.Create(CutOpenFile); CutSaveFileCommand = ReactiveCommand.Create(CutSaveFile); CutCommand = ReactiveCommand.Create(CreateCutVideoTask); ConvertOpenFileCommand = ReactiveCommand.Create(ConvertOpenFile); ConvertSaveFileCommand = ReactiveCommand.Create(ConvertSaveFile); ConvertCommand = ReactiveCommand.Create(CreateConvertVideoTask); this.WhenAnyValue(x => x.CutInput).Subscribe(_ => { NewOutputFile(); }); this.WhenAnyValue(x => x.ConvertInput).Subscribe(file => { if (Path.GetExtension(file) == @".flv") { ConvertOutput = Path.ChangeExtension(file, @"mp4"); } }); }
public FFmpegCommandViewModel( IScreen hostScreen, ILogger <FFmpegCommandViewModel> logger, TaskListViewModel taskList) { HostScreen = hostScreen; _logger = logger; _taskList = taskList; CheckFFmpegStatusCommand = ReactiveCommand.CreateFromTask(CheckFFmpegStatusAsync); CutOpenFileCommand = ReactiveCommand.Create(CutOpenFile); CutSaveFileCommand = ReactiveCommand.Create(CutSaveFile); CutCommand = ReactiveCommand.Create(CreateCutVideoTask); ConvertOpenFileCommand = ReactiveCommand.Create(ConvertOpenFile); ConvertSaveFileCommand = ReactiveCommand.Create(ConvertSaveFile); ConvertCommand = ReactiveCommand.Create(CreateConvertVideoTask); }
public LiveRecordListViewModel( IScreen hostScreen, ILogger <LiveRecordListViewModel> logger, Config config, SourceList <LiveRecordList> liveRecordSourceList, TaskListViewModel taskList, BilibiliApiClient apiClient) { HostScreen = hostScreen; _logger = logger; Config = config; _taskList = taskList; _liveRecordSourceList = liveRecordSourceList; _apiClient = apiClient; _roomIdMonitor = this .WhenAnyValue(x => x.Config.RoomId, x => x.TriggerLiveRecordListQuery) .Throttle(TimeSpan.FromMilliseconds(800), RxApp.MainThreadScheduler) .DistinctUntilChanged() .Where(i => i.Item1 > 0) .Select(i => i.Item1) .Subscribe(i => { GetAnchorInfoAsync(i).Forget(); GetRecordListAsync(i).Forget(); }); _liveRecordSourceList.Connect() .Transform(x => new LiveRecordViewModel(x)) .ObserveOnDispatcher() .Bind(out LiveRecordList) .DisposeMany() .Subscribe(); CopyLiveRecordDownloadUrlCommand = ReactiveCommand.CreateFromTask <object?>(CopyLiveRecordDownloadUrlAsync); OpenLiveRecordUrlCommand = ReactiveCommand.CreateFromObservable <object?, Unit>(OpenLiveRecordUrl); OpenDirCommand = ReactiveCommand.CreateFromObservable <object?, Unit>(OpenDir); DownLoadVideoCommand = ReactiveCommand.CreateFromObservable <object?, Unit>(DownloadVideo); DownLoadDanmuCommand = ReactiveCommand.CreateFromObservable <object?, Unit>(DownloadDanmu); }