Пример #1
0
        private void OnContentRendered(object sender, RoutedEventArgs e)
        {
            if (!JsonConfig.CashCodeRequired)
            {
                Add5RubBt.Visibility  = Visibility.Visible;
                Add10RubBt.Visibility = Visibility.Visible;
                Add5RubBt.IsEnabled   = true;
                Add10RubBt.IsEnabled  = true;
            }

            if (!JsonConfig.WalletRequired)
            {
                PayBt.IsEnabled = true;
            }

            try
            {
                PaymentManager.EnableCashCode();
            }
            catch
            {
                if (JsonConfig.CashCodeRequired)
                {
                    var err = new ErrorPage(Error.Code.CantLaunchCashCode);
                    NavigationService?.Navigate(err);
                }
                else
                {
                    BalanceTb.Text = "недоступно";
                }
            }

            Dispatcher.BeginInvoke(new Action(SetCoursesText),
                                   DispatcherPriority.ContextIdle, null);
        }
Пример #2
0
 private void PayBt_OnClick(object sender, RoutedEventArgs e)
 {
     // TODO : pay
     //PaymentManager.ResetValue();
     try
     {
         PaymentManager.DisableCashCode();
         var succPage = new Success();
         NavigationService?.Navigate(succPage);
     }
     catch
     {
         if (JsonConfig.CashCodeRequired)
         {
             var err = new ErrorPage(Error.Code.CantDisableCashCode);
             NavigationService?.Navigate(err);
         }
         else
         {
             var succPage = new Success();
             NavigationService?.Navigate(succPage);
         }
     }
 }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();

            var code = JsonConfig.Init();

            if (code == Error.Code.Sucess)
            {
                if (JsonConfig.FullScreen)
                {
                    WindowStyle = WindowStyle.None;
                }
                CurrencesConverter.Start();
                PaymentManager.Start();

                var startPage = new Init();
                MainFrame.NavigationService.Navigate(startPage);
            }
            else
            {
                var errorPage = new ErrorPage(code);
                MainFrame.NavigationService.Navigate(errorPage);
            }
        }