Inheritance: LibraryBase.Wpf.ViewModel.BindableBase
        public MainWindowViewModel(MainWindow mainWindow)
        {
            this.MainWindow = mainWindow;
            MainWindowViewModel.Dispatcher = mainWindow.Dispatcher;

            HotItem.AddItemRequest += new EventHandler<EventArgs<HotItem>>(HotItemViewModel_AddItemRequest);
            HotItem.RemoveItemRequest += new EventHandler<EventArgs<HotItem>>(HotItemViewModel_RemoveItemRequest);

            _fileSaveProvider = new FileSaveViewModel();
            _fileSaveProvider.Filter = "CSV Files|*.csv";
            _fileSaveProvider.PathSelected += fileSave_PathSelected;

            _fileOpenProvider = new FileOpenViewModel();
            _fileOpenProvider.Filter = "CSV Files|*csv";
            _fileOpenProvider.PathSelected += _fileOpenProvider_PathSelected;

            HotItemController = new HotItemController();

            HotItemController.GuildWars2StatusChanged += HotItemController_GuildWars2StatusChanged;

            NotifiactionViewModel = new NotificationViewModel(this);

            SoldViewModel = new TransactionViewModel(this, TransactionType.Sold);
            SoldViewModel.DisplayName = "Sold Items";

            BoughtViewModel = new TransactionViewModel(this, TransactionType.Bought);
            BoughtViewModel.DisplayName = "Bought Items";

            BuyingViewModel = new TransactionViewModel(this, TransactionType.Buying);
            BuyingViewModel.DisplayName = "Buying Items";

            SellingViewModel = new TransactionViewModel(this, TransactionType.Selling);
            SellingViewModel.DisplayName = "Selling Items";

            MessageViewModel = new MessageViewModel(this);

            SettingsViewModel = new SettingsViewModel(HotItemController);
            SearchViewModel = new SearchViewModel(HotItemController, this);
            RecipeViewModel = new RecipeViewModel(HotItemController);
            ChartViewModel = new ChartViewModel(this);
            GemViewModel = new GemViewModel(this);

            LoadConfig();
            Config.IsTradingPostDataProvider = true;
            Config.FirstTimeStarted = false;
            HotItemController.Config = this.Config;
            HotItemController.StartWorker();

            //workerThread = new Thread(Worker);
            //workerThread.Start();

            //Timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, new EventHandler(timerTick), MainWindowViewModel.Dispatcher);
        }
Exemple #2
0
        public MainWindowViewModel(MainWindow mainWindow)
        {
            this.MainWindow = mainWindow;
            MainWindowViewModel.Dispatcher = mainWindow.Dispatcher;

            HotItem.AddItemRequest    += new EventHandler <EventArgs <HotItem> >(HotItemViewModel_AddItemRequest);
            HotItem.RemoveItemRequest += new EventHandler <EventArgs <HotItem> >(HotItemViewModel_RemoveItemRequest);

            _fileSaveProvider               = new FileSaveViewModel();
            _fileSaveProvider.Filter        = "CSV Files|*.csv";
            _fileSaveProvider.PathSelected += fileSave_PathSelected;

            _fileOpenProvider               = new FileOpenViewModel();
            _fileOpenProvider.Filter        = "CSV Files|*csv";
            _fileOpenProvider.PathSelected += _fileOpenProvider_PathSelected;

            HotItemController = new HotItemController();

            HotItemController.GuildWars2StatusChanged += HotItemController_GuildWars2StatusChanged;

            NotifiactionViewModel = new NotificationViewModel(this);

            SoldViewModel             = new TransactionViewModel(this, TransactionType.Sold);
            SoldViewModel.DisplayName = "Sold Items";

            BoughtViewModel             = new TransactionViewModel(this, TransactionType.Bought);
            BoughtViewModel.DisplayName = "Bought Items";

            BuyingViewModel             = new TransactionViewModel(this, TransactionType.Buying);
            BuyingViewModel.DisplayName = "Buying Items";

            SellingViewModel             = new TransactionViewModel(this, TransactionType.Selling);
            SellingViewModel.DisplayName = "Selling Items";

            MessageViewModel = new MessageViewModel(this);

            SettingsViewModel = new SettingsViewModel(HotItemController);
            SearchViewModel   = new SearchViewModel(HotItemController, this);
            RecipeViewModel   = new RecipeViewModel(HotItemController);
            ChartViewModel    = new ChartViewModel(this);
            GemViewModel      = new GemViewModel(this);

            LoadConfig();
            Config.IsTradingPostDataProvider = true;
            Config.FirstTimeStarted          = false;
            HotItemController.Config         = this.Config;
            HotItemController.StartWorker();

            //workerThread = new Thread(Worker);
            //workerThread.Start();

            //Timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, new EventHandler(timerTick), MainWindowViewModel.Dispatcher);
        }