コード例 #1
0
 private void parent(object sender, EventArgs e)
 {
     try
     {
         var newAssetCategoriesDb = Database.Category.GetCategoryWithParents(_connection, _globalCategoryID.ParentID);
         _AssetCategoryTable      = new ObservableCollection <CategoryDbTable>(newAssetCategoriesDb);
         CategoryList.ItemsSource = _AssetCategoryTable;
         var assetCategory = Database.Category.GetMyvalueByCategoryID(_connection, _globalCategoryID.ParentID);
         if (_globalCategoryID.ParentID == 0)
         {
             _categoryHeader.Text = "Root Categories";
             _globalCategoryID    = null;
             base.OnAppearing();
         }
         else
         {
             _categoryHeader.Text = assetCategory.First().AssetCategoryName;
             _categoryIDInternal  = assetCategory.First().AssetCategoryIDInternal;
             _globalCategoryID    = assetCategory.First();
             base.OnAppearing();
         }
     }
     catch (Exception exc)
     {
         //throw (exc);
         DependencyService.Get <IError>().SendRaygunError(exc, Application.Current.Properties["user"].ToString() ?? "unsynced", Application.Current.Properties["url"].ToString() ?? "unsynced", null);
         DisplayAlert("Error", "Unable to do that.", "OK");
     }
 }
コード例 #2
0
        private void CategoryList_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var assetCategory        = e.Item as CategoryDbTable;
            var newAssetCategoriesDb = Database.Category.GetCategoryWithParents(_connection, assetCategory.AssetCategoryID);

            _globalCategoryID = assetCategory;
            if (newAssetCategoriesDb.Count() > 0)
            {
                _AssetCategoryTable      = new ObservableCollection <CategoryDbTable>(newAssetCategoriesDb);
                CategoryList.ItemsSource = _AssetCategoryTable;
                _categoryIDInternal      = assetCategory.AssetCategoryIDInternal;
                _categoryHeader.Text     = assetCategory.AssetCategoryName;
                base.OnAppearing();
            }
            else
            {
                //select it
                MessagingCenter.Send(this, "AssetCategoryID", _globalCategoryID.AssetCategoryIDInternal);
                Navigation.PopModalAsync();
            }
        }