Exemplo n.º 1
0
        // Creates a new wallet container
        public bool New(string FileName, string Password)
        {
            // Save, in case a wallet is already loaded
            Save();

            // Check if file already exists
            if (File.Exists(FileName))
            {
                return(false);
            }

            // Re-define cached wallet information
            WalletData      = new WalletContainer();
            WalletSyncState = new WalletSyncState();
            WalletVersion   = Constants.WALLET_FILE_VERSION;

            // Set wallet as loaded
            IsLoaded = true;

            // Store wallet information
            this.FileName = FileName;
            this.Password = Password;

            // Save new wallet file
            if (Save())
            {
                return(true);
            }

            // Failed to save wallet container
            else
            {
                return(false);
            }
        }
        public App()
        {
            Container = new WalletContainer();

            InitializeComponent();

            App.Container.DataStoragePath = DependencyService.Get <IPlatformSvc>().GetStoragePath();
            App.Container.WalletFn        = App.Container.DataStoragePath + "My Account.db";
            if (File.Exists(App.Container.WalletFn))
            {
                var netfn = App.Container.DataStoragePath + "network.txt";
                App.Container.CurrentNetwork = File.ReadAllText(netfn);
                MainPage = new MainPage();
            }
            else
            {
                MainPage = new NavigationPage(new NetworkSelectionPage());
            }
        }