/// <summary>
        /// Initializes a new instance of the MainWindowViewModel class
        /// </summary>
        /// <param name="listingsService">the listing service to use</param>
        /// <param name="dispatcher">the dispatcher to use</param>
        public MainWindowViewModel(IListingsService listingsService, Dispatcher dispatcher)
        {
            this.dispatcher = dispatcher;
            this.listingsService = listingsService;

            this.listingsService.GetFrontFeaturedListingsCompleted += this.FrontFeaturedListingsReceived;

            this.StatusText = "Etsy Gui";
        }
        public ListingsController(ReuseventoryDbContext ctx, ILogger <ListingsController> logger, IListingsService listingService)
        {
            _ctx            = ctx;
            _logger         = logger;
            _listingService = listingService;

            if (_ctx.Listings.Count() == 0)
            {
                for (int user = 0; user < 20; user++)
                {
                    _ctx.Users.Add(new User()
                    {
                        username = "******" + user,
                        password = "******",
                        phone    = DateTime.UtcNow.Ticks.ToString().Substring(8),
                        email    = "test_user_" + user + "@gmail.com",
                        isAdmin  = false
                    });
                }
                _ctx.SaveChanges();

                Random r     = new Random(DateTime.Now.Millisecond);
                int    count = _ctx.Users.Count();
                for (int listing = 0; listing < 100; listing++)
                {
                    ICollection <ListingTag> tags = new List <ListingTag>();
                    int numTags = r.Next(5);
                    for (int t = 0; t < numTags; t++)
                    {
                        tags.Add(
                            new ListingTag()
                        {
                            name = "tag_" + r.Next(35)
                        }
                            );
                    }

                    _ctx.Listings.Add(new Listing()
                    {
                        name        = "listing_" + listing,
                        userId      = _ctx.Users.ToList()[r.Next(count)].id,
                        description = "This is a brief description of the item.",
                        tags        = tags
                    });
                }

                _ctx.SaveChanges();
            }
        }
        /// <summary>
        /// Initializes a new instance of the DispatchedListingsService class
        /// </summary>
        /// <param name="wrappedService">the wrapped service</param>
        /// <param name="dispatcher">the thread dispatcher</param>
        public DispatchedListingsService(IListingsService wrappedService, Dispatcher dispatcher)
            : base(dispatcher)
        {
            if (wrappedService == null)
            {
                throw new ArgumentNullException("wrappedService");
            }

            this.wrappedService = wrappedService;

            this.wrappedService.GetAllListingsCompleted += (s, e) => this.DispatchEvent(this.GetAllListingsCompleted, s, e);
            this.wrappedService.GetListingDetailsCompleted += (s, e) => this.DispatchEvent(this.GetListingDetailsCompleted, s, e);
            this.wrappedService.GetListingsByCategoryCompleted += (s, e) => this.DispatchEvent(this.GetListingsByCategoryCompleted, s, e);
            this.wrappedService.GetListingsByColorAndKeywordsCompleted += (s, e) => this.DispatchEvent(this.GetListingsByColorAndKeywordsCompleted, s, e);
            this.wrappedService.GetFrontFeaturedListingsCompleted += (s, e) => this.DispatchEvent(this.GetFrontFeaturedListingsCompleted, s, e);
            this.wrappedService.GetListingsByColorCompleted += (s, e) => this.DispatchEvent(this.GetListingsByColorCompleted, s, e);
            this.wrappedService.GetListingsByKeywordCompleted += (s, e) => this.DispatchEvent(this.GetListingsByKeywordCompleted, s, e);
            this.wrappedService.GetListingsByMaterialsCompleted += (s, e) => this.DispatchEvent(this.GetListingsByMaterialsCompleted, s, e);
            this.wrappedService.GetListingsByTagsCompleted += (s, e) => this.DispatchEvent(this.GetListingsByTagsCompleted, s, e);
        }
 /// <summary>
 /// Initializes a new instance of the MaterialsListingsViewModel class.
 /// </summary>
 /// <param name="listingsService">the listings service</param>
 public MaterialsListingsViewModel(IListingsService listingsService)
     : base(listingsService)
 {
     this.ListingsService.GetListingsByMaterialsCompleted += this.ListingsReceived;
     this.MakeCommands();
 }
 public ListingsApiController(IListingsService listingService, IUserService UserService)
 {
     _listingService = listingService;
     _userService    = UserService;
 }
Exemple #6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="service"></param>
 /// <param name="logger"></param>
 public ListingsController(ILogger logger, IListingsService service) : base(logger)
 {
     _service = service;
 }
 /// <summary>
 /// Initializes a new instance of the KeywordsListingsViewModel class.
 /// </summary>
 /// <param name="listingsService">the listings service</param>
 public KeywordsListingsViewModel(IListingsService listingsService)
     : base(listingsService)
 {
     this.ListingsService.GetListingsByKeywordCompleted += this.ListingsReceived;
     this.MakeCommands();
 }
 public ListingsController(ILogger <ListingsController> logger, IListingsService listingsService)
 {
     _logger          = logger;
     _listingsService = listingsService;
 }
Exemple #9
0
 public ListingsController()
 {
     _listingsService = ServiceProxy.Create <IListingsService>(new Uri("fabric:/Ticketing/Ticketing.Listings.Service"));
 }