public MainWindowViewModel() { GuiModelData = new GuiModel { GitHubToken = ConfigSetGet.GetConfigData("GitHubToken") }; GuiModelData.PropertyChanged += guiModelDataPropertyChanged; _gitHubDownloader = new GitHubDownloader(GuiModelData) { Finished = url => { addLog(string.Format("Finished {0}.", url)); _isStarted = false; } }; StartCommand = new DelegateCommand <string>(doStart, canDoStart); StopCommand = new DelegateCommand <string>(doStop, stat => true); AppMessenger.Messenger.Register <string>("ShowLog", log => addLog(log)); manageAppExit(); }
public MainWindowViewModel() { GuiState = new GuiModel { GitHubToken = PersistentConfig.GetConfigData("GitHubToken") }; GuiState.WhenAnyValue(p => p.RepositoryFolderFullUrl) .Throttle(TimeSpan.FromMilliseconds(250)) .Subscribe(_ => ValidateAndExecuteURL(_)); _gitHubDownloader = new GitHubDownloader(GuiState) { Finished = url => { Trace.WriteLine($"Finished {url}.", "Info"); DispatcherHelper.DispatchAction(() => GuiState.HasStarted = false); } }; StartCommand = ReactiveCommand.Create(() => StartDownload(), CanStartDownloadExecute); StopCommand = ReactiveCommand.Create(() => StopDownload()); OpenFolderCommand = ReactiveCommand.Create(() => GetSaveFolder()); }