示例#1
0
        private async void InitSynchronizationTasks()
        {
            await Task.Run(() => _phoneService.AddPushToken());

            await Task.Run(async() =>
            {
                while (true)
                {
                    await Task.Delay(10000);
                    var didReceiveMessages = _messageService.FetchMessages();
                    var didReceiveContacts = _messageService.FetchContacts();
                    if (didReceiveContacts || didReceiveMessages)
                    {
                        _messenger.Publish(new ContentReceivedMessage(this));
                    }
                }
            }).ConfigureAwait(false);
        }