public CreateGistFileViewModel(GistViewModel parent, IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) : base(parent, gistClientService, asyncOperationStatusManager, errorHandler) { FileNameChangedCommand = new AsyncCommand <string>(CreateGistFileAsync, asyncOperationStatusManager, errorHandler) { ExecutionInfo = "Creating gist file" }; }
public GistManagerWindowViewModel(IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) { this.gistClientService = gistClientService ?? throw new ArgumentNullException(nameof(gistClientService)); this.AsyncOperationStatusManager = asyncOperationStatusManager ?? throw new ArgumentNullException(nameof(asyncOperationStatusManager)); this.ErrorHandler = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler)); Gists = new ObservableRangeCollection <GistViewModel>(); PublicFilterCommand = new RelayCommand <FilterEventArgs>(FilterPublicGists, errorHandler); PrivateFilterCommand = new RelayCommand <FilterEventArgs>(FilterPrivateGists, errorHandler); LoginCommand = new AsyncRelayCommand(LoginAsync, () => !IsAuthenticated, asyncOperationStatusManager, ErrorHandler) { ExecutionInfo = "Logging in", SuppressCompletionCommand = true }; CreatePublicGistCommand = new CreateGistCommand(e => InitCreate(e.Content, true), errorHandler); CreatePrivateGistCommand = new CreateGistCommand(e => InitCreate(e.Content, false), errorHandler); CreateGistFileCommand = new CreateGistFileCommand(e => InitCreate(e.Content, e.ParentGist), errorHandler); RemoveGistCommand = new RelayCommand <GistViewModel>(g => Gists.Remove(g), errorHandler); RefreshCommand = new AsyncRelayCommand(RefreshAsync, () => IsAuthenticated, asyncOperationStatusManager, ErrorHandler) { ExecutionInfo = "Refreshing gists", SuppressCompletionCommand = true }; LogoutCommand = new AsyncRelayCommand(LogoutAsync, () => IsAuthenticated, asyncOperationStatusManager, ErrorHandler) { ExecutionInfo = "Logging out", SuppressCompletionCommand = true }; this.AsyncOperationStatusManager.CompletionCommand = new AsyncRelayCommand(this.RefreshAsync, asyncOperationStatusManager, ErrorHandler) { ExecutionInfo = "Refreshing gists", SuppressCompletionCommand = true }; }
public GistFileViewModel(GistFileModel file, GistViewModel parent, IGistClientService gistClientService, IAsyncOperationStatusManager commandStatusManager, IErrorHandler errorHandler) : this(parent, gistClientService, commandStatusManager, errorHandler) { this.GistFile = file; fileName = file.Name; History = new ObservableRangeCollection <GistHistoryEntryViewModel>(); Url = file.Url; DeleteGistFileCommand = new AsyncRelayCommand(DeleteGistFileAsync, commandStatusManager, errorHandler) { ExecutionInfo = "Deleting file from gist" }; CopyGistFileUrlCommand = new RelayCommand(CopyGistFileUrl, errorHandler); }
public GistFileViewModel(IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) { GistClientService = gistClientService ?? throw new ArgumentNullException(nameof(gistClientService)); this.asyncOperationStatusManager = asyncOperationStatusManager ?? throw new ArgumentNullException(nameof(asyncOperationStatusManager)); FileNameChangedCommand = new AsyncCommand <string>(RenameGistFileAsync, asyncOperationStatusManager, errorHandler) { ExecutionInfo = "Renaming gist file" }; CheckoutCommand = new AsyncCommand <GistHistoryEntryModel>(RefreshGistFileAsync, asyncOperationStatusManager, errorHandler) { ExecutionInfo = "Checking out file", SuppressCompletionCommand = true }; }
protected GistViewModel(string name, IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) { this.asyncOperationStatusManager = asyncOperationStatusManager ?? throw new ArgumentNullException(nameof(asyncOperationStatusManager)); GistClientService = gistClientService ?? throw new ArgumentNullException(nameof(gistClientService)); Name = name; Files = new ObservableRangeCollection <GistFileViewModel>(); History = new ObservableRangeCollection <GistHistoryEntryViewModel>(); DeleteGistCommand = new AsyncRelayCommand(DeleteGistAsync, asyncOperationStatusManager, errorHandler) { ExecutionInfo = "Deleting gist" }; CopyGistUrlCommand = new RelayCommand(CopyGistUrl, errorHandler); }
public CreateGistViewModel(bool isPublic, string content, IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) : base(gistClientService, asyncOperationStatusManager, errorHandler) { Public = isPublic; IsExpanded = true; Name = string.Empty; CreateGistCommand = new AsyncCommand(CreateGistAsync, asyncOperationStatusManager, errorHandler) { ExecutionInfo = "Creating gist" }; createGistFileViewModel = new CreateGistFileInnerViewModel(this, gistClientService, asyncOperationStatusManager, errorHandler) { Content = content, FileName = string.Empty, IsInEditMode = true, IsSelected = true }; createGistFileViewModel.PropertyChanged += PropertyChangedAsync; Files.Add(createGistFileViewModel); }
public GistViewModel(GistModel gist, IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) : this(gist.Name, gistClientService, asyncOperationStatusManager, errorHandler) { Gist = gist; Description = gist.Description; Public = gist.IsPublic; Url = gist.Url; var files = new List <GistFileViewModel>(gist.Files.Count); foreach (var file in gist.Files) { var gistFileViewModel = new GistFileViewModel(file, this, gistClientService, asyncOperationStatusManager, errorHandler); gistFileViewModel.History.AddRange(gist.History.Select(h => new GistHistoryEntryViewModel(h, gistFileViewModel))); files.Add(gistFileViewModel); } Files.AddRange(files); History.AddRange(gist.History.Select(h => new GistHistoryEntryViewModel(h, this))); History.First().IsCheckedOut = true; }
public GistFileViewModel(GistViewModel parent, IGistClientService gistClientService, IAsyncOperationStatusManager commandStatusManager, IErrorHandler errorHandler) : this(gistClientService, commandStatusManager, errorHandler) { ParentGist = parent; }
public CreateGistFileInnerViewModel(GistViewModel parent, IGistClientService gistClientService, IAsyncOperationStatusManager commandStatusManager, IErrorHandler errorHandler) : base(parent, gistClientService, commandStatusManager, errorHandler) { FileNameChangedCommand = null; }
public GistViewModel(IGistClientService gistClientService, IAsyncOperationStatusManager asyncOperationStatusManager, IErrorHandler errorHandler) : this((string)null, gistClientService, asyncOperationStatusManager, errorHandler) { }