private static bool OpenSolution(string root)
        {
            var path = FileSystem.FileSystem.Local.Directory.GetFiles(root, "*.sln", SearchOption.TopDirectoryOnly).SingleOrDefault() ?? FileSystem.FileSystem.Local.Directory.GetFiles(root, "*.csproj", SearchOption.TopDirectoryOnly).SingleOrDefault();

            if (!string.IsNullOrEmpty(path) && FileSystem.FileSystem.Local.File.Exists(path))
            {
                CoreApp.RunApp(path);
                return(true);
            }

            return(false);
        }
示例#2
0
        public void UpdateCollections(IEnumerable <string> files)
        {
            TracksManager tracksManager = new TracksManager();

            AddToCollection(Tracks, tracksManager.GetTracksList(files));
            AddToCollection(Artists, tracksManager.GetArtists(Tracks));
            AddToCollection(Albums, tracksManager.GetAlbums(Tracks));

            CoreApp.InitializatePlayer(Tracks);
            CoreApp.Player.CurrentTrackChanged += Player_CurrentTrackChanged;
            CoreApp.Player.PositionChanged     += Player_PositionChanged;
        }
        public void Execute([NotNull] string path, string arguments = null)
        {
            Assert.ArgumentNotNull(path, nameof(path));

            if (arguments.EmptyToNull() == null)
            {
                CoreApp.RunApp(path);
                return;
            }

            CoreApp.RunApp(path, arguments);
        }
        public static void Main([NotNull] string[] args)
        {
            Assert.ArgumentNotNull(args, "args");

            CoreApp.InitializeLogging();

            CoreApp.LogMainInfo();

            Analytics.Start();

            var filteredArgs = args.ToList();
            var query        = GetQueryAndFilterArgs(filteredArgs);
            var wait         = GetWaitAndFilterArgs(filteredArgs);

            var parser = new Parser(with => with.HelpWriter = Console.Error);

            Assert.IsNotNull(parser, "parser");

            var options = new MainCommandGroup();

            if (!parser.ParseArguments(filteredArgs.ToArray(), options, delegate { }))
            {
                Console.WriteLine("\r\n  --query\t      When specified, allows returning only part of any command's output");
                Console.WriteLine("\r\n  --wait\t       When specified, waits for keyboard input before terminating");
                Environment.Exit(Parser.DefaultExitCodeFail);
            }

            var result = options.SelectedCommand.Execute();

            result = QueryResult(result, query);
            if (result == null)
            {
                return;
            }

            var serializer = new JsonSerializer
            {
                NullValueHandling = NullValueHandling.Ignore,
                Formatting        = Formatting.Indented,
            };

            serializer.Converters.Add(new DirectoryInfoConverter());

            var writer = Console.Out;

            serializer.Serialize(writer, result);

            if (wait)
            {
                Console.ReadKey();
            }
        }
示例#5
0
        protected virtual void RunApp([NotNull] string path, [CanBeNull] string param)
        {
            Assert.ArgumentNotNullOrEmpty(path, nameof(path));

            if (param != null)
            {
                CoreApp.RunApp(path, param);
            }
            else
            {
                CoreApp.RunApp(path);
            }
        }
示例#6
0
        public static void OnReceivedURI(string uri)
        {
            global::System.EventHandler <string> handler = CoreApp._receivedURI;

            if (handler != null)
            {
                CoreApp.DispatchDelayedUri();
                handler(null, uri);
            }
            else
            {
                CoreApp._delayedURIS.Add(uri);
            }
        }
示例#7
0
 public MainWindow(string meno, string heslo)
 {
     InitializeComponent();
     CoreApp.Register(meno, heslo);
     TypyVoznov = NacitajTypyVoznovZDB();
     Vlastnici  = NacitajVlastnikovZDB();
     Stanice    = NacitajStaniceZDB();
     TypyVlakov = NacitajTypyVlakovZDB();
     Vozen      = new Vozen()
     {
         AktualnaPoloha = new Poloha()
     };
     ZamestnanecNovy = new Zamestnanec();
     DataContext     = this;
 }
        public static void Start()
        {
            if (CoreApp.DoNotTrack())
            {
                return;
            }

            Log.Debug("Insights - starting");

            try
            {
                var configuration = TelemetryConfiguration.Active;
                Assert.IsNotNull(configuration, "configuration");

                configuration.TelemetryChannel   = new PersistenceChannel("Sitecore Instance Manager");
                configuration.InstrumentationKey = "1447f72f-2d39-401b-91ac-4d5c502e3359";

                var client = new TelemetryClient(configuration)
                {
                    InstrumentationKey = "1447f72f-2d39-401b-91ac-4d5c502e3359"
                };

                Analytics.telemetryClient = client;
                try
                {
                    // ReSharper disable PossibleNullReferenceException
                    client.Context.Component.Version      = string.IsNullOrEmpty(ApplicationManager.AppVersion) ? "0.0.0.0" : ApplicationManager.AppVersion;
                    client.Context.Session.Id             = Guid.NewGuid().ToString();
                    client.Context.User.Id                = Environment.MachineName + "\\" + Environment.UserName;
                    client.Context.User.AccountId         = CoreApp.GetCookie();
                    client.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
                    // ReSharper restore PossibleNullReferenceException
                    client.TrackEvent("Start");
                    client.Flush();
                }
                catch (Exception ex)
                {
                    client.TrackException(ex);
                    Log.Error(ex, "Error in app insights");
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Error in app insights");
            }

            Log.Debug("Insights - started");
        }
        private bool ValidateAccount(string account)
        {
            if (account.Equals(@"NT SERVICE\MSSQLSERVER", StringComparison.OrdinalIgnoreCase))
            {
                var result = WindowHelper.ShowMessage("The SQL Server is configured to use \"NT SERVICE\\MSSQLSERVER\" account which is not supported by current version of SIM. You need to change the SQL Server's user account and click Grant again. The instruction will be provided when you click OK.", MessageBoxButton.OKCancel, MessageBoxImage.Error);

                if (result == MessageBoxResult.Cancel)
                {
                    return(false);
                }

                CoreApp.OpenInBrowser("https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Troubleshooting", true);
                return(false);
            }

            return(true);
        }
示例#10
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var webConfigPath = WebConfig.GetWebConfigPath(instance.WebRootPath);
         FileSystem.FileSystem.Local.File.AssertExists(webConfigPath, "The web.config file ({0}) of the {1} instance doesn't exist".FormatWith(webConfigPath, instance.Name));
         var editor = WindowsSettings.AppToolsConfigEditor.Value;
         if (!string.IsNullOrEmpty(editor))
         {
             CoreApp.RunApp(editor, webConfigPath);
         }
         else
         {
             CoreApp.OpenFile(webConfigPath);
         }
     }
 }
示例#11
0
        /// <summary>
        /// Creates the GUID.
        /// </summary>
        /// <returns>The GUID.</returns>
        /// <param name="cancelToken">Cancel token - For Api requests</param>
        public async Task <Guid> CreateGuid(CancellationToken cancelToken)
        {
            Guid id;

            try
            {
                await Task.Delay(5000); // wait 5 seconds

                id = Guid.NewGuid();
            }
            catch (Exception ex)
            {
                CoreApp.Log2Plataform("ERROR CreateGuid", ex.Message);
            }

            return(id);
        }
示例#12
0
        public static void EnterInteractive()
        {
            ApplicationState assert5;
            ApplicationState assert6;

            switch (CoreApp.State)
            {
            case ApplicationState.Terminating:
            {
                global::Uno.Diagnostics.Debug.Log("EnterInteractive() called on terminating application", global::Uno.Diagnostics.DebugMessageType.Debug, "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 128);
                return;
            }

            case ApplicationState.Uninitialized:
            {
                global::Uno.Diagnostics.Debug.Log("EnterInteractive() called on uninitialized application", global::Uno.Diagnostics.DebugMessageType.Debug, "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 132);
                return;
            }

            case ApplicationState.Background:
            {
                CoreApp.EnterForeground();
                break;
            }

            case ApplicationState.Foreground:
                break;

            case ApplicationState.Interactive:
                return;
            }

            assert5 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert5 == ApplicationState.Foreground, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Foreground", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 146, new object[] { (object)assert5, (object)ApplicationState.Foreground });
            CoreApp.State = ApplicationState.Interactive;
            ApplicationStateTransitionHandler handler = CoreApp.EnteringInteractive;

            if (handler != null)
            {
                handler(CoreApp.State);
            }

            assert6 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert6 == ApplicationState.Interactive, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Interactive", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 154, new object[] { (object)assert6, (object)ApplicationState.Interactive });
        }
示例#13
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                var filePath = FilePath.StartsWith("/") ? Path.Combine(instance.WebRootPath, FilePath.Substring(1)) : FilePath;
                FileSystem.FileSystem.Local.File.AssertExists(filePath, "The {0} file of the {1} instance doesn't exist".FormatWith(filePath, instance.Name));

                var editor = WindowsSettings.AppToolsConfigEditor.Value;
                if (!string.IsNullOrEmpty(editor))
                {
                    CoreApp.RunApp(editor, filePath);
                }
                else
                {
                    CoreApp.OpenFile(filePath);
                }
            }
        }
示例#14
0
        private async void CallWebServer()
        {
            var tokenSource = new CancellationTokenSource();
            var task        = WebServerService.Initiate.RequestView(_request, tokenSource.Token);

            if (task == await Task.WhenAny(task, Task.Delay(timeout, tokenSource.Token)))
            {
                Source = await task;
            }
            else
            {
                // Timeout
                tokenSource.Cancel();
                CoreApp.Log2Plataform("TIMEOUT CallWebServer", "Timeout de execucao");
                response      = new HtmlWebViewSource();
                response.Html = @"TIMEOUT DE EXECUÇÃO...";
                Source        = response;
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance == null)
            {
                return;
            }

            var paths = instance.GetVisualStudioSolutionFiles().ToArray();

            if (paths.Length > 0)
            {
                CoreApp.OpenFile(paths.First());
                return;
            }

            const string NoThanks     = "No, thanks";
            const string YesAspNetMvc = "Yes, create new";

            var options = new[] { NoThanks, YesAspNetMvc };
            var result  = WindowHelper.AskForSelection("Choose Visual Studio Project Type", null, "There isn't any Visual Studio project in the instance's folder. \n\nWould you like us to create a new one?", options, mainWindow);

            if (result == null || result == NoThanks)
            {
                return;
            }

            var packageName = "Visual Studio 2015 Website Project.zip";
            var product     = GetProduct(packageName);

            if (product == null)
            {
                WindowHelper.HandleError("The " + packageName + " package cannot be found in either the .\\Packages folder", false);
                return;
            }

            PipelineManager.StartPipeline("installmodules", new InstallModulesArgs(instance, new[] { product }), isAsync: false);
            var path = instance.GetVisualStudioSolutionFiles().FirstOrDefault();

            Assert.IsTrue(!string.IsNullOrEmpty(path) && FileSystem.FileSystem.Local.File.Exists(path), "The Visual Studio files are missing");

            CoreApp.OpenFile(path);
        }
示例#16
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance == null)
            {
                WindowHelper.ShowMessage("Choose an instance first");

                return;
            }

            var product = instance.Product;

            Assert.IsNotNull(product, $"The {instance.ProductFullName} distributive is not available in local repository. You need to get it first.");

            var version = product.Version + "." + product.Update;

            var args = new[]
            {
                version,
                instance.Name,
                instance.WebRootPath
            };

            var dir = Environment.ExpandEnvironmentVariables("%APPDATA%\\Sitecore\\PatchCreator");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            File.WriteAllLines(Path.Combine(dir, "args.txt"), args);

            CoreApp.RunApp("iexplore", $"http://dl.sitecore.net/updater/pc/PatchCreator.application");

            NuGetHelper.UpdateSettings();

            NuGetHelper.GeneratePackages(new FileInfo(product.PackagePath));

            foreach (var module in instance.Modules)
            {
                NuGetHelper.GeneratePackages(new FileInfo(module.PackagePath));
            }
        }
示例#17
0
        private void InitializeLogging()
        {
            var info = new LogFileAppender
            {
                AppendToFile    = true,
                File            = "$(logFolder)\\{0:yyyy-MM-dd}.txt",
                Layout          = new PatternLayout("%4t %d{ABSOLUTE} %-5p %m%n"),
                SecurityContext = new WindowsSecurityContext(),
                Threshold       = Level.Info
            };

            var debug = new LogFileAppender
            {
                AppendToFile    = true,
                File            = "$(logFolder)\\{0:yyyy-MM-dd}_DEBUG.txt",
                Layout          = new PatternLayout("%4t %d{ABSOLUTE} %-5p %m%n"),
                SecurityContext = new WindowsSecurityContext(),
                Threshold       = Level.Debug
            };

            CoreApp.InitializeLogging(info, debug);
        }
示例#18
0
        public static void EnterBackground()
        {
            ApplicationState assert9;
            ApplicationState assert10;

            switch (CoreApp.State)
            {
            case ApplicationState.Terminating:
                return;

            case ApplicationState.Uninitialized:
                return;

            case ApplicationState.Background:
                return;

            case ApplicationState.Foreground:
                break;

            case ApplicationState.Interactive:
            {
                CoreApp.ExitInteractive();
                break;
            }
            }

            assert9 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert9 == ApplicationState.Foreground, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Foreground", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 210, new object[] { (object)assert9, (object)ApplicationState.Foreground });
            CoreApp.State = ApplicationState.Background;
            ApplicationStateTransitionHandler handler = CoreApp.EnteringBackground;

            if (handler != null)
            {
                handler(CoreApp.State);
            }

            assert10 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert10 == ApplicationState.Background, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Background", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 218, new object[] { (object)assert10, (object)ApplicationState.Background });
        }
示例#19
0
        public static void Terminate()
        {
            ApplicationState assert11;
            ApplicationState assert12;

            switch (CoreApp.State)
            {
            case ApplicationState.Terminating:
            case ApplicationState.Uninitialized:
                return;

            case ApplicationState.Background:
                break;

            case ApplicationState.Foreground:
            case ApplicationState.Interactive:
            {
                CoreApp.EnterBackground();
                break;
            }
            }

            assert11 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert11 == ApplicationState.Background, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Background", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 238, new object[] { (object)assert11, (object)ApplicationState.Background });
            CoreApp.State = ApplicationState.Terminating;
            ApplicationStateTransitionHandler handler = CoreApp.Terminating;

            if (handler != null)
            {
                handler(CoreApp.State);
            }

            assert12 = CoreApp.State;
            global::Uno.Diagnostics.Debug.Assert(assert12 == ApplicationState.Terminating, "Uno.Platform.CoreApp.State == Uno.Platform.ApplicationState.Terminating", "Library/Core/UnoCore/Source/Uno/Platform/CoreApp.uno", 246, new object[] { (object)assert12, (object)ApplicationState.Terminating });
            CoreApp.State = ApplicationState.Uninitialized;
        }
示例#20
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);
        }
 public static void OpenProgramLogs()
 {
     CoreApp.OpenFolder(ApplicationManager.LogsFolder);
 }
示例#22
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            WindowHelper.ShowMessage("This function is no longer available. Use PatchCreator to generate NuGet packages for Sitecore CMS and Sitecore Modules.");

            CoreApp.OpenInBrowser("http://dl.sitecore.net/updater/pc", true);
        }
示例#23
0
 public WorkManager(CoreApp coreApp)
 {
     Debug.LogMessage("WorkManager.Ctor");
     this.coreApp = coreApp;
 }
示例#24
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     CoreApp.RunApp("iexplore", "http://dl.sitecore.net/updater/sspg/SSPG.application");
 }
示例#25
0
 public Input(CoreApp coreApp, WorkManager workManager)
 {
     Debug.LogMessage("Input.Ctor");
     this.workManager            = workManager;
     coreApp.CoreWindow.KeyDown += CoreWindow_KeyDown;
 }
示例#26
0
 private void Logout()
 {
     CoreApp.EndSession();
     //Model.Dispose();
     Close(this);
 }
 private void Logout()
 {
     CoreApp.StopReplication();
     Model.Dispose();
     Close(this);
 }
示例#28
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);
        }
示例#29
0
 private void RequestNavigate(object sender, RequestNavigateEventArgs e)
 {
     CoreApp.RunApp(new ProcessStartInfo(e.Uri.AbsoluteUri));
     e.Handled = true;
 }
 public static void OpenWebsiteFolder(InstallModulesWizardArgs args)
 {
     CoreApp.OpenFolder(args.Instance.WebRootPath);
 }