// Initialize Stuff public async void Initialize() { BackgroundTaskUtils.RegisterToastNotificationBackgroundTasks(); ContactUtils.AssignAppToPhoneContacts(); _store = await ChatMessageManager.RequestStoreAsync(); ChatConversations = await GetChats(); if (ChatConversations.Count != 0) { SelectedItem = ChatConversations[0]; } if (!(await PerformMandatoryChecks())) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { await new CellularUnavailableContentDialog().ShowAsync(); }); } _store.ChangeTracker.Enable(); _store.StoreChanged += Store_StoreChanged; }
private async void Load() { BackgroundTaskUtils.RegisterToastNotificationBackgroundTasks(); ContactUtils.AssignAppToPhoneContacts(); ChatMessageStore store = await ChatMessageManager.RequestStoreAsync(); var reader = store.GetConversationReader(); var convos = await reader.ReadBatchAsync(); bool initializedonce = false; foreach (var convo in convos) { NavigationView.MenuItems.Add(new ChatMenuItemControl(convo)); if (!initializedonce) { NavigationView.SelectedItem = NavigationView.MenuItems[0]; } initializedonce = true; } }