Esempio n. 1
0
        public async Task Run(string txtCaseNr, Action <string, MessageLevels, string> notify)
        {
            _notify = notify;
            var caseNr = txtCaseNr?.Trim().Replace("_", "") + "";

            if (!string.IsNullOrEmpty(caseNr))
            {
                caseNr += "_";
            }
            Settings.ApplicatonBaseName = "SenseCollector";
            var resultPathRutine = new GetOutputFolder().FallbackRutine(Settings.ApplicatonBaseName);

            Settings.LogFilePath      = Path.Combine(resultPathRutine, "SenseCollector.log");
            Settings.OutputFolderPath = resultPathRutine;
            Log.Init(Settings.LogFilePath);                                                        //todo: remove and move into local log implimentation. Warning init with empty string will create a device zero logging.
            _logger.Add($"started with version {Application.ProductVersion}");
            _notify("Connecting to Qlik Sense Installation", MessageLevels.Animate, "Connecting"); //,ServiceRunStatus.Running, "Connection");

            CollectorService = new SenseCollectorService(_logger, _notify, DoneAction)
            {
                ConnectToSenseApiManuallyDlg = ShowConnectionFailuresDialogue,
                PathToSenseLogFolderDlg      = ShowSenseLogFolderDialogue,
                PathToArchivedLogsDlg        = ShowArchivedLogsFolderDialogue,
            };
            //_settings.StartDateForLogs = _startDate;
            //_settings.StopDateForLogs = _stopDate;
            Settings.UseOnlineDelivery = false; //chkOnline.Checked;
            Settings.AllowRemoteLogs   = FreyrCollectorCommon.Common.Settings.AllowRemoteLogs;
            Settings.AllowArchivedLogs = FreyrCollectorCommon.Common.Settings.AllowArchivedLogs;

            Settings.AllowSenseInfo = FreyrCollectorCommon.Common.Settings.AllowSenseInfo;
            Settings.DnsHostName    = (Dns.GetHostEntry(Dns.GetHostName()).HostName).ToLower();
            Settings.CustomerKey    = "";
            Settings.Key            = caseNr;

            try
            {
                await CollectorService.Start(Settings).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Log.Add("Failed accessing installation.", ex);
                DoneAction.Invoke(@"Failed accessing installation.", @"We unfortunately had a problem reading the Qlik Sense installation. You will have to manually send us your logs.", CollectorService);
            }
        }
Esempio n. 2
0
        private void Done(string header, string msg, SenseCollectorService service)
        {
            if (service.AbortAndExit)
            {
                Close();
                return;
            }
            ResetUi();
            if (!string.IsNullOrEmpty(msg))
            {
                Invoke(new Action(() =>
                {
                    MessageBox.Show(this, msg, header);
                    //MessageBox.Show(this,$@"We are now finished collecting information. {Environment.NewLine}{Environment.NewLine}Hopefully we will solve your issue shortly.", @"Qlik Diagnostics has finished");
                }));
            }

            if (!string.IsNullOrEmpty(service.ServiceVariables.CollectorOutput.ZipFile) && File.Exists(service.ServiceVariables.CollectorOutput.ZipFile))
            {
                Process.Start("c:\\windows\\explorer.exe", $"/select,\"{service.ServiceVariables.CollectorOutput.ZipFile}\"");
            }

            ResetUiFinished();
        }