Esempio n. 1
0
        public static async Task <bool> UnlockCoreAccount(string password)
        {
            if (CurrentCoreAccount != null)
            {
                try
                {
                    if (await Client.SetCoreAccount(CurrentCoreAccount, password))
                    {
                        await CurrentCoreAccount.DecryptKeyAsync(password, true);

                        _serviceNode.AddServiceAccountForCoreChain(CurrentCoreAccount);

                        await UIApp.PubSub.PublishAsync(new CoreAccountUnlockedEvent(CurrentCoreAccount));

                        UIApp.Run(async() =>
                        {
                            await UpdateCoreAccountBalance();

                            if (UIApp.Current.PushNotificationsEnabled)
                            {
                                await UIApp.Current.SyncPushToken(false);
                            }

                            if (UIApp.Current.SendErrorReports)
                            {
                                await UIApp.UploadErrorReports(ServiceNodeManager.Current.FirstDefaultServiceNode);
                            }
                        });

                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    Log.IgnoreException(ex);
                }
            }

            return(false);
        }