Exemplo n.º 1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (Environment.OSVersion.Version < new Version(10, 0, 17763, 0))
            {
                Error.Text = "LRReader requires Windows 10 1809";
            }
            else
            {
                pm = await Task.Run(() => new PackageManager());

                CertFound = CertUtil.FindCertificate(Variables.CertThumb);
                var pkg = pm.FindPackagesForUser(string.Empty, Variables.PackageFamilyName).FirstOrDefault();
                if (pkg != null && CertFound)
                {
                    var ver = new Version(pkg.Id.Version.Major, pkg.Id.Version.Minor, pkg.Id.Version.Build, pkg.Id.Version.Revision);
                    if (Variables.Version.Contains("Nightly") || new Version(Variables.Version) > ver)
                    {
                        InstallApp.Content    = "Upgrade";
                        InstallApp.Visibility = Visibility.Visible;
                    }
                    UninstallApp.Visibility = Visibility.Visible;
                }
                else if (CertFound)
                {
                    UninstallCert.Visibility = InstallApp.Visibility = Visibility.Visible;
                }
                else
                {
                    InstallApp.Visibility = Visibility;
                }
            }
        }
Exemplo n.º 2
0
        public static int Main(string[] args)
        {
            if (args != null && args.Length > 0)
            {
                CertUtil.Open(OpenFlags.ReadWrite);
                bool ok = false;
                switch (args[0])
                {
                case "--install-cert":
                    ok = CertUtil.InstallCertificate(Variables.CertUrl, Variables.CertThumb).GetAwaiter().GetResult();
                    break;

                case "--uninstall-cert":
                    ok = CertUtil.UninstallCertificate(Variables.CertThumb);
                    break;
                }
                CertUtil.Close();
                return(ok ? 0 : -1);
            }
            else
            {
                if (Environment.OSVersion.Version >= new Version(10, 0, 18362, 0))
                {
                    UxTheme.SetPreferredAppMode(1);
                }
                var app = new App();
                app.InitializeComponent();
                app.Run();
                return(0);
            }
        }
Exemplo n.º 3
0
 private void Application_Exit(object sender, ExitEventArgs e) => CertUtil.Close();
Exemplo n.º 4
0
 private void Application_Startup(object sender, StartupEventArgs e) => CertUtil.Open();