Exemplo n.º 1
0
        public override async Task Run(object prm)
        {
            if (IsRunning)
            {
                return;
            }
            IsRunning = true;
            try
            {
                if (!_isJabberRunning)
                {
                    var username = Settings.JabberModule.Username;
                    var password = Settings.JabberModule.Password;
                    var domain   = Settings.JabberModule.Domain;

                    try
                    {
                        var xmppWrapper = new ReconnectXmppWrapper(domain, username, password);
                        xmppWrapper.Connect(null);
                        _isJabberRunning = true;
                    }
                    catch (Exception ex)
                    {
                        await LogHelper.LogEx(ex.Message, ex, Category);

                        _isJabberRunning = false;
                    }
                }
            }
            finally
            {
                IsRunning = false;
            }
        }
Exemplo n.º 2
0
        public override async Task Run(object prm)
        {
            var username = SettingsManager.Get("jabber", "username");
            var password = SettingsManager.Get("jabber", "password");
            var domain   = SettingsManager.Get("jabber", "domain");

            if (!IsRunning)
            {
                try
                {
                    var xmppWrapper = new ReconnectXmppWrapper(domain, username, password);
                    xmppWrapper.Connect(null);
                    IsRunning = true;
                }
                catch (Exception ex)
                {
                    await LogHelper.LogEx(ex.Message, ex, Category);

                    IsRunning = false;
                }
            }
        }