Example #1
0
        private void ShowSellViewExecute()
        {
            var sellView = new SellView();

            sellView.ShowDialog();
            var allAuctions = auctionService.GetAll();
            var newAuctions = allAuctions.Where(a => auctions.All(vm => vm.Auction != a));

            foreach (var auction in newAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                auctions.Add(auctionVm);
            }
        }
Example #2
0
        private void loadAuctions()
        {
            this.Auctions = new ObservableCollection <AuctionViewModel>();
            var allAuctions = ServiceLocator.GetInstance.GetAuctionService.GetAll();

            foreach (var auction in allAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                this.Auctions.Add(auctionVm);
            }
            //var auctionViewModels = from auction in ServiceLocator.GetInstance.GetAuctionService.GetAll()
            //                        select new AuctionViewModel(auction);
            //this.Auctions = new ObservableCollection<AuctionViewModel>(auctionViewModels);
            this.RaisePropertyChanged(nameof(this.Auctions));
        }
Example #3
0
        private void AddNewAuctionAction()
        {
            var sellView = new SellView();
            sellView.ShowDialog(); // Blocking

            // Find & add new auction
            var allAuctions = this.auctionService.GetAll().ToList();
            var newAuctions = allAuctions.Where(a => this.auctions.All(vm => vm.Auction != a));

            foreach (var auction in newAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                this.auctions.Add(auctionVm);
            }
        }
Example #4
0
        private void AddNewAuctionAction()
        {
            var sellView = new SellView();

            sellView.ShowDialog(); // Blocking

            // Find & add new auction
            var allAuctions = this.auctionService.GetAll().ToList();
            var newAuctions = allAuctions.Where(a => this.auctions.All(vm => vm.Auction != a));

            foreach (var auction in newAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                this.auctions.Add(auctionVm);
            }
        }
Example #5
0
        public MainViewModel(IAuctioneer auctioneer, IAuctionService auctionService)
        {
            this.auctioneer = auctioneer;
            this.auctionService = auctionService;

            this.AddNewAuctionCommand = new RelayCommand(this.AddNewAuctionAction);

            // Register for Events
            this.auctioneer.AuctionEnded += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.AuctionStarted += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.BidAccepted += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.BidDeclined += (sender, args) => { this.ApplyChanges(args.Auction); };

            // Setup UI
            var allAuctions = this.auctionService.GetAll();
            foreach (var auction in allAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                this.auctions.Add(auctionVm);
            }
        }
Example #6
0
        public MainViewModel(IAuctioneer auctioneer, IAuctionService auctionService)
        {
            this.auctioneer     = auctioneer;
            this.auctionService = auctionService;

            this.AddNewAuctionCommand = new RelayCommand(this.AddNewAuctionAction);

            // Register for Events
            this.auctioneer.AuctionEnded   += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.AuctionStarted += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.BidAccepted    += (sender, args) => { this.ApplyChanges(args.Auction); };
            this.auctioneer.BidDeclined    += (sender, args) => { this.ApplyChanges(args.Auction); };

            // Setup UI
            var allAuctions = this.auctionService.GetAll().ToList();

            foreach (var auction in allAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                this.auctions.Add(auctionVm);
            }
        }
Example #7
0
        public MainViewModel(IAuctioneer auctioneer, IAuctionService auctionService)
        {
            var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

            this.auctionService = auctionService;
            auctions            = new ObservableCollection <AuctionViewModel>();

            // register for events
            auctioneer.AuctionEnded   += (sender, args) => { ApplyChanges(args.Auction); };
            auctioneer.AuctionStarted += (sender, args) => { ApplyChanges(args.Auction); };
            auctioneer.BidAccepted    += (sender, args) => { ApplyChanges(args.Auction); };
            auctioneer.BidDeclined    += (sender, args) => { ApplyChanges(args.Auction); };

            // populate auctions list
            var allAuctions = auctionService.GetAll();

            foreach (var auction in allAuctions)
            {
                var auctionVm = new AuctionViewModel(auction);
                Auctions.Add(auctionVm);
            }
        }