예제 #1
0
        public async Task StartUpAsync()
        {
            try {
                int id = await BrokerManager.CreateOrAttachToBrokerInstanceAsync(_logger);

                if (id != 0)
                {
                    await SetStatusTextAsync(Monitor.Resources.Status_BrokerStarted.FormatInvariant(id));
                }
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                _logger?.LogError(Monitor.Resources.Error_StartUpFailed, ex.Message);
                await SetErrorTextAsync(ex.Message);
            }
        }
예제 #2
0
        public async Task StartUpAsync()
        {
            try {
                int id = 0;
                if (Properties.Settings.Default.UseDifferentBrokerUser)
                {
                    if (await CredentialManager.IsBrokerUserCredentialSavedAsync(_logger))
                    {
                        id = await BrokerManager.CreateOrAttachToBrokerInstanceAsync(_logger);
                    }
                    else
                    {
                        await SetErrorTextAsync(Monitor.Resources.Info_DidNotFindSavedCredentails);

                        var count = await CredentialManager.GetAndSaveCredentialsFromUserAsync(_logger);

                        if (count >= CredentialManager.MaxCredUIAttempts)
                        {
                            await SetErrorTextAsync(Monitor.Resources.Info_TooManyLoginAttempts);
                        }
                    }
                }
                else
                {
                    id = await BrokerManager.CreateOrAttachToBrokerInstanceAsync(_logger);
                }

                if (id != 0)
                {
                    await SetStatusTextAsync(Monitor.Resources.Status_BrokerStarted.FormatInvariant(id));
                }
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                _logger?.LogError(Monitor.Resources.Error_StartUpFailed, ex.Message);
                await SetErrorTextAsync(ex.Message);
            }
        }
예제 #3
0
 private void StopBrokerBtn_Click(object sender, RoutedEventArgs e)
 {
     BrokerManager.StopBrokerInstanceAsync(_logger).DoNotWait();
     SetStatusTextAsync(Monitor.Resources.Status_BrokerStopped).Task.DoNotWait();
 }
예제 #4
0
 private void StartBrokerBtn_Click(object sender, RoutedEventArgs e)
 {
     BrokerManager.ResetAutoStart();
     StartUpAsync().DoNotWait();
 }