public AddPackagesDialog (
			AllPackagesViewModel viewModel,
			string initialSearch,
			IBackgroundPackageActionRunner backgroundActionRunner)
		{
			this.viewModel = viewModel;
			this.backgroundActionRunner = backgroundActionRunner;

			Build ();

			UpdatePackageSearchEntryWithInitialText (initialSearch);

			InitializeListView ();
			UpdateAddPackagesButton ();
			ShowLoadingMessage ();
			LoadViewModel (initialSearch);

			this.showPrereleaseCheckBox.Clicked += ShowPrereleaseCheckBoxClicked;
			this.packageSourceComboBox.SelectionChanged += PackageSourceChanged;
			this.addPackagesButton.Clicked += AddPackagesButtonClicked;
			this.packageSearchEntry.Changed += PackageSearchEntryChanged;
			this.packageSearchEntry.Activated += PackageSearchEntryActivated;
			this.packageVersionComboBox.SelectionChanged += PackageVersionChanged;
			imageLoader.Loaded += ImageLoaded;
		}
		public AddPackagesDialog (AllPackagesViewModel viewModel, string initialSearch = null)
			: this (
				viewModel,
				initialSearch,
				PackageManagementServices.BackgroundPackageActionRunner)
		{
		}
Ejemplo n.º 3
0
        public AllPackagesViewModel All()
        {
            var packages = _packageRepository.All().Include(p => p.Orders).To <PackageViewModel>().ToList();

            var model = new AllPackagesViewModel
            {
                Packages = packages
            };

            return(model);
        }
        public IHttpResponse Index()
        {
            var user = this.Db.Users.FirstOrDefault(x => x.Username == this.User.Username);

            if (user == null)
            {
                return(this.View());
            }
            else
            {
                var pendingPackages = this.Db.Packages
                                      .Where(x => x.UserId == user.Id && x.Status == Status.Pending)
                                      .Select(x => new PendingAndDeliveredViewModel
                {
                    Description = x.Description,
                    Id          = x.Id
                }).ToList();

                var shippedPackages = this.Db.Packages
                                      .Where(x => x.UserId == user.Id && x.Status == Status.Shipped)
                                      .Select(x => new ShippedViewModel
                {
                    Description = x.Description,
                    Id          = x.Id
                }).ToList();

                var deliveredPackages = this.Db.Packages
                                        .Where(x => x.UserId == user.Id && x.Status == Status.Delivered)
                                        .Select(x => new PendingAndDeliveredViewModel
                {
                    Description = x.Description,
                    Id          = x.Id
                }).ToList();

                var model = new AllPackagesViewModel();
                model.DeliveredPackages = deliveredPackages;
                model.PendingPackages   = pendingPackages;
                model.ShippedPackages   = shippedPackages;


                return(this.View("/Home/LoggedInIndex", model));
            }
        }
Ejemplo n.º 5
0
        public IHttpResponse Pending()
        {
            var pendingPackages = this.Db.Packages.Select(x =>
                                                          new PackageViewModel
            {
                Id              = x.Id,
                Weight          = x.Weight,
                Status          = x.Status,
                ShippingAddress = x.ShippingAddress,
                Description     = x.Description,
                Recipient       = x.Recipient.Username
            }).Where(x => x.Status == Status.Pending).ToList();

            if (pendingPackages.Count == 0)
            {
                return(this.BadRequestError("There are no packages"));
            }

            var model = new AllPackagesViewModel {
                Packages = pendingPackages
            };

            return(this.View(model));
        }
		protected override void Dispose (bool disposing)
		{
			imageLoader.Loaded -= ImageLoaded;
			imageLoader.Dispose ();

			RemoveSelectedPackagePropertyChangedEventHandler ();
			viewModel.PropertyChanged -= ViewModelPropertyChanged;
			viewModel.Dispose ();
			DisposeExistingTimer ();
			DisposePopulatePackageVersionsTimer ();
			packageStore.Clear ();
			viewModel = null;
			base.Dispose (disposing);
		}