private async void OnPageLoaded(object sender, RoutedEventArgs e) { //TestDataGrid.MaxWidth = DataGrid.ActualWidthProperty; try { var info = await CommandsToWorkWithDB.GetProductsAsync(); if (info != null) { foreach (var item in info) { Info.Add(item); } } else { ContentDialog dialog = new ContentDialog() { Title = "DataBase connection problem.", Content = "No data from Database provided, please login into db", PrimaryButtonText = "ОК", }; await dialog.ShowAsync(); } } catch (Exception ex) { throw ex; } }
private async void nvSample_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) { Debug.WriteLine(Windows.Storage.ApplicationData.Current.LocalFolder.Path); if (args.IsSettingsSelected) { contentFrame.Navigate(typeof(Settings)); } else { Model = null; var selectedItem = (Microsoft.UI.Xaml.Controls.NavigationViewItem)args.SelectedItem; if (selectedItem != null) { string selectedItemTag = ((string)selectedItem.Tag); foreach (var item in Info) { if (item.NameOfPlace == selectedItemTag) { GridRing.IsActive = true; File.Delete(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\" + "Out.xml"); Model = await CommandsToWorkWithDB.GetXML(item, Info); GridRing.IsActive = false; DGBig.IsEnabled = true; GridFilling(item.NameOfPlace); } } } } }
private void XMLBtn_Click(object sender, RoutedEventArgs e) { var item = (Model)TestDataGrid.SelectedItem; var xml = CommandsToWorkWithDB.GetXML(item, Info); contentFrame.Navigate(typeof(VSD), xml); }
private async void Page_Loaded(object sender, RoutedEventArgs e) { ConnHolder.SetConnStr(@"Data Source=78.140.21.18;Initial Catalog=td010119; User Id=tdmerc; Password=tdmerc123;"); var info = await CommandsToWorkWithDB.GetProductsAsync(); Info = info; List <Microsoft.UI.Xaml.Controls.NavigationViewItem> navigationViewItems = new List <Microsoft.UI.Xaml.Controls.NavigationViewItem>(); for (int i = 0; i < info.Count; i++) { navigationViewItems.Add(new Microsoft.UI.Xaml.Controls.NavigationViewItem { Tag = info[i].NameOfPlace, Content = info[i].NameOfPlace }); } Microsoft.UI.Xaml.Controls.NavigationViewItem Places = new Microsoft.UI.Xaml.Controls.NavigationViewItem(); Places.Tag = "Places"; Places.Content = "Площадки"; Places.MenuItemsSource = navigationViewItems; nvSample.MenuItems.Add(Places); }