private void CreateControls() { this.lblCategory = new ToolbarLabel(0, "lblCategory", "lbl_category"); this.lblTypes = new ToolbarLabel(1, "lblTypes", "lbl_types"); this.btnAddType = new TaxDataStore.Presentation.Controls.FlatButton(2, "btnAdd", "add", "add"); this.btnDeleteType = new TaxDataStore.Presentation.Controls.FlatButton(3, "btnDelete", "delete", "delete"); this.tlpButtons.Controls.Add(this.btnDeleteType, 2, 0); this.tlpButtons.Controls.Add(this.btnAddType, 1, 0); this.tlpToolbar.Controls.Add(this.lblCategory, 0, 0); this.tlpButtons.Controls.Add(this.lblTypes, 0, 0); this.flvclasses = new FlatGridView(); this.flvclasses.ColumnHeadersVisible = false; this.flvclasses.Margin = new Padding(0, 0, 0, 0); this.flvclasses.DataSource = DomainModel.Categories.GetAll(); this.clvTypes = new CategoryListView(); this.btnAddType.Click += new System.EventHandler(btnAddType_Click); this.btnDeleteType.Click += new System.EventHandler(btnDeleteType_Click); }
//CATEGORIES public ActionResult CategoriesList(int page = 1, int?cattype = null, int?parentcat = null) { ViewBag.ParentCategories = new SelectList(repository.PureCategories().ToList(), "Id", "Title");//категории для формирования DropListDown ViewBag.CategoryTypes = new SelectList(repository.CategoryTypes.ToList(), "Id", "Title"); List <Category> cats = new List <Category>(); cats = repository.Categories(page, cattype, parentcat).ToList();//категории страницы List <Category> totalcats = new List <Category>(); totalcats = repository.Categories(cattype, parentcat).ToList();//всего категорий в выбранной родительской //формируем модель для отображения CategoryListView model = new CategoryListView { cattype = cattype, parentcat = parentcat, Categories = cats, paginginfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = totalcats.Count() } }; return(View(model)); }
public CategoryListViewModel(CategoryListView categoryListView) { this.categoryListView = categoryListView; this.categoryManager = new MySQLManager<Category>(DataConnectionResource.LOCALMYQSL); this.categoryListView.AddB.Click += AddB_Click; this.categoryListView.EditBtn.Click += EditBtn_Click; Load(); }
private void NextCommandHandler() { // Category CategoryListView.MoveCurrentToNext(); if (CategoryListView.IsCurrentAfterLast == true) { CategoryListView.MoveCurrentToLast(); } }
public UIElement GetListView() { CategoryListViewModel viewModel = new CategoryListViewModel(factory, this); CategoryListView view = new CategoryListView(viewModel); Window window = WindowFactory.CreateByContentsSize(view); viewModel.CategorySelected += (s, e) => OnSelect(e.Data); return(view); }
private void PreviousCommandHandler() { // Category CategoryListView.MoveCurrentToPrevious(); if (CategoryListView.IsCurrentBeforeFirst == true) { CategoryListView.MoveCurrentToFirst(); } }
public DesignerListViews() { Control control = null; control = new AllListView(new ListViewModel("All", itemService)); this.Add(control); control = new RecentListView(new ListViewModel("Recent", itemService)); this.Add(control); control = new CategoryListView(new CategoryListViewModel("Categorized", itemService)); this.Add(control); }
private void UnselectAllListViewItems(params ListViewItem[] excepts) { var allListViewItems = CategoryListView.FindDescendants <ListViewItem>() .SelectMany(listViewItem => listViewItem.FindDescendants <ListViewItem>()) .Union(CategoryListView.FindDescendants <ListViewItem>()) .Except(excepts); foreach (var listViewItem in allListViewItems) { listViewItem.IsSelected = false; } }
public PartialViewResult Menu(string category = null) { var categories = new CategoryListView { Categories = repository.Products .Select(x => x.Category) .Distinct() .OrderBy(x => x), CurrentCategory = category }; return(PartialView(categories)); }
private void SetListViewSelectionMode(ListViewSelectionMode listViewSelectionMode, params ListView[] excepts) { var listViews = CategoryListView.FindDescendants <ListView>() .Union(new List <ListView> { CategoryListView }) .Except(excepts); foreach (var listView in listViews) { listView.SelectionMode = listViewSelectionMode; } }
private async void DoneOnClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if (CategoryRepository.Selected.Name == String.Empty) { var dialog = new MessageDialog(Translation.GetTranslation("NameRequiredMessage"), Translation.GetTranslation("MandatoryField")); dialog.Commands.Add(new UICommand(Translation.GetTranslation("OkLabel"))); dialog.DefaultCommandIndex = 1; await dialog.ShowAsync(); } CategoryRepository.Save(CategoryRepository.Selected); CategoryListView.SearchText = String.Empty; CategoryListView.Search(); }
private void InitializeSettingsList() { SettingsTabPanels = new List <SettingsTabNode>() { new SettingsTabNode(SettingTab.LddEnvironment, lddSettingsPanel1), new SettingsTabNode(SettingTab.EditorSettings, editorSettingsPanel1), new SettingsTabNode(SettingTab.LayoutSettings, displaySettingsPanel1) }; CategoryListView.Columns.Add(new OLVColumn() { FillsFreeSpace = true, AspectGetter = (item) => (item as SettingsTabNode).Text, Groupable = false }); CategoryListView.SetObjects(SettingsTabPanels); CategoryListView.SelectedIndex = 0; }
private async void SetCatalogueList() { try { var catalogueSet = await RewardsHelper.GetCatalogueSet(UserSessionInfo); CategoryListView.DataSource = catalogueSet.Tables[0]; var dataTable = (DataTable)CategoryListView.DataSource; var dataRowAll = dataTable.NewRow(); dataRowAll["categoryId"] = "0"; dataRowAll["categoryName"] = RewardsHelper.GetTranslation(TranslationKeys.Label.All); dataRowAll["imagePathOn"] = string.Empty; dataRowAll["imagePathOff"] = string.Empty; dataTable.Rows.InsertAt(dataRowAll, 0); CategoryListView.DataBind(); } catch (Exception) {} }
public List <CategoryListView> ConvertDataModelToListView(List <Category> categories) { List <CategoryListView> listView = new List <CategoryListView>(); for (var i = 0; i < categories.Count; i++) { CategoryListView item = new CategoryListView(); item.Id = categories[i].Id; item.Name = categories[i].Name; item.StartRange = categories[i].StartRange; item.FinishRange = categories[i].FinishRange; item.IconPath = "/CategoryIcon/" + categories[i].IconPath; item.IndexNumber = i + 1; listView.Add(item); } return(listView); }
public void Configure(Container container) { container.Register <IMessageBoxService>(c => new MessageBoxService()); container.Register <ITaskDialogService>(c => new MessageBoxService()); container.Register <INavigationService>(c => new NavigationService()); container.Register <IEnumerable <object> >("MainListViews", c => { Control control = null; List <object> listViews = new List <object>(); control = new AllListView(new ListViewModel("All", c.Resolve <IItemService>())); listViews.Add(control); control = new RecentListView(new ListViewModel("Recent", c.Resolve <IItemService>())); listViews.Add(control); control = new CategoryListView(new CategoryListViewModel("Categorized", c.Resolve <IItemService>())); listViews.Add(control); return(listViews); }); }
public CategoryListPage(string title = null, bool isPerformingProductSelection = false) { if (title == null) { Title = "Products"; } SetBinding(Page.TitleProperty, new Binding("Category", converter: new CategoryTitleConverter(Title))); #region category list CategoryListView categoryListView = new CategoryListView(); categoryListView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, "SubCategories"); categoryListView.IsPullToRefreshEnabled = true; categoryListView.SetBinding(ListView.RefreshCommandProperty, "LoadCategoriesCommand"); categoryListView.SetBinding(ListView.IsRefreshingProperty, "IsBusy", mode: BindingMode.OneWay); categoryListView.ItemTapped += async(sender, e) => { Category catalogCategory = ((Category)e.Item); if (catalogCategory.HasSubCategories) { await Navigation.PushAsync(new CategoryListPage(catalogCategory.Name, isPerformingProductSelection) { BindingContext = new CategoriesViewModel(catalogCategory) }); } else { await Navigation.PushAsync(new ProductListPage(catalogCategory.Name, isPerformingProductSelection) { BindingContext = new ProductsViewModel(catalogCategory.Id) }); } }; #endregion #region compose view hierarchy Content = new UnspacedStackLayout() { Children = { categoryListView } }; #endregion }
public CategoryRegistrationViewModel(IUnityContainer container) { // Resolve services _regionManager = container.Resolve <IRegionManager>(); _categoryService = container.Resolve <ICategoryService>(); _eventAggregator = container.Resolve <IEventAggregator>(); // Get data from Database Initialization = InitializeCategoryListAsync(); CategoryListView.MoveCurrentToFirst(); _title = "-Product Management Category Title-"; _currentCommand = CompleetKassa.Module.ProductManagement.Definitions.Enumeration.Commands.None; NewCategoryFormVisibility = false; EnableCategoryList = true; ReadOnlyNewCategoryForm = true; SetCategoryValidationRules(); // Event Handler OnFirstCommand = new DelegateCommand(FirstCommandHandler); OnPreviousCommand = new DelegateCommand(PreviousCommandHandler); OnNextCommand = new DelegateCommand(NextCommandHandler); OnLastCommand = new DelegateCommand(LastCommandHandler); OnAddCommand = new DelegateCommand(AddCommandHandler); OnEditCategoryCommand = new DelegateCommand <CategoryModel>(EditCategoryCommandHandler); OnSaveCommand = new DelegateCommand(SaveCommandHandler); OnDeleteCategoryCommand = new DelegateCommand <CategoryModel>(DeleteCategoryCommandHandler); OnCancelCommand = new DelegateCommand(CancelCommandHandler); OnCloseCommand = new DelegateCommand(CloseCommandHandler); }
public CategoryListPage(string title = null, bool isPerformingProductSelection = false) { if (title == null) { Title = "Products"; } SetBinding(CategoryListPage.TitleProperty, new Binding("Category", converter: new CategoryTitleConverter(Title))); #region category list CategoryListView categoryListView = new CategoryListView(); categoryListView.SetBinding(CategoryListView.ItemsSourceProperty, "SubCategories"); categoryListView.IsPullToRefreshEnabled = true; categoryListView.SetBinding(CategoryListView.RefreshCommandProperty, "LoadCategoriesCommand"); categoryListView.SetBinding(CategoryListView.IsRefreshingProperty, "IsBusy", mode: BindingMode.OneWay); categoryListView.ItemTapped += async(sender, e) => await App.ExecuteIfConnected(async() => { CatalogCategory catalogCategory = ((CatalogCategory)e.Item); if (catalogCategory.HasSubCategories) { await Navigation.PushAsync(new CategoryListPage(catalogCategory.Name, isPerformingProductSelection) { BindingContext = new CategoriesViewModel(catalogCategory) }); } else { await Navigation.PushAsync(new ProductListPage(catalogCategory.Name, isPerformingProductSelection) { BindingContext = new ProductsViewModel(catalogCategory.Id) }); } }); categoryListView.SetBinding(CategoryListView.HeaderProperty, "."); categoryListView.HeaderTemplate = new DataTemplate(() => { Label loadingLabel = new Label() { Text = TextResources.Products_CategoryList_LoadingLabel, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), XAlign = TextAlignment.Center, YAlign = TextAlignment.End, TextColor = Palette._007 }; loadingLabel.SetBinding(Label.IsEnabledProperty, "IsBusy", mode: BindingMode.OneWay); loadingLabel.SetBinding(Label.IsVisibleProperty, "IsBusy", mode: BindingMode.OneWay); return(loadingLabel); }); #endregion #region compose view hierarchy Content = new UnspacedStackLayout() { Children = { categoryListView } }; #endregion }
private void FirstCommandHandler() { // Category CategoryListView.MoveCurrentToFirst(); }
private void LastCommandHandler() { CategoryListView.MoveCurrentToLast(); }