示例#1
0
        public ProfitTables()
        {
            ExpandAll              = new RelayCommandLight(ExpandAllCommand);
            CollapseAll            = new RelayCommandLight(CollapseAllCommand);
            ExpandAll_AllWorkers   = new RelayCommandLight(ExpandAll_AllWorkersCommand);
            CollapseAll_AllWorkers = new RelayCommandLight(CollapseAll_AllWorkersCommand);

            SwitchAll             = new RelayCommandLight(SwitchAllCommand);
            SwitchNone            = new RelayCommandLight(SwitchNoneCommand);
            SwitchAll_AllWorkers  = new RelayCommandLight(SwitchAll_AllWorkersCommand);
            SwitchNone_AllWorkers = new RelayCommandLight(SwitchNone_AllWorkersCommand);

            RestartAll             = new RelayCommandLight(RestartAllCommand);
            RestartNone            = new RelayCommandLight(RestartNoneCommand);
            RestartAll_AllWorkers  = new RelayCommandLight(RestartAll_AllWorkersCommand);
            RestartNone_AllWorkers = new RelayCommandLight(RestartNone_AllWorkersCommand);
        }
示例#2
0
        // ViewModel constructor
        public ViewModel()
        {
            TestProperty = "TEST";

            IsInitializingWtm = true;

            ProfitTables = new ProfitTables {
                Tables = new ObservableCollection <ProfitTable>()
            };
            ProfitTables.Tables.CollectionChanged += ProfitTables_CollectionChanged;

            HistoricalCharts = new ObservableCollection <HistoricalChart>();

            // Read workers from file or create default
            Workers = Workers.ReadWorkers(false);
            if (Workers == null)
            {
                Workers        = new Workers(true).Clone();
                DefaultWorkers = true;
            }

            WorkersPropertyEventsAdd();

            // Read Wtm settings from file or create default settings
            WtmSettings = WtmSettingsObject.ReadWtmSettings(false);
            if (WtmSettings == null)
            {
                WtmSettings        = new WtmSettingsObject();
                DefaultWtmSettings = true;
            }

            WhatToMine.RequestInterval           = WtmSettings.WtmRequestInterval;
            WtmSettings.ServerSettingsAreUpdated = true;
            UpdateWtmHttpClient();

            WtmSwitchTimeFromStored          = WtmSettings.SwitchTimeFrom.Clone();
            WtmSwitchTimeToStored            = WtmSettings.SwitchTimeTo.Clone();
            WtmHistoricalAveragePeriodStored = WtmSettings.HistoricalAveragePeriod;
            WtmHistoryTimeFromStored         = WtmSettings.HistoryTimeFrom.Clone();
            WtmHistoryTimeToStored           = WtmSettings.HistoryTimeTo.Clone();

            HookUpWmtSettingsPropertyChangeEvents();

            SwitchTimeIsUpdated  = true;
            HistoryTimeIsUpdated = true;

            History = new History();

            ProfitTablesEnabled = true;

            Initialize            = new RelayCommandLight(InitializeCommand);
            AddWorker             = new RelayCommandLight(AddWorkerCommand);
            DeleteWorker          = new RelayCommandLight(DeleteWorkerCommand);
            NewWorker             = new RelayCommandLight(NewWorkerCommand);
            ExportWorkers         = new RelayCommandLight(ExportWorkersCommand);
            ImportWorkers         = new RelayCommandLight(ImportWorkersCommand);
            MultiplyHashrate      = new RelayCommandLight(MultiplyHashrateCommand);
            MoveWorker            = new RelayCommandLight(MoveWorkerCommand);
            CopyWorker            = new RelayCommandLight(CopyWorkerCommand);
            MoveWorkerDown        = new RelayCommandLight(MoveWorkerDownCommand);
            MoveWorkerUp          = new RelayCommandLight(MoveWorkerUpCommand);
            AddCoinTable          = new RelayCommandLight(AddCoinTableCommand);
            DeleteCoinTable       = new RelayCommandLight(DeleteCoinTableCommand);
            MoveCoinTable         = new RelayCommandLight(MoveCoinTableCommand);
            CopyCoinTable         = new RelayCommandLight(CopyCoinTableCommand);
            AddCoin               = new RelayCommandLight(AddCoinCommand);
            DeleteCoin            = new RelayCommandLight(DeleteCoinCommand);
            Save                  = new RelayCommandLight(SaveCommand);
            Undo                  = new RelayCommandLight(UndoCommand);
            Redo                  = new RelayCommandLight(RedoCommand);
            CalculateProfit       = new RelayCommandLight(CalculateProfitCommand, CalculateProfit_CanExecute);
            Export                = new RelayCommandLight(ExportCommand, Export_CanExecute);
            SwitchManually        = new RelayCommandLight(SwitchManuallyCommand, SwitchManually_CanExecute);
            ApplyAutoSwitch       = new RelayCommandLight(ApplyAutoSwitchCommand);
            ApplyHistoryBackup    = new RelayCommandLight(ApplyHistoryBackupCommand);
            EditKillList          = new RelayCommandLight(EditKillListCommand);
            GenerateRandomPort    = new RelayCommandLight(GenerateRandomPortCommand);
            ApplyServerSettings   = new RelayCommandLight(ApplyServerSettingsCommand);
            TestConnection        = new RelayCommandLight(TestConnectionCommand, TestConnection_CanExecute);
            LoadHistoricalCharts  = new RelayCommandLight(LoadHistoricalChartsCommand, CalculateProfit_CanExecute);
            LineSeriesSelectAll   = new RelayCommandLight(LineSeriesSelectAllCommand);
            LineSeriesSelectNone  = new RelayCommandLight(LineSeriesSelectNoneCommand);
            ScanLan               = new RelayCommandLight(ScanLanCommand);
            ScanLanStop           = new RelayCommandLight(ScanLanStopCommand);
            ClearProfitTables     = new RelayCommandLight(ClearProfitTablesCommand);
            MassUpdateApplication = new RelayCommandLight(MassUpdateApplicationCommand);
            MassUpdateWorkers     = new RelayCommandLight(MassUpdateWorkersCommand);
            MassUpdateWtmSettings = new RelayCommandLight(MassUpdateWtmSettingsCommand);
            AddCoinsByAlgorithm   = new RelayCommandLight(AddCoinsByAlgorithmCommand);
            UpdateCoins           = new RelayCommandLight(UpdateCoinsCommand);
            AddComputers          = new RelayCommandLight(AddComputersCommand);
            CancelWaiting         = new RelayCommandLight(CancelWaitingCommand);
            EditPath              = new RelayCommandLight(EditPathCommand);
            OpenInExplorer        = new RelayCommandLight(OpenInExplorerCommand);
            SortBy                = new RelayCommandLight(SortByCommand);

            WorkersExpandAll   = new RelayCommandLight(WorkersExpandAllCommand);
            WorkersCollapseAll = new RelayCommandLight(WorkersCollapseAllCommand);
            WorkerSelectAll    = new RelayCommandLight(WorkerSelectAllCommand);
            WorkerSelectNone   = new RelayCommandLight(WorkerSelectNoneCommand);
            WorkerQueryAll     = new RelayCommandLight(WorkerQueryAllCommand);
            WorkerQueryNone    = new RelayCommandLight(WorkerQueryNoneCommand);

            About = new RelayCommandLight(AboutCommand);
            Exit  = new RelayCommandLight(ExitCommand);
            Test  = new RelayCommandLight(TestCommand);

            Instance = this;
        } // end ViewModel constructor