public PassListPage() { this.InitializeComponent(); Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { // Your UI update code goes here! WebPasses = new ObservableCollection <WebPass>(await WebPassManager.GetWebPassesAsync()); passList.ItemsSource = null; passList.ItemsSource = WebPasses; } ).AsTask(); }
private async void BtnSave_Click(object sender, RoutedEventArgs e) { var pass = new WebPass(); pass.Id = Guid.NewGuid(); pass.Host = boxWebHost.Text; pass.Uri = boxWebHost.Text; pass.Username = boxUsername.Text; pass.Password = boxPassword.Password; //Task.Run(async () => await WebPassManager.Add(pass)); await WebPassManager.Add(pass); MainPage.ContentFrame.Navigate(typeof(PassListPage)); }
private void MfDel_Click(object sender, RoutedEventArgs e) { if (passList.SelectedItems != null && passList.SelectedItems.Count > 0) { foreach (var item in passList.SelectedItems.OfType <WebPass>().ToList()) { WebPasses.Remove(item); Task.Run(async() => await WebPassManager.Delete(item)); passList.ItemsSource = null; passList.ItemsSource = WebPasses; } } else { } }
private void PassList_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e) { Task.Run(async() => await WebPassManager.SaveAsync(WebPasses.ToList())); }