static void RunInstaller(
            string installerPath,
            ProgressControlsForDialogs progressControls,
            INotify notify)
        {
            progressControls.ProgressData.ProgressPercent = -1;

            ((IProgressControls)progressControls).ShowProgress(
                PlasticLocalization.GetString(PlasticLocalization.Name.InstallingProgress));

            notify.InstallationStarted();

            MacOSConfigWorkaround configWorkaround = new MacOSConfigWorkaround();

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                configWorkaround.CreateClientConfigIfNeeded();

                Process installerProcess =
                    LaunchInstaller.ForPlatform(installerPath);

                if (installerProcess != null)
                {
                    installerProcess.WaitForExit();
                }

                configWorkaround.DeleteClientConfigIfNeeded();
            },
                /*afterOperationDelegate*/ delegate
            {
                notify.InstallationFinished();
                ((IProgressControls)progressControls).HideProgress();

                if (waiter.Exception != null)
                {
                    ((IProgressControls)progressControls).ShowError(
                        waiter.Exception.Message);
                    return;
                }

                File.Delete(installerPath);
            });
        }
Пример #2
0
        static void RunInstaller(
            string installerPath,
            ProgressControlsForViews progressControls)
        {
            progressControls.ProgressData.ProgressPercent = -1;

            ((IProgressControls)progressControls).ShowProgress("Installing...");

            MacOSConfigWorkaround configWorkaround = new MacOSConfigWorkaround();

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                configWorkaround.CreateClientConfigIfNeeded();

                Process installerProcess =
                    LaunchInstaller.ForPlatform(installerPath);

                if (installerProcess != null)
                {
                    installerProcess.WaitForExit();
                }

                configWorkaround.DeleteClientConfigIfNeeded();
            },
                /*afterOperationDelegate*/ delegate
            {
                ((IProgressControls)progressControls).HideProgress();

                if (waiter.Exception != null)
                {
                    ((IProgressControls)progressControls).ShowError(
                        waiter.Exception.Message);
                    return;
                }

                File.Delete(installerPath);
            });
        }