Exemple #1
0
        internal async void Instance_StatusChangedEvent(object sender, StatusChangedArgs args)
        {
            // Log StatusChangedArgs
            InstanceInfo info = ApplicationInfoManager.Instance.InstanceInfo;

            if (info != null)
            {
                RefreshInstanceInfo();
                if (info.IsDirty)
                {
                    try
                    {
                        var result = await RegisterAsync();

                        if (result)
                        {
                            info.IsDirty = false;
                            //Log
                        }
                    }
                    catch (Exception e)
                    {
                        _logger?.LogError("Instance_StatusChangedEvent Exception: {0}", e);
                    }
                }
            }
        }
        internal async void Instance_StatusChangedEvent(object sender, StatusChangedArgs args)
        {
            var info = _appInfoManager.InstanceInfo;

            if (info != null)
            {
                _logger?.LogDebug(
                    "Instance_StatusChangedEvent {previousStatus}, {currentStatus}, {instanceId}, {dirty}",
                    args.Previous,
                    args.Current,
                    args.InstanceId,
                    info.IsDirty);

                if (info.IsDirty)
                {
                    try
                    {
                        var result = await RegisterAsync().ConfigureAwait(false);

                        if (result)
                        {
                            info.IsDirty = false;
                            _logger?.LogInformation("Instance_StatusChangedEvent RegisterAsync Succeed");
                        }
                    }
                    catch (Exception e)
                    {
                        _logger?.LogError(e, "Instance_StatusChangedEvent RegisterAsync Failed");
                    }
                }
            }
        }