void CheckInstallation()
        {
            Thread.Sleep(200);

            var exit = SeqForwarderExeUtility.Run("install --setup", WriteOutput, WriteError);

            _dispatcher.Invoke(() =>
            {
                IsDone    = true;
                HasFailed = HasFailed || exit != 0;
            });
        }
        void Install()
        {
            Thread.Sleep(200);

            var exit = 0;

            if (SeqForwarderExeUtility.DefaultInstanceIsInstalled())
            {
                WriteOutput("An existing service instance was detected; removing the service entry...");
                SeqForwarderExeUtility.Run("stop", delegate { }, delegate { });
                exit = SeqForwarderExeUtility.Run("uninstall", WriteOutput, WriteError);
            }

            if (exit == 0)
            {
                exit = SeqForwarderExeUtility.Run($"install --storage=\"{_storagePath}\"", WriteOutput, WriteError);
            }

            if (exit == 0)
            {
                exit = SeqForwarderExeUtility.Run($"config -k output.serverUrl --value=\"{_serverUrl}\"", WriteOutput, WriteError);
            }

            if (exit == 0 && !string.IsNullOrWhiteSpace(_apiKey))
            {
                exit = SeqForwarderExeUtility.Run($"config -k output.apiKey --value=\"{_apiKey}\"", WriteOutput, WriteError);
            }

            if (exit == 0)
            {
                exit = SeqForwarderExeUtility.Run("start", WriteOutput, WriteError);
            }

            _dispatcher.Invoke(() =>
            {
                IsDone    = true;
                HasFailed = HasFailed || exit != 0;
            });
        }