private async Task LoadedAsync() { if (!_loaded && !ModernUIHelper.IsInDesignMode && _clientChannel != null) { await ExecuteAsync(async() => { // Events for notification await _clientChannel.SetResourceAsync( LimeUri.Parse(UriTemplates.RECEIPT), new Receipt { Events = new[] { Event.Accepted, Event.Received, Event.Consumed } }, _receiveTimeout.ToCancellationToken()); try { // Gets the user account Account = await _clientChannel.GetResourceAsync <Account>( LimeUri.Parse(UriTemplates.ACCOUNT), _receiveTimeout.ToCancellationToken()); } catch (LimeException ex) { if (ex.Reason.Code != ReasonCodes.COMMAND_RESOURCE_NOT_FOUND) { throw; } } // Creates the account if doesn't exists if (Account == null) { Account = new Account { IsTemporary = false, AllowAnonymousSender = false, AllowUnknownSender = false }; await _clientChannel.SetResourceAsync( LimeUri.Parse(UriTemplates.ACCOUNT), Account, _receiveTimeout.ToCancellationToken()); } // Gets the roster await GetContactsAsync(); // Sets the presence Presence = new Presence { Status = PresenceStatus.Available, RoutingRule = RoutingRule.Identity }; await SetPresenceAsync(); _loaded = true; }); } }