Beispiel #1
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     OkTime = true;
     DispatcherTimer.Stop();
     if (ShowWinLicense)
     {
         var winLicense = new WinLicense();
         OkDbChange = true;
         winLicense.Show();
         Close();
     }
     if (OkLogin)
     {
         var winLogin = new WinLogin();
         OkDbChange = true;
         winLogin.Show();
         Close();
     }
     if (OkShutdownApp)
     {
         OkDbChange = true;
         Application.Current.Shutdown();
     }
 }
Beispiel #2
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DispatcherTimer.Tick    += dispatcherTimer_Tick;
            DispatcherTimer.Interval = new TimeSpan(0, 0, 0, 10);
            DispatcherTimer.Start();
            await Task.Run(() => new AsanHesabDbConfiguration().Configurate());

            await Task.Run(() => new AsanHesabDbChanges().Configurate());

            var licenseData  = (await DLicense.GetData())[0].AppLicense;
            var serialNumber = await Task.Run(() => SerialNumber.GetHardwareSerial());

            var salt = new SaltyPasswordHashing
            {
                MaxHashSize = 40,
                SaltSize    = 0
            };

            if (!await Task.Run(() => salt.VerifyHash(serialNumber, licenseData)))
            {
                var checkTime = await Task.Run(CheckWinTimeUpdate);

                var checkTrial = await Task.Run(Check3DayTrial);

                if ((await DLicense.GetData())[0].AppVersion == null)
                {
                    var dLicense = new DLicense
                    {
                        DAppLicense = licenseData,
                        DAppVersion = "1.0.0"
                    };
                    await Task.Run(() => dLicense.Edit());
                }

                if (!checkTime || !checkTrial)
                {
                    if (OkTime && OkShutdownApp)
                    {
                        OkDbChange = true;
                        Application.Current.Shutdown();
                    }
                    if (OkTime && !OkShutdownApp)
                    {
                        var winLicense = new WinLicense();
                        OkDbChange = true;
                        winLicense.Show();
                        Close();
                    }
                    else
                    {
                        ShowWinLicense = true;
                    }
                    return;
                }

                if (OkTime)
                {
                    var winLogin = new WinLogin();
                    OkDbChange = true;
                    winLogin.Show();
                    Close();
                }
                else
                {
                    OkLogin = true;
                }
            }
            else
            {
                if (OkTime)
                {
                    var winLogin = new WinLogin();
                    OkDbChange = true;
                    winLogin.Show();
                    Close();
                }
                else
                {
                    OkLogin = true;
                }
            }
        }