Beispiel #1
0
        private void Timer_Tick(object o, EventArgs sender)
        {
            foreach (Account a in _application.Database)
            {
                CodeGenerator cg   = new CodeGenerator(6, 30);
                string        code = cg.computePin(a.SecretKey);

                if (a.Code != code)
                {
                    a.Code = code;
                }
            }

            if (_application.Database.Count > 0)
            {
                _progressIndicator.IsVisible = true;
            }
            else
            {
                _progressIndicator.IsVisible = false;
            }

            _progressIndicator.IsIndeterminate = false;
            _progressIndicator.Value           = CodeGenerator.numberSecondsLeft() / 30.0;
        }
Beispiel #2
0
        private void AddToAccountDB(string Name, string Key)
        {
            Account a = new Account();

            a.AccountName = Name;
            a.SecretKey   = Key;

            CodeGenerator cg   = new CodeGenerator(6, 30);
            string        code = cg.computePin(a.SecretKey);

            if (code == null || code.Length != 6)
            {
                MessageBox.Show("The Secret Key you provided could not be validated. Please check your input and try again.", "Error", MessageBoxButton.OK);
                return;
            }
            else
            {
                _application.Database.Add(a);
                _application.Application_Closing(null, null);
            }

            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }
        private void Timer_Tick(object o, EventArgs sender)
        {
            foreach (Account a in _application.Database)
            {
                CodeGenerator cg = new CodeGenerator(6, 30);
                string code = cg.computePin(a.SecretKey);

                if (a.Code != code)
                {
                    a.Code = code;
                }
            }

            if (_application.Database.Count > 0)
            {
                _progressIndicator.IsVisible = true;
            }
            else
            {
                _progressIndicator.IsVisible = false;
            }

            _progressIndicator.IsIndeterminate = false;
            _progressIndicator.Value = CodeGenerator.numberSecondsLeft() / 30.0;
        }
        private void AddToAccountDB(string Name, string Key)
        {
            Account a = new Account();
            a.AccountName = Name;
            a.SecretKey = Key;

            CodeGenerator cg = new CodeGenerator(6, 30);
            string code = cg.computePin(a.SecretKey);

            if (code == null || code.Length != 6)
            {
                MessageBox.Show("The Secret Key you provided could not be validated. Please check your input and try again.", "Error", MessageBoxButton.OK);
                return;
            }
            else
            {
                _application.Database.Add(a);
                _application.Application_Closing(null, null);
            }

            NavigationService.GoBack();
        }