示例#1
0
        public PriceListViewModel(ICommerceController commerceController)
        {
            this.controller       = commerceController;
            this.ConfigureCommand = new DelegateCommand(() => Commands.OpenCommerceSettingsCommand.Execute(null));

            var collectionViewSource = new AutoRefreshCollectionViewSource();

            collectionViewSource.Source = this.controller.ItemPrices;
            this.ItemPrices             = collectionViewSource;

            switch (this.UserData.PriceTrackerSortProperty)
            {
            case CommerceUserData.PRICE_TRACKER_SORT_NAME:
                this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_NAME, ListSortDirection.Ascending);
                break;

            case CommerceUserData.PRICE_TRACKER_SORT_BUY_PRICE:
                this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_BUY_PRICE, ListSortDirection.Ascending);
                break;

            case CommerceUserData.PRICE_TRACKER_SORT_SALE_PRICE:
                this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_SALE_PRICE, ListSortDirection.Ascending);
                break;

            case CommerceUserData.PRICE_TRACKER_SORT_PROFIT:
                this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_PROFIT, ListSortDirection.Descending);
                break;

            default:
                this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_NAME, ListSortDirection.Ascending);
                break;
            }
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="controller">The commerce controller</param>
 public PriceNotificationWindow(ICommerceController controller)
 {
     this.controller  = controller;
     this.viewModel   = new PriceNotificationsViewModel(this.controller);
     this.DataContext = this.viewModel;
     InitializeComponent();
     this.Loaded += (o, e) => this.LoadWindowLocation();
 }
        public MonitoredItemsConfigViewModel(ICommerceService commerceService, ICommerceController controller)
        {
            this.commerceService = commerceService;
            this.controller      = controller;

            this.ItemsProvider = new ItemResultsProvider(this.commerceService);
            this.ItemToAdd     = new ItemPriceViewModel(new PriceWatch(), new Item(-1, null), this.controller, this.commerceService);
        }
示例#4
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public PriceNotificationConfigView(ICommerceService commerceService, ICommerceController controller)
        {
            logger.Debug("New PriceNotificationConfigView created");
            this.controller  = controller;
            this.viewModel   = new PriceNotificationConfigViewModel(commerceService, controller);
            this.DataContext = this.viewModel;
            InitializeComponent();

            // Set the window size and location
            this.Closing += TPCalculatorView_Closing;
        }
示例#5
0
        /// <summary>
        /// Notifies the module that it has be initialized.
        /// </summary>
        public void Initialize()
        {
            logger.Debug("Initializing Commerce Module");

            this.commerceController = this.container.GetExportedValue <ICommerceController>();
            this.viewController     = this.container.GetExportedValue <ICommerceViewController>();

            // Register for shutdown
            Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.Shutdown));

            // Get the commerce controller started
            this.commerceController.Start();

            // Initialize the view controller
            this.viewController.Initialize();

            logger.Debug("Commerce Module initialized");
        }
示例#6
0
        /// <summary>
        /// Notifies the module that it has be initialized.
        /// </summary>
        public void Initialize()
        {
            logger.Debug("Initializing Commerce Module");

            this.commerceController = this.container.GetExportedValue<ICommerceController>();
            this.viewController = this.container.GetExportedValue<ICommerceViewController>();

            // Register for shutdown
            Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.Shutdown));

            // Get the commerce controller started
            this.commerceController.Start();

            // Initialize the view controller
            this.viewController.Initialize();

            logger.Debug("Commerce Module initialized");
        }
示例#7
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="modelData">The price watch model data</param>
        /// <param name="controller">Commerce controller</param>
        public ItemPriceViewModel(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.CurrentProfit      = new Price();
            this.PastBuyOrders      = new ObservableCollection <DataPoint>();
            this.PastSellListings   = new ObservableCollection <DataPoint>();

            this.IsBuyOrderNotificationShown    = false;
            this.IsSellListingNotificationShown = false;

            this.IsBuyOrderOutOfLimits    = false;
            this.IsSellListingOutOfLimits = 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;
        }
示例#8
0
        /// <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;
        }
示例#9
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="modelData">The price watch model data</param>
        /// <param name="controller">Commerce controller</param>
        public ItemPriceViewModel(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.CurrentProfit = new Price();
            this.PastBuyOrders = new ObservableCollection<DataPoint>();
            this.PastSellListings = new ObservableCollection<DataPoint>();

            this.IsBuyOrderNotificationShown = false;
            this.IsSellListingNotificationShown = false;

            this.IsBuyOrderOutOfLimits = false;
            this.IsSellListingOutOfLimits = 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;
        }
示例#10
0
        public PriceListViewModel(ICommerceController commerceController)
        {
            this.controller = commerceController;
            this.ConfigureCommand = new DelegateCommand(() => Commands.OpenCommerceSettingsCommand.Execute(null));

            var collectionViewSource = new AutoRefreshCollectionViewSource();
            collectionViewSource.Source = this.controller.ItemPrices;
            this.ItemPrices = collectionViewSource;

            switch (this.UserData.PriceTrackerSortProperty)
            {
                case CommerceUserData.PRICE_TRACKER_SORT_NAME:
                    this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_NAME, ListSortDirection.Ascending);
                    break;
                case CommerceUserData.PRICE_TRACKER_SORT_BUY_PRICE:
                    this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_BUY_PRICE, ListSortDirection.Ascending);
                    break;
                case CommerceUserData.PRICE_TRACKER_SORT_SALE_PRICE:
                    this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_SALE_PRICE, ListSortDirection.Ascending);
                    break;
                case CommerceUserData.PRICE_TRACKER_SORT_PROFIT:
                    this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_PROFIT, ListSortDirection.Descending);
                    break;
                default:
                    this.OnSortingPropertyChanged(CommerceUserData.PRICE_TRACKER_SORT_NAME, ListSortDirection.Ascending);
                    break;
            }
        }
示例#11
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="controller">The commerce controller</param>
 public PriceNotificationsViewModel(ICommerceController controller)
 {
     this.controller = controller;
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="controller">The commerce controller</param>
 public PriceNotificationConfigViewModel(ICommerceService commerceService, ICommerceController controller)
 {
     this.commerceService = commerceService;
     this.controller      = controller;
 }
 public PriceNotificationsViewModel(ICommerceController controller)
 {
     this.controller = controller;
 }
        public MonitoredItemsConfigViewModel(ICommerceService commerceService, ICommerceController controller)
        {
            this.commerceService = commerceService;
            this.controller = controller;

            this.ItemsProvider = new ItemResultsProvider(this.commerceService);
            this.ItemToAdd = new ItemPriceViewModel(new PriceWatch(), new Item(-1, null), this.controller, this.commerceService);
        }