예제 #1
0
		private static void DisplayDefaultLicenseAcceptDialog(PackageLicenseAgreementEventArgs args)
		{
			LicenseAcceptDialog licenseDialog = new LicenseAcceptDialog
			{
				DescriptionText = string.Format(GeneralRes.LicenseAcceptDialog_PackageDesc, args.PackageName),
				LicenseUrl = args.LicenseUrl
			};

			Form invokeForm = DualityEditorApp.MainForm ?? Application.OpenForms.OfType<Form>().FirstOrDefault();
			DialogResult result = invokeForm.InvokeEx(main => licenseDialog.ShowDialog());
			if (result == DialogResult.OK)
			{
				args.AcceptLicense();
			}
		}
예제 #2
0
파일: Program.cs 프로젝트: SirePi/duality
        private static void Main(string[] args)
        {
            // Parse command line arguments
            bool recover = false;
            foreach (string a in args)
            {
                if (a == "debug")
                    System.Diagnostics.Debugger.Launch();
                else if (a == "recover")
                    recover = true;
            }

            // Culture setup
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            // Set up file logging
            StreamWriter logfileWriter = null;
            TextWriterLogOutput logfileOutput = null;
            try
            {
                // If there is an existing logfile, preserve it under a different name
                if (File.Exists(DualityEditorApp.EditorLogfilePath))
                {
                    if (File.Exists(DualityEditorApp.EditorPrevLogfilePath))
                        File.Delete(DualityEditorApp.EditorPrevLogfilePath);
                    File.Move(DualityEditorApp.EditorLogfilePath, DualityEditorApp.EditorPrevLogfilePath);
                }

                // Create a new logfile
                logfileWriter = new StreamWriter(DualityEditorApp.EditorLogfilePath);
                logfileWriter.AutoFlush = true;
                logfileOutput = new TextWriterLogOutput(logfileWriter);
                Log.AddGlobalOutput(logfileOutput);
            }
            catch (Exception e)
            {
                Log.Core.WriteWarning("Text Logfile unavailable: {0}", Log.Exception(e));
            }

            // Winforms Setup
            Application.CurrentCulture = Thread.CurrentThread.CurrentCulture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            {
                PackageManager packageManager = new PackageManager();

                // On the first install startup, display a generic license agreement for Duality
                if (packageManager.IsFirstInstall)
                {
                    LicenseAcceptDialog licenseDialog = new LicenseAcceptDialog
                    {
                        DescriptionText = GeneralRes.LicenseAcceptDialog_FirstStartGeneric,
                        LicenseUrl = new Uri(DualityMainLicenseUrl)
                    };
                    DialogResult result = licenseDialog.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        Application.Exit();
                        return;
                    }
                }

                // Perform the initial package update - even before initializing the editor
                if (packageManager.IsPackageSyncRequired)
                {
                    Log.Editor.Write("Updating Packages...");
                    Log.Editor.PushIndent();
                    ProcessingBigTaskDialog setupDialog = new ProcessingBigTaskDialog(
                        GeneralRes.TaskInstallPackages_Caption,
                        GeneralRes.TaskInstallPackages_Desc,
                        SynchronizePackages,
                        packageManager);
                    setupDialog.ShowInTaskbar = true;
                    setupDialog.MainThreadRequired = false;
                    setupDialog.ShowDialog();
                    Log.Editor.PopIndent();
                }
                if (packageManager.ApplyUpdate())
                {
                    Application.Exit();
                    return;
                }
            }

            // Run the editor
            SplashScreen splashScreen = new SplashScreen(recover);
            splashScreen.Show();
            Application.Run();

            // Clean up the log file
            if (logfileWriter != null)
            {
                Log.RemoveGlobalOutput(logfileOutput);
                logfileWriter.Flush();
                logfileWriter.Close();
                logfileWriter = null;
                logfileOutput = null;
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: gitMaxim/duality
        private static void Main(string[] args)
        {
            // Parse command line arguments
            bool recover = false;
            foreach (string a in args)
            {
                if (a == "debug")
                    System.Diagnostics.Debugger.Launch();
                else if (a == "recover")
                    recover = true;
            }

            // Culture setup
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            Application.CurrentCulture = Thread.CurrentThread.CurrentCulture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            {
                PackageManager packageManager = new PackageManager();

                // On the first install startup, display a generic license agreement for Duality
                if (packageManager.IsFirstInstall)
                {
                    LicenseAcceptDialog licenseDialog = new LicenseAcceptDialog
                    {
                        DescriptionText = GeneralRes.LicenseAcceptDialog_FirstStartGeneric,
                        LicenseUrl = new Uri(DualityMainLicenseUrl)
                    };
                    DialogResult result = licenseDialog.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        Application.Exit();
                        return;
                    }
                }

                // Perform the initial package update - even before initializing the editor
                if (packageManager.IsPackageUpdateRequired)
                {
                    Log.Editor.Write("Updating Packages...");
                    Log.Editor.PushIndent();
                    ProcessingBigTaskDialog setupDialog = new ProcessingBigTaskDialog(
                        GeneralRes.TaskInstallPackages_Caption,
                        GeneralRes.TaskInstallPackages_Desc,
                        FirstTimeSetup,
                        packageManager);
                    setupDialog.ShowInTaskbar = true;
                    setupDialog.MainThreadRequired = false;
                    setupDialog.ShowDialog();
                    Log.Editor.PopIndent();
                }
                if (packageManager.ApplyUpdate())
                {
                    Application.Exit();
                    return;
                }
            }

            // Run the editor
            SplashScreen splashScreen = new SplashScreen(recover);
            splashScreen.Show();
            Application.Run();
        }