public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Restore");

            if (instance != null)
            {
                var args = new RestoreArgs(instance);
                var id   = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("restore", mainWindow, args, null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new RestoreWizardArgs(instance));
            }
        }
Пример #2
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Restore");

            if (instance != null)
            {
                var args = new RestoreArgs(instance, new SqlConnectionStringBuilder(Profile.Read(new RealFileSystem()).ConnectionString));
                var id   = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("restore", mainWindow, args, null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new RestoreWizardArgs(instance));
            }
        }
        public static void ReinstallInstance([NotNull] Instance instance, Window owner, [NotNull] string license, [NotNull] SqlConnectionStringBuilder connectionString)
        {
            Assert.ArgumentNotNull(instance, nameof(instance));
            Assert.ArgumentNotNull(license, nameof(license));
            Assert.ArgumentNotNull(connectionString, nameof(connectionString));

            if (instance.IsSitecore)
            {
                Product product = instance.Product;
                if (string.IsNullOrEmpty(product.PackagePath))
                {
                    if (WindowHelper.ShowMessage("The {0} product isn't presented in your local repository. Would you like to choose the zip installation package?".FormatWith(instance.ProductFullName), MessageBoxButton.YesNo, MessageBoxImage.Stop) == MessageBoxResult.Yes)
                    {
                        var            patt = instance.ProductFullName + ".zip";
                        OpenFileDialog fileBrowserDialog = new OpenFileDialog
                        {
                            Title           = @"Choose installation package",
                            Multiselect     = false,
                            CheckFileExists = true,
                            Filter          = patt + '|' + patt
                        };

                        if (fileBrowserDialog.ShowDialog() == DialogResult.OK)
                        {
                            product = Product.Parse(fileBrowserDialog.FileName);
                            if (string.IsNullOrEmpty(product.PackagePath))
                            {
                                WindowHelper.HandleError("SIM can't parse the {0} package".FormatWith(instance.ProductFullName), true, null);
                                return;
                            }
                        }
                    }
                }

                if (string.IsNullOrEmpty(product.PackagePath))
                {
                    return;
                }

                ReinstallArgs args;
                try
                {
                    args = new ReinstallArgs(instance, connectionString, license, SIM.Pipelines.Install.Settings.CoreInstallWebServerIdentity.Value, Settings.CoreInstallNotFoundTransfer.Value);
                }
                catch (Exception ex)
                {
                    WindowHelper.HandleError(ex.Message, false, ex);
                    return;
                }

                var name = instance.Name;
                WizardPipelineManager.Start("reinstall", owner, args, null, ignore => MainWindowHelper.MakeInstanceSelected(name));
            }
        }
Пример #4
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var connectionString = ProfileManager.GetConnectionString();
         var args             = new DeleteArgs(instance, connectionString);
         args.OnCompleted += () => mainWindow.Dispatcher.Invoke(() => OnPipelineCompleted(args.RootPath));
         var index = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("delete", mainWindow, args, null, (ignore) => OnWizardCompleted(index), () => null);
     }
 }
Пример #5
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, nameof(mainWindow));

            var fileDialog = new OpenFileDialog
            {
                Title       = "Select zip file of exported solution",
                Multiselect = false,
                DefaultExt  = ".zip"
            };

            fileDialog.ShowDialog();
            var filePath = fileDialog.FileName;

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            Log.Info($"Importing solution from {filePath}");
            var fileSystem = new RealFileSystem();
            var file       = fileSystem.ParseFile(filePath);

            using (var zipFile = new RealZipFile(fileSystem.ParseFile(file.FullName)))
            {
                const string AppPoolFileName = "AppPoolSettings.xml";
                var          appPool         = zipFile.Entries.Contains(AppPoolFileName);
                if (!appPool)
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(AppPoolFileName));
                    return;
                }

                const string WebsiteSettingsFileName = "WebsiteSettings.xml";
                var          websiteSettings         = zipFile.Entries.Contains(WebsiteSettingsFileName);
                if (!websiteSettings)
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebsiteSettingsFileName));

                    return;
                }

                const string WebConfigFileName = @"Website/Web.config";
                if (!zipFile.Entries.Contains(WebConfigFileName))
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebConfigFileName));

                    return;
                }
            }

            WizardPipelineManager.Start("import", mainWindow, null, null, ignore => MainWindowHelper.SoftlyRefreshInstances(), () => new ImportWizardArgs(file.FullName));
        }
Пример #6
0
        public static void Reinstall9Instance([NotNull] Instance instance, Window owner, [NotNull] string license, [NotNull] SqlConnectionStringBuilder connectionString)
        {
            Assert.ArgumentNotNull(instance, nameof(instance));
            Assert.ArgumentNotNull(license, nameof(license));
            Assert.ArgumentNotNull(connectionString, nameof(connectionString));

            if (instance.IsSitecore || instance.IsSitecoreEnvironmentMember)
            {
                var name = instance.Name;
                WizardPipelineManager.Start("reinstall9", owner, null, null, ignore => MakeInstanceSelected(name), () => new ReinstallWizardArgs(instance, connectionString, license));
            }
        }
Пример #7
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, "mainWindow");

            Analytics.TrackEvent("Import");

            var fileDialog = new OpenFileDialog
            {
                Title       = "Select zip file of exported solution",
                Multiselect = false,
                DefaultExt  = ".zip"
            };

            fileDialog.ShowDialog();
            var filePath = fileDialog.FileName;

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            const string AppPoolFileName = "AppPoolSettings.xml";
            var          appPool         = FileSystem.Local.Zip.ZipContainsFile(filePath, AppPoolFileName);

            if (!appPool)
            {
                WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(AppPoolFileName));
                return;
            }

            const string WebsiteSettingsFileName = "WebsiteSettings.xml";
            var          websiteSettings         = FileSystem.Local.Zip.ZipContainsFile(filePath, WebsiteSettingsFileName);

            if (!websiteSettings)
            {
                WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebsiteSettingsFileName));

                return;
            }

            const string WebConfigFileName = @"Website/Web.config";

            if (!FileSystem.Local.Zip.ZipContainsFile(filePath, WebConfigFileName))
            {
                WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebConfigFileName));

                return;
            }

            WizardPipelineManager.Start("import", mainWindow, null, null, MainWindowHelper.SoftlyRefreshInstances, filePath);
        }
Пример #8
0
        public static void ReinstallInstance([NotNull] Instance instance, Window owner, [NotNull] string license, [NotNull] SqlConnectionStringBuilder connectionString)
        {
            Assert.ArgumentNotNull(instance, nameof(instance));
            Assert.ArgumentNotNull(license, nameof(license));
            Assert.ArgumentNotNull(connectionString, nameof(connectionString));

            if (instance.IsSitecore || instance.IsSitecoreEnvironmentMember)
            {
                if (int.Parse(instance.Product.ShortVersion) < 90)
                {
                    Product product = instance.Product;
                    if (string.IsNullOrEmpty(product.PackagePath))
                    {
                        if (WindowHelper.ShowMessage("The {0} product isn't presented in your local repository. Would you like to choose the zip installation package?".FormatWith(instance.ProductFullName), MessageBoxButton.YesNo, MessageBoxImage.Stop) == MessageBoxResult.Yes)
                        {
                            var            patt = instance.ProductFullName + ".zip";
                            OpenFileDialog fileBrowserDialog = new OpenFileDialog
                            {
                                Title           = @"Choose installation package",
                                Multiselect     = false,
                                CheckFileExists = true,
                                Filter          = patt + '|' + patt
                            };

                            if (fileBrowserDialog.ShowDialog() == DialogResult.OK)
                            {
                                product = Product.Parse(fileBrowserDialog.FileName);
                                if (string.IsNullOrEmpty(product.PackagePath))
                                {
                                    WindowHelper.HandleError("SIM can't parse the {0} package".FormatWith(instance.ProductFullName), true, null);
                                    return;
                                }
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(product.PackagePath))
                    {
                        return;
                    }
                }

                var name = instance.Name;
                WizardPipelineManager.Start("reinstall", owner, null, null, ignore => MakeInstanceSelected(name), () => new ReinstallWizardArgs(instance, connectionString, license));
            }
        }
        public void OnClick([NotNull] Window mainWindow, [CanBeNull] Instance instance)
        {
            WizardPipelineManager.Start("install9", mainWindow, null, null, (args) =>
            {
                if (args == null)
                {
                    return;
                }

                var install = (InstallWizardArgs)args;
                var product = install.Product;

                if (install.HasInstallationBeenCompleted)
                {
                    MainWindowHelper.SoftlyRefreshInstances();
                }
            }, () => new Install9WizardArgs());
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                var connectionString = ProfileManager.GetConnectionString();
                var args             = new DeleteArgs(instance, connectionString);
                args.OnCompleted += () => mainWindow.Dispatcher.Invoke(() => OnPipelineCompleted(args));
                var index = MainWindowHelper.GetListItemID(instance.ID);
                int version;
                if (int.TryParse(instance.Product.ShortVersion, out version) && version < 90)
                {
                    WizardPipelineManager.Start("delete", mainWindow, args, null, (ignore) => OnWizardCompleted(index, args.HasInstallationBeenCompleted), () => null);
                }
                else
                {
                    string uninstallPath    = string.Empty;
                    SitecoreEnvironment env = SitecoreEnvironmentHelper.GetExistingSitecoreEnvironment(instance.Name);
                    if (!string.IsNullOrEmpty(env?.UnInstallDataPath))
                    {
                        uninstallPath = env.UnInstallDataPath;
                    }
                    else
                    {
                        foreach (string installName in Directory.GetDirectories(ApplicationManager.UnInstallParamsFolder).OrderByDescending(s => s.Length))
                        {
                            if (instance.Name.StartsWith(Path.GetFileName(installName)))
                            {
                                uninstallPath = installName;
                                break;
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(uninstallPath))
                    {
                        WindowHelper.ShowMessage("UnInstall files not found.");
                        return;
                    }

                    Delete9WizardArgs delete9WizardArgsargs = new Delete9WizardArgs(instance, connectionString, uninstallPath);
                    WizardPipelineManager.Start("delete9", mainWindow, null, null, (ignore) => OnWizardCompleted(index, delete9WizardArgsargs.HasInstallationBeenCompleted), () => delete9WizardArgsargs);
                }
            }
        }
Пример #11
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.IsTrue(ProfileManager.IsValid, "Some of configuration settings are invalid - please fix them in Settings dialog and try again", false);
            Assert.IsTrue(ProductManager.StandaloneProducts.Any(),
                          @"You don't have any standalone product package in your repository. Options to solve:

1. (recommended) Use Ribbon -> Home -> Bundled Tools -> Download Sitecores button to download them.

2. If you already have them then you can either: 

* change the local repository folder (Ribbon -> Home -> Settings button) to the one that contains the files 

* put the files into the current local repository folder: 
" + ProfileManager.Profile.LocalRepository, false);

            if (EnvironmentHelper.CheckSqlServer())
            {
                WizardPipelineManager.Start("install", mainWindow, null, null, MainWindowHelper.SoftlyRefreshInstances);
            }
        }
Пример #12
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Install");

            Assert.IsTrue(ProfileManager.IsValid, "Some of configuration settings are invalid - please fix them in Settings dialog and try again");
            Assert.IsTrue(ProductManager.StandaloneProducts.Any(),
                          $@"You don't have any standalone product package in your repository. Options to solve:

1. (recommended) Use Ribbon -> Home -> Bundled Tools -> Download Sitecores button to download them.

2. If you already have them then you can either: 

* change the local repository folder (Ribbon -> Home -> Settings button) to the one that contains the files 

* put the files into the current local repository folder: 
{ProfileManager.Profile.LocalRepository}");

            if (EnvironmentHelper.CheckSqlServer())
            {
                WizardPipelineManager.Start("install", mainWindow, null, null, (args) =>
                {
                    MainWindowHelper.SoftlyRefreshInstances();

                    if (args == null)
                    {
                        return;
                    }

                    var install = (InstallWizardArgs)args;
                    var product = install.Product;
                    if (product == null)
                    {
                        return;
                    }

                    Analytics.TrackEvent($"install-{product.Version}");
                }, () => new InstallWizardArgs());
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            var fileDialog = new OpenFileDialog
            {
                Title       = "Select zip file of exported solution",
                Multiselect = false,
                DefaultExt  = ".zip"
            };

            fileDialog.ShowDialog();
            string filePath = fileDialog.FileName;

            if (!string.IsNullOrEmpty(filePath))
            {
                if (FileSystem.FileSystem.Local.Zip.ZipContainsFile(filePath, "AppPoolSettings.xml") && FileSystem.FileSystem.Local.Zip.ZipContainsFile(filePath, "WebsiteSettings.xml") && FileSystem.FileSystem.Local.Zip.ZipContainsFile(filePath, @"Website/Web.config"))
                {
                    WizardPipelineManager.Start("import", mainWindow, null, null, MainWindowHelper.SoftlyRefreshInstances, filePath);
                }
                else
                {
                    WindowHelper.ShowMessage("Wrong package for import.");
                }
            }
        }
Пример #14
0
        protected override void OnStartup([CanBeNull] StartupEventArgs e)
        {
            base.OnStartup(e);

            if (!App.EnsureSingleProcess(e.Args))
            {
                Environment.Exit(0);

                return;
            }

            if (CoreApp.HasBeenUpdated)
            {
                var ver = ApplicationManager.AppVersion;
                if (!string.IsNullOrEmpty(ver))
                {
                    var exists = false;
                    var wc     = new WebClient();
                    var url    = "https://github.com/Sitecore/Sitecore-Instance-Manager/releases/tag/" + ver;
                    try
                    {
                        wc.DownloadString(url);
                        exists = true;
                    }
                    catch
                    {
                        Log.Warn("Tag was not found: {0}", url);
                    }

                    if (exists)
                    {
                        WindowHelper.OpenInBrowser(url, true);
                    }
                }
            }

            if (CoreApp.IsFirstRun || CoreApp.HasBeenUpdated)
            {
                CacheManager.ClearAll();
                foreach (var dir in Directory.GetDirectories(ApplicationManager.TempFolder))
                {
                    Directory.Delete(dir, true);
                }

                var ext = ".deploy.txt";
                foreach (var filePath in Directory.GetFiles(".", "*" + ext, SearchOption.AllDirectories))
                {
                    if (filePath == null)
                    {
                        continue;
                    }

                    var newFilePath = filePath.Substring(0, filePath.Length - ext.Length);
                    if (File.Exists(newFilePath))
                    {
                        File.Delete(newFilePath);
                    }

                    File.Move(filePath, newFilePath);
                }
            }

            if (!App.CheckPermissions())
            {
                Environment.Exit(0);

                return;
            }

            CoreApp.InitializeLogging();

            CoreApp.LogMainInfo();

            if (!App.CheckIIS())
            {
                WindowHelper.ShowMessage("Cannot connect to IIS. Make sure it is installed and running.", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                Environment.Exit(0);

                return;
            }

            // Initializing pipelines from Pipelines.config and WizardPipelines.config files
            if (!App.InitializePipelines())
            {
                Environment.Exit(0);

                return;
            }

            // Application is closing when it doesn't have any window instance therefore it's
            // required to create MainWindow before creating the initial configuration dialog
            var main = App.CreateMainWindow();

            if (main == null)
            {
                Environment.Exit(0);

                return;
            }

            // Initialize Profile Manager
            if (!App.InitializeProfileManager(main))
            {
                Log.Info("Application closes due to invalid configuration");

                // Since the main window instance was already created we need to "dispose" it by showing and closing.
                main.Width  = 0;
                main.Height = 0;
                main.Show();
                main.Close();

                Environment.Exit(0);

                return;
            }

            // Check if user accepted agreement
            var agreementAcceptedFilePath = Path.Combine(ApplicationManager.TempFolder, "agreement-accepted.txt");

            if (!File.Exists(agreementAcceptedFilePath))
            {
                WizardPipelineManager.Start("agreement", main, new ProcessorArgs(), false);
                if (!File.Exists(agreementAcceptedFilePath))
                {
                    Environment.Exit(0);

                    return;
                }
            }

            // Clean up garbage
            CoreApp.DeleteTempFolders();

            Analytics.Start();

            // Show main window
            try
            {
                main.Initialize();
                WindowHelper.ShowDialog(main, null);
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("Main window caused unhandled exception", true, ex);
            }

            CoreApp.Exit();

            Analytics.Flush();

            Environment.Exit(0);
        }
Пример #15
0
        protected override void OnStartup([CanBeNull] StartupEventArgs e)
        {
            // enable TLS 1.2 by default to work around GitHub and many other websites
            // that don't accept default .NET protocol.
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;

            InitializeLogging();

            base.OnStartup(e);

            if (!CheckPermissions())
            {
                Log.Info("Shutting down due to missing permissions (it is normally okay as it will be re-run with elevated permissions)");

                Environment.Exit(0);

                return;
            }

            if (!EnsureSingleProcess(e.Args))
            {
                Log.Info("Shutting down as there is another process running");

                Environment.Exit(0);

                return;
            }

            // invoke auto-updater if not developing or debugging
            if (!ApplicationManager.IsDev && !ApplicationManager.IsDebugging)
            {
                try
                {
                    Log.Info("Running update procedure");

                    var prefix = ApplicationManager.IsQa ? "qa/" : "";
                    var suffix = ApplicationManager.IsQa ? ".QA" : "";
                    CoreApp.RunApp("rundll32.exe", $"dfshim.dll,ShOpenVerbApplication http://dl.sitecore.net/updater/{prefix}sim/SIM.Tool{suffix}.application");
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Error connecting to SIM auto-updater.");
                }
            }

            if (CoreApp.HasBeenUpdated)
            {
                var ver = ApplicationManager.AppVersion;
                if (!string.IsNullOrEmpty(ver))
                {
                    var exists = false;
                    var wc     = new WebClient();
                    var url    = $"https://github.com/Sitecore/Sitecore-Instance-Manager/releases/tag/{ver}";
                    try
                    {
                        wc.DownloadString(url);
                        exists = true;
                    }
                    catch
                    {
                        Log.Warn($"Tag was not found: {url}");
                    }

                    if (exists)
                    {
                        Log.Info("Showing release notes");

                        CoreApp.OpenInBrowser(url, true);
                    }
                }
            }

            if (CoreApp.IsVeryFirstRun || CoreApp.HasBeenUpdated)
            {
                Log.Info("Cleaning up caches after update");

                CacheManager.ClearAll();
                foreach (var dir in Directory.GetDirectories(ApplicationManager.TempFolder))
                {
                    try
                    {
                        Directory.Delete(dir, true);
                    }
                    catch (Exception ex)
                    {
                        WindowHelper.HandleError($"Failed to delete directory1: {dir}", isError: true, ex: ex);
                    }
                }

                Log.Info("Unpacking resources");

                var ext = ".deploy.txt";
                foreach (var filePath in Directory.GetFiles(".", $"*{ext}", SearchOption.AllDirectories))
                {
                    if (filePath == null)
                    {
                        continue;
                    }

                    var newFilePath = filePath.Substring(0, filePath.Length - ext.Length);
                    if (File.Exists(newFilePath))
                    {
                        try
                        {
                            File.Delete(newFilePath);
                        }
                        catch (Exception ex)
                        {
                            throw new InvalidOperationException($"Failed to delete file: {newFilePath}", ex);
                        }
                    }

                    File.Move(filePath, newFilePath);
                }
            }

            // write it here as all preceding logic is finished
            CoreApp.WriteLastRunVersion();

            CoreApp.LogMainInfo();

            if (!CheckIis())
            {
                WindowHelper.ShowMessage("Cannot connect to IIS. Make sure it is installed and running.", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                Environment.Exit(0);

                return;
            }

            // Initializing pipelines from Pipelines.config and WizardPipelines.config files
            if (!InitializePipelines())
            {
                Environment.Exit(0);

                return;
            }

            // Application is closing when it doesn't have any window instance therefore it's
            // required to create MainWindow before creating the initial configuration dialog
            var main = CreateMainWindow();

            if (main == null)
            {
                Environment.Exit(0);

                return;
            }

            // Initialize Profile Manager
            if (!InitializeProfileManager(main))
            {
                Log.Info("Application closes due to invalid configuration");

                // Since the main window instance was already created we need to "dispose" it by showing and closing.
                main.Width  = 0;
                main.Height = 0;
                main.Show();
                main.Close();

                Environment.Exit(0);

                return;
            }

            // Check if user accepted agreement
            var agreementAcceptedFilePath = Path.Combine(ApplicationManager.TempFolder, "agreement-accepted.txt");

            if (!File.Exists(agreementAcceptedFilePath))
            {
                WizardPipelineManager.Start("agreement", main, new ProcessorArgs(), false, null, () => null);
                if (!File.Exists(agreementAcceptedFilePath))
                {
                    Environment.Exit(0);

                    return;
                }
            }

            // Clean up garbage
            CoreApp.DeleteTempFolders();

            LoadIocResourcesForSolr();

            InitializeTelemetry();
            Telemetry.Analytics.Track(TelemetryEvent.AppRun);

            // Show main window
            try
            {
                main.Initialize();
                WindowHelper.ShowDialog(main, null);
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("Main window caused unhandled exception", true, ex);
            }


            CoreApp.Exit();

            Environment.Exit(0);
        }
Пример #16
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     WizardPipelineManager.Start("multipleDeletion", mainWindow, new MultipleDeletionArgs(new List <string>()), null, ignore => OnWizardCompleted(), () => new MultipleDeletionWizardArgs());
 }
        protected override void OnStartup([CanBeNull] StartupEventArgs e)
        {
            base.OnStartup(e);

            // Ensure we are running only one instance of process
            if (!App.AcquireSingleInstanceLock())
            {
                try
                {
                    // Change exit code to some uniqueue value to recognize reason of the app closing
                    LifeManager.ShutdownApplication(APP_DUPLICATE_EXIT_CODE);
                }
                catch (Exception ex)
                {
                    Log.Error("An unhandled error occurred during shutting down", this, ex);
                }

                return;
            }

            try
            {
                // If this is restart, wait until the master instance exists.
                LifeManager.WaitUntilOriginalInstanceExits(e.Args);

                // Capture UI sync context. It will allow to invoke delegats on UI thread in more elegant way (rather than use Dispatcher directly).
                LifeManager.UISynchronizationContext = SynchronizationContext.Current;
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("An unhandled error occurred during LifeManager work", true, ex);
            }

            App.LogMainInfo();

            // Initializing pipelines from Pipelines.config and WizardPipelines.config files
            if (!App.InitializePipelines())
            {
                LifeManager.ShutdownApplication(APP_PIPELINES_ERROR);
                return;
            }

            // Application is closing when it doesn't have any window instance therefore it's
            // required to create MainWindow before creating the initial configuration dialog
            var main = App.CreateMainWindow();

            if (main == null)
            {
                LifeManager.ShutdownApplication(APP_NO_MAIN_WINDOW);
                return;
            }

            // Initialize Profile Manager
            if (!App.InitializeProfileManager(main))
            {
                Log.Info("Application closes due to invalid configuration", typeof(App));

                // Since the main window instance was already created we need to "dispose" it by showing and closing.
                main.Width  = 0;
                main.Height = 0;
                main.Show();
                main.Close();
                LifeManager.ShutdownApplication(2);
                return;
            }

            // Check if user accepted agreement
            var agreementAcceptedFilePath = Path.Combine(ApplicationManager.TempFolder, "agreement-accepted.txt");

            if (!File.Exists(agreementAcceptedFilePath))
            {
                WizardPipelineManager.Start("agreement", main, new ProcessorArgs(), false);
                if (!File.Exists(agreementAcceptedFilePath))
                {
                    return;
                }
            }

            // Run updater
            App.RunUpdater();

            // Initializing plugins asynchronously
            PluginManager.Initialize();

            // Clean up garbage
            App.DeleteTempFolders();

            // Show main window
            try
            {
                main.Initialize();
                WindowHelper.ShowDialog(main, null);
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("Main window caused unhandled exception", true, ex, typeof(App));
            }
        }