示例#1
0
        public async Task StartAsync()
        {
            Logger.SetLogMe(this);

            try
            {
                if (workerClient != null)
                {
                    await workerClient.StopAsync();
                }

                appCrash = new AppCrash();
                CrashReportWindow.AppCrash = appCrash;
                CrashReportWindow.OnReport = HandleCrashReport;
                appCrash.Register(typeof(CrashReportWindow));
                appCrash.ProductName = SystemInfo.GetAppName();

                var appName           = SystemInfo.GetAppName();
                var clientId          = GetClientId(appName);
                var mqttIWorkerClient = new MqttIWorkerClient(clientId, url, appName);
                mqttIWorkerClient.CommandHandler = this;
                await mqttIWorkerClient.StartAsync();

                workerClient = mqttIWorkerClient;
            }
            catch (Exception ex)
            {
                Logger.E("Error while starting " + GetType().Name, ex);
            }
        }
示例#2
0
        public void Initialize(Exception exception, string productName, string devMail)
        {
            var report = AppCrash?.GenerateReport(exception, productName);

            if (!string.IsNullOrEmpty(report))
            {
                OnReport?.Invoke(report);
            }
        }