public PackageControl(IPackageControlViewModel viewModel, IPackageViewModel packageViewModel) { if (viewModel == null) { throw new ArgumentNullException("viewModel"); } InitializeComponent(); viewModel.Package = packageViewModel; DataContext = viewModel; }
public async void UpdatePackageLists(string id, Uri source, IPackageViewModel newPackage, SemanticVersion version) { if (newPackage != null) { this.AddPackageEntry(newPackage.Id, newPackage.Version, source); } this.NotifyPackagesChanged(PackagesChangedEventType.Installed, id, version == null ? string.Empty : version.ToString()); await this.ProgressService.StopLoading(); }
public static async Task<IPackageViewModel> EnsureIsLoaded(IPackageViewModel viewModel, Uri source) { var service = GetFeed(source); var feedQuery = (DataServiceQuery<V2FeedPackage>)service.Packages.Where(package => package.Id == viewModel.Id && package.Version == viewModel.Version.ToString()); var result = await Task.Factory.FromAsync(feedQuery.BeginExecute, ar => feedQuery.EndExecute(ar), null); var v2FeedPackages = result as IList<V2FeedPackage> ?? result.ToList(); if (result == null || !v2FeedPackages.Any()) { return null; } var packageInfo = v2FeedPackages.Single(); return AutoMapper.Mapper.Map(packageInfo, viewModel); }
public static async Task <IPackageViewModel> EnsureIsLoaded(IPackageViewModel vm, Uri source) { var service = GetFeed(source); var feedQuery = (DataServiceQuery <V2FeedPackage>)service.Packages.Where(package => package.Id == vm.Id && package.Version == vm.Version.ToString()); var result = await Task.Factory.FromAsync(feedQuery.BeginExecute, ar => feedQuery.EndExecute(ar), null); var v2FeedPackages = result as IList <V2FeedPackage> ?? result.ToList(); if (result == null || !v2FeedPackages.Any()) { return(null); } var packageInfo = v2FeedPackages.Single(); return(AutoMapper.Mapper.Map(packageInfo, vm)); }
public void PopulatePackages(IPackageViewModel packageInfo, ICollection <IPackageViewModel> packages) { if (packages == null) { throw new ArgumentNullException("packages"); } var packageConfigEntry = this.PackageConfigEntries() .FirstOrDefault( entry => string.Compare(entry.Id, packageInfo.Id, StringComparison.OrdinalIgnoreCase) == 0 && entry.Version == packageInfo.Version); if (packageConfigEntry != null) { packageInfo.Source = packageConfigEntry.Source; } packages.Add(packageInfo); }
public void PopulatePackages(IPackageViewModel packageInfo, ICollection<IPackageViewModel> packages) { if (packages == null) { throw new ArgumentNullException("packages"); } var packageConfigEntry = this.PackageConfigEntries() .FirstOrDefault( entry => string.Compare(entry.Id, packageInfo.Id, StringComparison.OrdinalIgnoreCase) == 0 && entry.Version == packageInfo.Version); if (packageConfigEntry != null) { packageInfo.Source = packageConfigEntry.Source; } packages.Add(packageInfo); }
public ShowPackageDetailsMessage(IPackageViewModel package) { Package = package; }
public PackageChangedMessage(IPackageViewModel package, PackageChangeType changeType, SemanticVersion version = null) { Package = package; ChangeType = changeType; Version = version; }
public static Task <IPackageViewModel> EnsureIsLoaded(IPackageViewModel viewModel) { return(Task.Run(() => viewModel)); }
public static Task <IPackageViewModel> EnsureIsLoaded(IPackageViewModel vm, Uri source) { return(TaskEx.Run(() => vm)); }
public async Task <IPackageViewModel> EnsureIsLoaded(IPackageViewModel vm, Uri source = null) { await _progressService.StartLoading("Loading Package Information"); _progressService.WriteMessage("Loading remote package information..."); // If we don't have a source, iterate through our source until we find one that matches. if (source == null) { var defaultSourceVm = _sourceService.GetDefaultSource(); var defaultSource = new Uri(defaultSourceVm.Url); if (defaultSource.Scheme == "http" || defaultSource.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(vm, defaultSource); if (result != null) { await _progressService.StopLoading(); result.Source = defaultSource; return(result); } } foreach (var sourceViewModel in _sourceService.GetSources()) { var currentSource = new Uri(sourceViewModel.Url); if (currentSource.Scheme == "http" || currentSource.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(vm, currentSource); if (result == null) { continue; } await _progressService.StopLoading(); result.Source = currentSource; return(result); } } } else { if (source.Scheme == "http" || source.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(vm, source); await _progressService.StopLoading(); if (result != null) { result.Source = source; } return(result); } if (source.IsFile || source.IsUnc) { await _progressService.StopLoading(); return(null); } } await _progressService.StopLoading(); return(null); }
public static Task<IPackageViewModel> EnsureIsLoaded(IPackageViewModel viewModel) { return Task.Run(() => viewModel); }
public PackageControl(IPackageControlViewModel vm, IPackageViewModel packageViewModel) { InitializeComponent(); vm.Package = packageViewModel; DataContext = vm; }
public async Task<IPackageViewModel> EnsureIsLoaded(IPackageViewModel viewModel, Uri source = null) { await this._progressService.StartLoading("Loading Package Information"); this._progressService.WriteMessage("Loading remote package information..."); // If we don't have a source, iterate through our source until we find one that matches. if (source == null) { var defaultSourceVm = this._sourceService.GetDefaultSource(); var defaultSource = new Uri(defaultSourceVm.Url); if (defaultSource.Scheme == "http" || defaultSource.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(viewModel, defaultSource); if (result != null) { await this._progressService.StopLoading(); result.Source = defaultSource; return result; } } foreach (var sourceViewModel in this._sourceService.GetSources()) { var currentSource = new Uri(sourceViewModel.Url); if (currentSource.Scheme == "http" || currentSource.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(viewModel, currentSource); if (result == null) { continue; } await this._progressService.StopLoading(); result.Source = currentSource; return result; } } } else { if (source.Scheme == "http" || source.Scheme == "https") { var result = await ODataPackageService.EnsureIsLoaded(viewModel, source); await this._progressService.StopLoading(); if (result != null) { result.Source = source; } return result; } if (source.IsFile || source.IsUnc) { await this._progressService.StopLoading(); return null; } } await this._progressService.StopLoading(); return null; }