示例#1
0
        internal static MinerAccount Init()
        {
            // Attempt to read the GUID from the config file
            AccountIdentityFile accountIdentityFile = new AccountIdentityFile();
            var accountIdentity = accountIdentityFile.ReadJsonFromFile();

            var accountId = accountIdentity.AccountGuid;

            // Validate if a GUID was actually read
            if (accountId == Guid.Empty)
            {
                throw new Exception("Account Identity could not be found - you need to configure this node with an account id.");
            }


            AccountWalletAPI   accountWalletAPI   = new AccountWalletAPI();
            GPUSettingsAPI     gpuSettingsAPI     = new GPUSettingsAPI();
            WorkerSettingsFile workerSettingsFile = new WorkerSettingsFile();
            var workerSettings = workerSettingsFile.ReadJsonFromFile();

            return(new MinerAccount()
            {
                AccountId = accountId.ToString(),
                AccountWalletList = accountWalletAPI.GetAccountWalletList(accountId.ToString()),
                WorkerSettings = workerSettings,
                GPUSettingsList = gpuSettingsAPI.GetGPUSettings(accountId.ToString(), workerSettings.WorkerName)
            });
        }
示例#2
0
        public void PersistAccountWallet(object param)
        {
            try
            {
                if (Application.Current.Properties["AccountID"] != null)
                {
                    // Insert wallet addresses account
                    // API will override existing records
                    AccountWalletAPI accountWalletAPI = new AccountWalletAPI();
                    accountWalletAPI.PostAccountWalletList(accountWalletList);

                    // Notify UI of change
                    OnPropertyChanged("AccountWalletList");

                    // Set global variable for Wallet Addresses
                    Application.Current.Properties["AccountWalletList"] = accountWalletList;

                    notifier.ShowSuccess("Wallet settings saved");
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException(string.Format("Error saving wallet addresses"), e);
            }
        }
        /// <summary>
        /// Load list of wallet addresses account
        /// </summary>
        private void InitAccountWallet(object param)
        {
            try
            {
                if (Application.Current.Properties["AccountID"] != null)
                {
                    // Load list of wallet addresses account
                    AccountWalletAPI accountWalletAPI = new AccountWalletAPI();
                    AccountWalletList = accountWalletAPI.GetAccountWalletList();

                    // Notify UI of change
                    OnPropertyChanged("AccountWalletList");

                    // Set global variable for Wallet Address
                    Application.Current.Properties["AccountWalletList"] = accountWalletList;
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException(string.Format("Error loading wallet address"), e);
            }
        }