예제 #1
0
 public BaseViewModel(ICredentialService service)
 {
     CredentialService = service;
     WalletModel       = new WalletModel();
     RecoverFailed     = Visibility.Hidden;
     RecoverSuccess    = Visibility.Hidden;
 }
예제 #2
0
        public async Task TransactionService_Updates_Wallet_New_Transaction()
        {
            DateTime now = DateTime.UtcNow;

            UserModel user = new UserModel("Test User", new DateTime(), "*****@*****.**", "password", api.Enums.Currency.Euro);

            user._id  = "1234567891234567891234";
            user.Role = "user";

            WalletModel wallet = new WalletModel("Unit Test", 0, true, 100, null, api.Enums.WalletColor.Green, now);

            wallet._id = "1234567891234567891234";
            wallet.DateOffsetBalance = new List <DateOffsetBalance>();

            user.Wallets.Add(wallet);

            TransactionModel transaction = new TransactionModel(user._id, wallet._id, 100, DateTime.UtcNow, api.Enums.TransactionCategory.Dental, "unit test", "Dentist", "Cavity repair");

            TransactionService service   = new TransactionService();
            WalletModel        newWallet = await service.UpdateWalletForNewTransaction(user, transaction);

            newWallet.Balance.Should().Be(0);
            newWallet.LastUpdated.Should().NotBeOnOrBefore(now);
            newWallet.DateOffsetBalance.Should().NotBeNull();
        }
        public async Task <WalletModel[]> Handle(GetWalletsByOwnerId request, CancellationToken cancellationToken)
        {
            var wallets = await _context.Wallets
                          .Include(x => x.Moneys)
                          .Where(x => x.OwnerId == request.OwnerId)
                          .ToListAsync(cancellationToken);

            var response = new List <WalletModel>();

            foreach (var wallet in wallets)
            {
                WalletModel model = new WalletModel
                {
                    Id          = wallet.Id,
                    Name        = wallet.Name,
                    CreatedDate = wallet.CreatedDate,
                    OwnerId     = wallet.OwnerId,
                    UpdatedDate = wallet.UpdatedDate
                };
                if (wallet.Moneys.Any())
                {
                    // Cüzdandaki paralar kur bazlı gruplanıyor.
                    model.Moneys = wallet.Moneys
                                   .GroupBy(money => money.CurrencyCode, money => money, (key, items) => new MoneyModel
                    {
                        Amount       = items.Sum(y => y.Amount),
                        CurrencyCode = key
                    }).ToArray();
                }

                response.Add(model);
            }

            return(response.ToArray());
        }
예제 #4
0
        public async Task RemoveWalletAsync()
        {
            WalletModel wallet = _mapper.Map <WalletModel>(SelectedWallet);
            await _walletEndPoint.Remove(wallet);

            await LoadWallets();
        }
예제 #5
0
        private async void ExecuteRecoverWallet()
        {
            try
            {
                string      recoverPhraseHash = Generators.GenerateRecPhraseHash(RecoverPhrase);
                WalletModel recoveredWallet   = FileTools.DecryptWallet(_path, recoverPhraseHash);

                // Decrypting the File was a success
                // We set the recovered wallet as the active wallet and then
                // prompt the user to set a new password for the recovered wallet
                string title   = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Success_Title");
                string message = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Success_Message").Replace("*name*", _walletname);
                await _rwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                Messenger.Default.Send <WalletModel>(recoveredWallet, "OpenSetPasswordView");
                this.ExecuteCloseView();
                Messenger.Default.Send <WalletModel>(recoveredWallet, "ChangeActiveWallet");
            }
            catch
            {
                string title   = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Incorrect_Title");
                string message = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Incorrect_Message");
                await _rwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);
            }
        }
예제 #6
0
        public static void UpdateWalletFile(WalletModel newWallet)
        {
            string path         = newWallet.FileLocation;
            string recoveryPath = newWallet.FileRecover;

            if (File.Exists(path) && File.Exists(recoveryPath))
            {
                // set wallet files to normal for editing/updating purposes
                File.SetAttributes(recoveryPath, FileAttributes.Normal);
                File.SetAttributes(path, FileAttributes.Normal);

                FileTools.EncryptWallet(newWallet, newWallet.PassHash, path);
                FileTools.EncryptWallet(newWallet, newWallet.RecoveryPhraseHash, recoveryPath);

                // reapply defensive settings
                FileDefense(path);
                FileDefense(recoveryPath, true);
            }
            else
            {
                // Wallet Files did not update...Wallet Files do not exist at specified location
                string message = TextTools.RetrieveStringFromResource("Error_A300");
                Messenger.Default.Send <string>(message, "OpenSimpleDialogView");
            }
        }
예제 #7
0
        public static bool EncryptWallet(WalletModel wallet, string sKey, string path)
        {
            try
            {
                using (FileStream fsEncrypted = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    AesCryptoServiceProvider AES = new AesCryptoServiceProvider();

                    // AES key size uses 256 bit (32 byte) encryption
                    // AES iv size uses 128 (16 byte) encryption
                    AES.KeySize   = 256;
                    AES.BlockSize = 128;

                    AES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
                    AES.IV  = ASCIIEncoding.ASCII.GetBytes(sKey.Substring(0, 16));

                    ICryptoTransform desencrypt = AES.CreateEncryptor();
                    using (CryptoStream cryptostream = new CryptoStream(fsEncrypted, desencrypt, CryptoStreamMode.Write))
                    {
                        Hashtable data = Generators.Wallet2HashTable(wallet);

                        IFormatter formatter = new BinaryFormatter();
                        formatter.Serialize(cryptostream, data);
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #8
0
        public ActionResult AddBalance(WalletModel walletModel)
        {
            walletModel.AddBalance(CurrentUserId);
            _walletHistory.CreateBalanceHistory(walletModel);

            return(RedirectToAction("Index"));
        }
예제 #9
0
 private void ClearProps()
 {
     _wallet = null;
     CurrPass.Clear();
     NewPass.Clear();
     ConfPass.Clear();
 }
        public async Task IncomeService_Updates_Wallet_Updated_Income_Increase()
        {
            DateTime now = DateTime.UtcNow;

            UserModel user = new UserModel("Test User", new DateTime(), "*****@*****.**", "password", api.Enums.Currency.Euro);

            user._id  = "1234567891234567891234";
            user.Role = "user";

            WalletModel wallet = new WalletModel("Unit Test", 0, true, 100, null, api.Enums.WalletColor.Green, now);

            wallet._id = "1234567891234567891234";
            wallet.DateOffsetBalance = new List <DateOffsetBalance>();
            wallet.DateOffsetBalance.Add(new DateOffsetBalance(DateTime.UtcNow, 100));

            user.Wallets.Add(wallet);

            IncomeModel oldIncome = new IncomeModel(user._id, wallet._id, 100, DateTime.UtcNow, "unit test");
            IncomeModel newIncome = new IncomeModel(user._id, wallet._id, 120, DateTime.UtcNow, "unit test");

            IncomeService service   = new IncomeService();
            WalletModel   newWallet = await service.UpdateWalletForUpdatedIncome(user, newIncome, oldIncome);

            newWallet.Balance.Should().Be(120);
            newWallet.LastUpdated.Should().NotBeOnOrBefore(now);
            newWallet.DateOffsetBalance.Should().NotBeNull();
        }
예제 #11
0
        public async Task RecurringTransactionService_Updates_Wallet_Updated_RecurringTransaction_Increase()
        {
            DateTime now = DateTime.UtcNow;

            UserModel user = new UserModel("Test User", new DateTime(), "*****@*****.**", "password", api.Enums.Currency.Euro);

            user._id  = "1234567891234567891234";
            user.Role = "user";

            WalletModel wallet = new WalletModel("Unit Test", 0, true, 490, null, api.Enums.WalletColor.Green, now);

            wallet._id = "1234567891234567891234";
            wallet.DateOffsetBalance = new List <DateOffsetBalance>();
            wallet.DateOffsetBalance.Add(new DateOffsetBalance(DateTime.UtcNow, 490));

            user.Wallets.Add(wallet);

            RecurringTransactionModel oldRecurringTransactionModel = new RecurringTransactionModel(user._id, wallet._id, "Netflix", 100, 27, api.Enums.TransactionCategory.Entertainment, api.Enums.RecurringType.Subscription);
            RecurringTransactionModel newRecurringTransactionModel = new RecurringTransactionModel(user._id, wallet._id, "Netflix", 110, 27, api.Enums.TransactionCategory.Entertainment, api.Enums.RecurringType.Subscription);

            RecurringTransactionService service = new RecurringTransactionService();
            WalletModel newWallet = await service.UpdateWalletForUpdatedRecurringTransaction(user, newRecurringTransactionModel, oldRecurringTransactionModel);

            newWallet.Balance.Should().Be(480);
            newWallet.LastUpdated.Should().NotBeOnOrBefore(now);
            newWallet.DateOffsetBalance.Should().NotBeNull();
        }
예제 #12
0
 public int UpdateWalletEntry(WalletModel aWalletEntry)
 {
     lock (locker)
     {
         return(dbConn.Update(aWalletEntry));
     }
 }
예제 #13
0
        private async void ChangeActiveWallet(WalletModel wallet)
        {
            if (MainWallet == null)
            {
                this.SetupWallet(wallet);
                return;
            }
            else if (MainWallet.Equals(wallet))
            {
                string             titleSame   = TextTools.RetrieveStringFromResource("Main_Dialog_SameWallet_Title");
                string             messageSame = TextTools.RetrieveStringFromResource("Main_Dialog_SameWallet_Message");
                MessageDialogStyle styleSame   = MessageDialogStyle.Affirmative;
                await _mview.ShowMessageAsync(titleSame, messageSame, styleSame);

                return;
            }

            string             title   = TextTools.RetrieveStringFromResource("Main_Dialog_ActiveWallet_Title");
            string             message = TextTools.RetrieveStringFromResource("Main_Dialog_ActiveWallet_Message");
            MessageDialogStyle style   = MessageDialogStyle.AffirmativeAndNegative;

            var result = await _mview.ShowMessageAsync(title, message, style);

            if (result == MessageDialogResult.Affirmative)
            {
                this.CloseWallet();
                this.SetupWallet(wallet);
            }
        }
예제 #14
0
        public WalletModel GetWallet(string apiKey, string fiatCurrencyToDisplayValues)
        {
            WalletModel         model    = new WalletModel();
            List <BalanceModel> balances = new List <BalanceModel>();

            foreach (var currency in _currencyService.GetSupportedCurrencies(apiKey))
            {
                Random randomAmount = new Random();

                BalanceModel item = new BalanceModel()
                {
                    Currency = currency,
                    Amount   = (decimal)(randomAmount.NextDouble() * randomAmount.Next(0, 999999)),
                    FiatCurrencyToDisplay = fiatCurrencyToDisplayValues
                };

                item.ValueInCurrencyToDisplay = randomAmount.Next(1, 10) * item.Amount;

                balances.Add(item);
            }

            model.Balances          = balances.OrderByDescending(b => b.ValueInCurrencyToDisplay);
            model.CurrentCelBalance = (decimal?)398264.123;
            return(model);
        }
예제 #15
0
 public int SaveWalletEntry(WalletModel aWalletEntry)
 {
     lock (locker)
     {
         return(dbConn.Insert(aWalletEntry));
     }
 }
예제 #16
0
        public void DeleteWallet(WalletModel wallet, string userId)
        {
            SqlDataAccess sql = new SqlDataAccess(_config);
            var           p   = new { WalletName = wallet.WalletName, UserId = userId };

            sql.Execute("spWallets_RemoweWallet", p, "FinAppData");
        }
예제 #17
0
        public void DeleteWallet(WalletModel wallet)
        {
            WalletData data   = new WalletData(_config);
            string     userid = User.FindFirstValue(ClaimTypes.NameIdentifier);

            data.DeleteWallet(wallet, userid);
        }
예제 #18
0
 private Wallet ModelToWallet(WalletModel model)
 {
     return(new Wallet()
     {
         Money = model.Money
     });
 }
예제 #19
0
        private void AddWalletEntry(string code, double amount)
        {
            DataAccess db = DataAccess.GetDB;

            WalletModel w = db.GetWalletEntry(code);

            if (w == null)
            {
                Debug.WriteLine("Wallet Amount Nulo");

                w = new WalletModel()
                {
                    code   = currenciesPicker.Items[currenciesPicker.SelectedIndex],
                    amount = double.Parse(amountEntry.Text)
                };

                db.SaveWalletEntry(w);
            }
            else
            {
                Debug.WriteLine("Wallet Amount Existe");

                w.amount += amount;

                db.UpdateWalletEntry(w);
            }

            db.printWallet();
        }
예제 #20
0
        private void UnlockWalletAttempt()
        {
            if (PassAttempt.Length == 0)
            {
                this.IncorrectPasswordAttempt();
                return;
            }

            try
            {
                string      passHash = Generators.GenerateHash(PassAttempt);
                WalletModel wallet   = FileTools.DecryptWallet(_file, passHash);

                // sets wallet file property to file path in which it was imported from.
                var folderPath = _file.Replace("\\wallet.jet", "").Trim();

                wallet.SetWalletFolderPath(folderPath);
                //wallet.FileLocation = _file;
                Messenger.Default.Send <WalletModel>(wallet, "ChangeActiveWallet");
                _ppview.Close();
            }
            catch
            {
                this.IncorrectPasswordAttempt();
            }
        }
예제 #21
0
        public IotaWalletManager(WalletConfiguration walletConfiguration, ISelectedChanged selectedChanged)
        {
            this.walletConfiguration = walletConfiguration;
            this.selectedChanged     = selectedChanged;

            addressesButtons      = OpenAddressesButtons().ToArray();
            commandGroup          = new ActionCommandGroup(addressesButtons.Select(b => b.ButtonClick).ToArray());
            addressesModel        = new ContentCollectionModel <AddressItemModel>(addressesButtons);
            bundlesModel          = new ContentListModel <BundleItemModel>(addressesButtons.First());
            transactionCollection = new ObservableCollection <TransactionItemModel>();
            transactionManager    = new IotaWalletTransactionManager(transactionCollection, bundlesModel.ContentItems);

            var balanceItems = CreateBalanceItems().ToArray();
            var menuItems    = CreateMenuItems().ToArray();

            var balanceStatsModel = new BalanceStatsModel(balanceItems);

            walletModel          = new WalletModel(this, balanceStatsModel, menuItems);
            walletModel.NewSend += WalletModel_NewSend;

            menuItems.First().IsSelected = true;
            this.selectedChanged.SelectedChanged += SelectedChanged_SelectedChanged;

            bundlesModel.ContentItems.CollectionChanged += ContentItems_CollectionChanged;
        }
예제 #22
0
        public void RecoverWalletSuccessfullyReturnsWalletModel()
        {
            WalletModel walletModel = new WalletModel
            {
                FileName  = "myWallet",
                Network   = "MainNet",
                Addresses = new List <string> {
                    "address1", "address2", "address3", "address4", "address5"
                }
            };
            var mockWalletWrapper = new Mock <IWalletWrapper>();

            mockWalletWrapper.Setup(wallet => wallet.Load(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(walletModel);

            var controller = new WalletController(mockWalletWrapper.Object);

            // Act
            var result = controller.Load(new WalletLoadRequest
            {
                Name       = "myName",
                FolderPath = "",
                Password   = ""
            });

            // Assert
            mockWalletWrapper.VerifyAll();
            var viewResult = Assert.IsType <JsonResult>(result);

            Assert.NotNull(viewResult.Value);
            Assert.IsType <WalletModel>(viewResult.Value);

            var model = viewResult.Value as WalletModel;

            Assert.Equal("myWallet", model.FileName);
        }
예제 #23
0
        public ActionResult TransferAccount(WalletModel walletModel)
        {
            var messageRerult = string.Empty;

            if (walletModel.TransferToWallet)
            {
                var tratsferRerult = walletRepository.WalletTransfer(
                    walletModel.WalletId, walletModel.TransferVolume,
                    walletModel.UserLogin, walletModel.AccountId, false);

                messageRerult = tratsferRerult
                                    ? string.Format("{3} {0} {4} {1}. {5} - {2}",
                                                    walletModel.AccountId, walletModel.WalletId, walletModel.TransferVolume,
                                                    Resource.MessageWithdrawFromAccount, Resource.TextToThePurse, Resource.TextVolume)
                                    : string.Format(
                    "{2}: {3} {0} {4} {1}",
                    walletModel.AccountId, walletModel.WalletId, Resource.ErrorMessage, Resource.MessageWithdrawFromAccount,
                    Resource.TextToThePurse);
            }

            var updateRerult = walletRepository.UpdateBalance(walletModel.WalletId, walletModel.TransferVolume, false);

            messageRerult += updateRerult
                                 ? string.Format(" {2} #{0} - {1}",
                                                 walletModel.WalletId, walletModel.TransferVolume, Resource.MessageWithdrawFromWallet)
                                 : string.Format(
                " {0}: {2} #{1}", Resource.ErrorMessage, walletModel.WalletId, Resource.MessageWithdrawFromWallet);
            return(RedirectToAction("UserList", new { message = messageRerult }));
        }
예제 #24
0
        public ActionResult AccountTransfer(WalletModel walletModel)
        {
            var updateRerult = walletRepository.UpdateBalance(walletModel.WalletId, walletModel.TransferVolume, true);

            var messageRerult = updateRerult
                                    ? string.Format("{2} {1}. {3} {0}.",
                                                    walletModel.TransferVolume, walletModel.WalletId,
                                                    Resource.MessageFundsTransferredToPurse, Resource.TextVolume)
                                    : string.Format("{0} : {1} {2}.",
                                                    Resource.ErrorMessage, Resource.MessageFundsTransferredToPurse, walletModel.WalletId);

            if (updateRerult && walletModel.TransferToAccount)
            {
                var tratsferRerult = walletRepository.WalletTransfer(walletModel.WalletId, walletModel.TransferVolume,
                                                                     walletModel.UserLogin, walletModel.AccountId, true);
                messageRerult += tratsferRerult
                                     ? string.Format("{0} {1} {2} {3}. {4} {5}",
                                                     Resource.MessageFundsTransferredToAccount, walletModel.AccountId, Resource.TextFromThePurse, walletModel.WalletId,
                                                     Resource.TextVolume, walletModel.TransferVolume)
                                     : string.Format(
                    "{0} :  {1} #{2} {3} #{4}",
                    Resource.ErrorMessage, Resource.MessageFundsTransferredToAccount, walletModel.AccountId,
                    Resource.TextFromThePurse, walletModel.WalletId);
            }

            return(RedirectToAction("UserList", new { message = messageRerult }));
        }
예제 #25
0
        public async Task RecurringTransactionService_Updates_Wallet_Updated_RecurringTransaction_Decrease()
        {
            DateTime now = DateTime.UtcNow;

            UserModel user = new UserModel("Test User", new DateTime(), "*****@*****.**", "password", api.Enums.Currency.Euro);

            user._id  = "1234567891234567891234";
            user.Role = "user";

            WalletModel wallet = new WalletModel("Unit Test", 0, true, 490, null, api.Enums.WalletColor.Green, now);

            wallet._id = "1234567891234567891234";
            wallet.DateOffsetBalance = new List <DateOffsetBalance>();
            wallet.DateOffsetBalance.Add(new DateOffsetBalance(DateTime.UtcNow, 490));

            user.Wallets.Add(wallet);

            TransactionModel oldTransaction = new TransactionModel(user._id, wallet._id, 20, DateTime.UtcNow, api.Enums.TransactionCategory.Automotive, "test", "test", "test");
            TransactionModel newTransaction = new TransactionModel(user._id, wallet._id, 10, DateTime.UtcNow, api.Enums.TransactionCategory.Automotive, "test", "test", "test");

            TransactionService service   = new TransactionService();
            WalletModel        newWallet = await service.UpdateWalletForUpdatedTransaction(user, newTransaction, oldTransaction);

            newWallet.Balance.Should().Be(500);
            newWallet.LastUpdated.Should().NotBeOnOrBefore(now);
            newWallet.DateOffsetBalance.Should().NotBeNull();
        }
예제 #26
0
        private void RemoveWalletEntry(string code, double amount)
        {
            DataAccess db = DataAccess.GetDB;

            WalletModel w = db.GetWalletEntry(code);

            if (w == null)
            {
                // TODO invocar label de erro antes de tudo para avisar que a wallet que pretende apagar nao existe
            }
            else
            {
                if (w.amount > amount)
                {
                    w.amount -= amount;

                    db.UpdateWalletEntry(w);
                }
                else
                {
                    db.DeleteWalletEntry(w);
                }
            }

            db.printWallet();
        }
예제 #27
0
        /// <summary>
        /// This method creates a wallet for users. but if a noob user has a wallet already it
        /// returns an error response.
        /// </summary>
        /// <remarks>
        /// {
        ///    "currencySymbolToCreateWallet": "eur"
        /// }
        /// </remarks>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <(WalletView entity, string Message)> CreateWallet(WalletModel model)
        {
            var userCtx      = _httpContextAccessor.HttpContext.User.Identity.Name;
            var toCapsSymbol = model.CurrencySymbolToCreateWallet.ToUpperInvariant();

            var symbolName = configuration[$"SupportedSymbols:{toCapsSymbol}"];

            if (string.IsNullOrEmpty(symbolName))
            {
                return(entity : null, Message : $"Enter a correct currency symbol, {toCapsSymbol} incorrect.");
            }

            var userInDb = await _fxuser.FirstOrDefault(u => u.Username == userCtx && u.IsEmailConfirm == true);

            if (userInDb.Role == UserRoles.Admin)
            {
                return(entity : null, Message : $"Admin Can't create a wallet");
            }

            if (userInDb == null)
            {
                return(entity : null, Message : $"{userCtx}, you need to register.");
            }

            //If User is verified go ahead and create the wallet in specified currency
            var create = await GenerateWallet(userInDb, toCapsSymbol, symbolName, userCtx);

            return(create);
        }
예제 #28
0
        private async void ExecuteCreateWallet()
        {
            if (string.IsNullOrWhiteSpace(NewName) && Pass.Length < MIN_PASS_LENGTH)
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Invalid_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Invalid_Message")
                                 .Replace("*NUM*", MIN_PASS_LENGTH.ToString());
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }
            else if (string.IsNullOrWhiteSpace(NewName))
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_NameEmpty_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_NameEmpty_Message");
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }
            else if (Pass.Length < MIN_PASS_LENGTH)
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Insufficient_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Insufficient_Message")
                                 .Replace("*NUM*", MIN_PASS_LENGTH.ToString());
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }

            string  recPhrase = Generators.GenerateRecPhrase();
            Network net       = this.GetNetworkChoice();
            // WalletModel inherits from NBitcoin.SPV.Wallet which
            // requires a WalletCreation Class as a parameter
            WalletCreation create = Generators.GenerateWalletCreation(NewName, net);

            ExtKey           masterKey = Generators.GenerateMasterKey();
            BitcoinExtPubKey rootKey   = Generators.GenerateRootKey(masterKey, net);
            string           id        = TextTools.Base58Encode(NewName);

            string walletFolder = Path.Combine(App.WalletsDir, id);

            Directory.CreateDirectory(walletFolder);

            var newWallet = new WalletModel(id, NewName, rootKey, DateTimeOffset.Now, Description);

            newWallet.SetWalletPassword(Pass);
            newWallet.SetRecoveryPhrase(recPhrase);
            newWallet.SetMasterKey(masterKey);



            if (FileTools.SaveNewWallet(newWallet))
            {
                Messenger.Default.Send <string>(recPhrase, "OpenRecoveryPhraseView");
                // If a wallet is already active, lets ask the user to close
                // current active wallet and use the newly created one
                this.NewWalletPrompt(newWallet.FileLocation);
            }
        }
        public NormalModeStackWindow(PokerGameWindow parent)
        {
            InitializeComponent();
            this.parent = parent;
            this.game   = (NormalGameModel)Session.Data.Client.ServiceProxy.GetGameModelByTable(parent.TableModel);

            this.AvailableBallance.Visibility = Visibility.Hidden;

            this.JoinButton.IsEnabled = false;

            this.table_name.Text = this.game.Name;
            this.Blind.Text      = this.game.Table.Stakes;

            this.StackSlider.TickFrequency = (double)this.game.Table.Blind;
            this.StackSlider.Minimum       = (double)this.game.Minimum;
            this.StackSlider.Maximum       = (double)this.game.Maximum;
            this.MinAmount.Text            = CurrencyFormat.Get(
                this.game.Table.Currency, ((decimal)this.StackSlider.Minimum)
                );
            this.StackSlider.Value = this.StackSlider.Maximum;

            this.StackValue.Text = this.StackSlider.Value.ToString();

            //Pobieramy wallet
            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    wallet = Session.Data.Client.ServiceProxy.GetWallet(this.game.Table.Currency);
                    if (wallet == null)
                    {
                        AvailableBallance.Text = "Brak konta z walutą";
                    }
                    else
                    {
                        AvailableBallance.Text = CurrencyFormat.Get(this.game.Table.Currency, wallet.Available);
                    }

                    if (wallet != null && wallet.Available > this.game.Minimum)
                    {
                        if (wallet.Available < this.game.Maximum)
                        {
                            this.StackSlider.Maximum = (double)wallet.Available;
                        }
                        this.JoinButton.IsEnabled = true;

                        //Tworzymy rezerwacje
                        //Session.Data.Client.ServiceProxy.DoAction(ActionModel.GameActionType.Booking, this.game.Table);
                    }
                    else
                    {
                        this.JoinButton.Content = "Brak funduszy";
                    }

                    this.Loader.Visibility            = Visibility.Hidden;
                    this.AvailableBallance.Visibility = Visibility.Visible;
                }));
            });
        }
예제 #30
0
        public IActionResult Wallet(string cryptoCode)
        {
            WalletModel model = new WalletModel();

            model.ServerUrl      = GetStoreUrl(StoreData.Id);
            model.CryptoCurrency = cryptoCode;
            return(View(model));
        }