/// <summary> /// Adds a new price watch /// </summary> private void AddPriceWatch() { var priceWatch = new PriceWatch(); var priceWatchVm = new PriceWatchViewModel(priceWatch, null, this.controller, this.commerceService); this.controller.UserSettings.PriceWatches.Add(priceWatch); this.PriceWatches.Add(priceWatchVm); }
/// <summary> /// Default constructor /// </summary> /// <param name="modelData">The price watch model data</param> /// <param name="controller">Commerce controller</param> public PriceWatchViewModel(PriceWatch priceData, Item itemData, ICommerceController controller, ICommerceService service) { this.Data = priceData; this.ItemData = itemData; this.controller = controller; this.commerceService = service; this.CurrentBuyOrder = new Price(); this.CurrentSellListing = new Price(); this.ItemsProvider = new ItemResultsProvider(this.commerceService); if (this.ItemData != null) { this.SelectedItem = this.commerceService.ItemsDB[this.ItemData.ID]; } this.IsBuyOrderNotificationShown = false; this.IsSellListingNotificationShown = false; this.Data.PropertyChanged += Data_PropertyChanged; this.Data.BuyOrderUpperLimit.PropertyChanged += BuyOrderLimit_PropertyChanged; this.Data.BuyOrderLowerLimit.PropertyChanged += BuyOrderLimit_PropertyChanged; this.Data.SellListingUpperLimit.PropertyChanged += SellListingLimit_PropertyChanged; this.Data.SellListingLowerLimit.PropertyChanged += SellListingLimit_PropertyChanged; }