private CategoryMenuItem Map(Category category)
        {
            var categoryMenuItem = new CategoryMenuItem
            {
                Id = category.Id,
                Name = category.Name,
                SeoTitle = category.SeoTitle
            };

            var childCategories = category.Child;
            foreach (var childCategory in childCategories)
            {
                var childCategoryMenuItem = Map(childCategory);
                categoryMenuItem.AddChildItem(childCategoryMenuItem);
            }

            return categoryMenuItem;
        }
Example #2
0
        private CategoryMenuItem Map(Category category)
        {
            var categoryMenuItem = new CategoryMenuItem
            {
                Id   = category.Id,
                Name = category.Name,
                Slug = category.Slug
            };

            var childCategories = category.Children;

            foreach (var childCategory in childCategories.OrderByDescending(x => x.DisplayOrder))
            {
                var childCategoryMenuItem = Map(childCategory);
                categoryMenuItem.AddChildItem(childCategoryMenuItem);
            }

            return(categoryMenuItem);
        }
        private CategoryMenuItem Map(Category category)
        {
            var categoryMenuItem = new CategoryMenuItem
            {
                Id       = category.Id,
                Name     = category.Name,
                SeoTitle = category.SeoTitle
            };

            var childCategories = category.Children;

            foreach (var childCategory in childCategories)
            {
                var childCategoryMenuItem = Map(childCategory);
                categoryMenuItem.AddChildItem(childCategoryMenuItem);
            }

            return(categoryMenuItem);
        }
Example #4
0
        private CategoryMenuItem Map(Category category)
        {
            var categoryMenuItem = new CategoryMenuItem
            {
                Id   = category.Id,
                Name = _contentLocalizationService.GetLocalizedProperty(category, nameof(category.Name), category.Name),
                Slug = category.Slug
            };

            var childCategories = category.Children;

            foreach (var childCategory in childCategories.OrderByDescending(x => x.DisplayOrder))
            {
                var childCategoryMenuItem = Map(childCategory);
                categoryMenuItem.AddChildItem(childCategoryMenuItem);
            }

            return(categoryMenuItem);
        }
        private CategoryMenuItem Map(area category)
        {
            var categoryMenuItem = new CategoryMenuItem
            {
                Id   = long.Parse(category.division),
                Name = category.areaname,
                Slug = category.slug
            };

            var childCategories = category.hijos;

            foreach (var childCategory in childCategories.OrderByDescending(x => x.areaname))
            {
                var childCategoryMenuItem = Map(childCategory);
                categoryMenuItem.AddChildItem(childCategoryMenuItem);
            }

            return(categoryMenuItem);
        }
Example #6
0
        private CategoryMenuItem GetCategoryMenuItems()
        {
            if (CacheManager.Contains(MenuCatalogCacheKey))
            {
                return(CacheManager.Get <CategoryMenuItem>(MenuCatalogCacheKey));
            }

            var menuItems = new CategoryMenuItem()
            {
                SubCategories = GetRootSubcategories()
            };

            foreach (var subCategory in menuItems.SubCategories)
            {
                if (subCategory.HasChild)
                {
                    subCategory.SubCategories = GetSubcategories(subCategory.CategoryId);

                    if (subCategory.DisplaySubCategoriesInMenu)
                    {
                        foreach (var subChildrenCategories in subCategory.SubCategories)
                        {
                            subChildrenCategories.SubCategories = GetSubcategories(subChildrenCategories.CategoryId);
                        }
                    }

                    if (subCategory.DisplayBrandsInMenu)
                    {
                        subCategory.Brands = BrandService.GetBrandsByCategoryID(subCategory.CategoryId, true);
                    }
                }
            }

            CacheManager.Insert(MenuCatalogCacheKey, menuItems);
            return(menuItems);
        }
		void UpdateMenu ()
		{
			//
			// Clear out the old list
			//
			foreach (Gtk.MenuItem old_item in menu.Children) {
				menu.Remove (old_item);
			}
			
			Tasque.RemoteControl tasque = GetTasqueRemoteControl ();
			
			string [] taskCategories = null;
			
			if (tasque != null) {
				try {
					taskCategories = tasque.GetCategoryNames ();
				} catch (Exception e) {
					Logger.Debug ("Exception calling Tasque.GetCategoryNames (): {0}",
								  e.Message);
				}
			}
			
			if (taskCategories != null) {
				//
				// Build a new list
				//
				foreach (string category in taskCategories) {
					CategoryMenuItem item = new CategoryMenuItem (category);
					item.Activated += OnCategoryActivated;
					item.ShowAll ();
					menu.Append (item);
				}
			}

			// If nothing was found, add in a "dummy" item
			if (menu.Children.Length == 0) {
				Gtk.MenuItem blankItem =
					new Gtk.MenuItem (Catalog.GetString ("--- Tasque is not running ---"));
				blankItem.Sensitive = false;
				blankItem.ShowAll ();
				menu.Append (blankItem);
			}

			submenuBuilt = true;
		}
Example #8
0
        void OnButtonPressed(object sender, Gtk.ButtonPressEventArgs args)
        {
            switch (args.Event.Button) {
                case 3: // third mouse button (right-click)
                    clickedTask = null;

                    Gtk.TreeView tv = sender as Gtk.TreeView;
                    if (tv == null)
                        return;

                    Gtk.TreeModel model = tv.Model;

                    Gtk.TreeIter iter;
                    Gtk.TreePath path;
                    Gtk.TreeViewColumn column = null;

                    if (!tv.GetPathAtPos ((int) args.Event.X,
                                    (int) args.Event.Y, out path, out column))
                        return;

                    if (!model.GetIter (out iter, path))
                        return;

                    clickedTask = model.GetValue (iter, 0) as Task;
                    if (clickedTask == null)
                        return;

                    Menu popupMenu = new Menu ();
                    ImageMenuItem item;

                    item = new ImageMenuItem (Catalog.GetString ("_Notes..."));
                    item.Image = new Gtk.Image (noteIcon);
                    item.Activated += OnShowTaskNotes;
                    popupMenu.Add (item);

                    popupMenu.Add (new SeparatorMenuItem ());

                    item = new ImageMenuItem (Catalog.GetString ("_Delete task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Delete, IconSize.Menu);
                    item.Activated += OnDeleteTask;
                    popupMenu.Add (item);

                    item = new ImageMenuItem(Catalog.GetString ("_Edit task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Edit, IconSize.Menu);
                    item.Activated += OnEditTask;
                    popupMenu.Add (item);

                    /*
                     * Depending on the currently selected task's category, we create a context popup
                     * here in order to enable changing categories. The list of available categories
                     * is pre-filtered as to not contain the current category and the AllCategory.
                     */
                    var cvCategories = new ListCollectionView<Category> (GtkApplication.Instance.Backend.Categories);
                    cvCategories.Filter = c => c != null && !c.Contains (clickedTask);
                    cvCategories.IsObserving = true;

                    // The categories submenu is only created in case we actually provide at least one category.
                    if (cvCategories.Count > 0) {
                        Menu categoryMenu = new Menu();
                        CategoryMenuItem categoryItem;

                        foreach (var cat in cvCategories) {
                            categoryItem = new CategoryMenuItem((Category)cat);
                            categoryItem.Activated += OnChangeCategory;
                            categoryMenu.Add(categoryItem);
                        }

                        // TODO Needs translation.
                        item = new ImageMenuItem(Catalog.GetString("_Change category"));
                        item.Image = new Gtk.Image(Gtk.Stock.Convert, IconSize.Menu);
                        item.Submenu = categoryMenu;
                        popupMenu.Add(item);
                    }

                    popupMenu.ShowAll();
                    popupMenu.Popup ();

                    // Debug.WriteLine ("Right clicked on task: " + task.Name);
                    break;
            }
        }
Example #9
0
        void RebuildAddTaskMenu(IEnumerable<Category> categories)
        {
            Menu menu = new Menu ();

            foreach (var cat in categories) {
                if (cat == null)
                    continue;

                var item = new CategoryMenuItem ((Category)cat);
                item.Activated += OnNewTaskByCategory;
                item.ShowAll ();
                menu.Add (item);
            }

            addTaskButton.Menu = menu;
        }
Example #10
0
        void OnButtonPressed(object sender, Gtk.ButtonPressEventArgs args)
        {
            switch (args.Event.Button) {
                case 3: // third mouse button (right-click)
                    clickedTask = null;

                    Gtk.TreeView tv = sender as Gtk.TreeView;
                    if (tv == null)
                        return;

                    Gtk.TreeModel model = tv.Model;

                    Gtk.TreeIter iter;
                    Gtk.TreePath path;
                    Gtk.TreeViewColumn column = null;

                    if (!tv.GetPathAtPos ((int) args.Event.X,
                                    (int) args.Event.Y, out path, out column))
                        return;

                    if (!model.GetIter (out iter, path))
                        return;

                    clickedTask = model.GetValue (iter, 0) as ITask;
                    if (clickedTask == null)
                        return;

                    Menu popupMenu = new Menu ();
                    ImageMenuItem item;

                    item = new ImageMenuItem (Catalog.GetString ("_Notes..."));
                    item.Image = new Gtk.Image (noteIcon);
                    item.Activated += OnShowTaskNotes;
                    popupMenu.Add (item);

                    popupMenu.Add (new SeparatorMenuItem ());

                    item = new ImageMenuItem (Catalog.GetString ("_Delete task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Delete, IconSize.Menu);
                    item.Activated += OnDeleteTask;
                    popupMenu.Add (item);

                    item = new ImageMenuItem(Catalog.GetString ("_Edit task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Edit, IconSize.Menu);
                    item.Activated += OnEditTask;
                    popupMenu.Add (item);

                    /*
                     * Depending on the currently selected task's category, we create a context popup
                     * here in order to enable changing categories. The list of available categories
                     * is pre-filtered as to not contain the current category and the AllCategory.
                     */
                    TreeModelFilter filteredCategories = new TreeModelFilter(Application.Backend.Categories, null);
                    filteredCategories.VisibleFunc = delegate(TreeModel t, TreeIter i) {
                        ICategory category = t.GetValue (i, 0) as ICategory;
                        if (category == null || category is AllCategory || category.Equals(clickedTask.Category))
                            return false;
                        return true;
                    };

                    // The categories submenu is only created in case we actually provide at least one category.
                    if (filteredCategories.GetIterFirst(out iter))
                    {
                        Menu categoryMenu = new Menu();
                        CategoryMenuItem categoryItem;

                        filteredCategories.Foreach(delegate(TreeModel t, TreePath p, TreeIter i) {
                            categoryItem = new CategoryMenuItem((ICategory)t.GetValue(i, 0));
                            categoryItem.Activated += OnChangeCategory;
                            categoryMenu.Add(categoryItem);
                            return false;
                        });

                        // TODO Needs translation.
                        item = new ImageMenuItem(Catalog.GetString("_Change category"));
                        item.Image = new Gtk.Image(Gtk.Stock.Convert, IconSize.Menu);
                        item.Submenu = categoryMenu;
                        popupMenu.Add(item);
                    }

                    popupMenu.ShowAll();
                    popupMenu.Popup ();

                    // Logger.Debug ("Right clicked on task: " + task.Name);
                    break;
            }
        }
Example #11
0
        private void RebuildAddTaskMenu(Gtk.TreeModel categoriesModel)
        {
            Gtk.Menu menu = new Menu ();

            Gtk.TreeIter iter;
            if (categoriesModel.GetIterFirst (out iter)) {
                do {
                    ICategory category =
                        categoriesModel.GetValue (iter, 0) as ICategory;

                    if (category is AllCategory)
                        continue; // Skip this one

                    CategoryMenuItem item = new CategoryMenuItem (category);
                    item.Activated += OnNewTaskByCategory;
                    item.ShowAll ();
                    menu.Add (item);
                } while (categoriesModel.IterNext (ref iter));
            }

            addTaskButton.Menu = menu;
        }
Example #12
0
        public async Task NavigateFromMenu(CategoryMenuItem item)
        {
            int  id          = (int)item.Id;
            bool hasSubItems = (item.SubItems != null);

            if (item.Id == CategoryMenuItemType.Geri)
            {
                Master = pages.Pop();
                return;
            }

            if (!MenuItems.ContainsKey(id))
            {
                if (hasSubItems)
                {
                    MenuItems.Add(id, new MenuPage(item.SubItems));
                }
                else
                {
                    switch (id)
                    {
                    case (int)CategoryMenuItemType.Anasayfa:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Anasayfa)));
                        break;

                    case (int)CategoryMenuItemType.Yetkilendirme:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Yetkilendirme)));
                        break;

                    case (int)CategoryMenuItemType.Log_Kaydi:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Log_Kaydi)));
                        break;

                    case (int)CategoryMenuItemType.Hakkinda:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Hakkinda)));
                        break;

                    case (int)CategoryMenuItemType.Personellerin_Talepleri:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Personellerin_Talepleri)));
                        break;

                    case (int)CategoryMenuItemType.Izinlerim:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Izinlerim)));
                        break;

                    case (int)CategoryMenuItemType.Zimmet:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Zimmet)));
                        break;

                    case (int)CategoryMenuItemType.Onay_Bekleyen_Faturalar:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onay_Bekleyen_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Onaylanacak_Faturalar_Personel:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onaylanacak_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Onaylanacak_Faturalar_YKB:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onaylanacak_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Onaylanacak_Faturalar_GM:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onaylanacak_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Onay_Surecindeki_Faturalar:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onay_Surecindeki_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Onaylanmis_Faturalar:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Onaylanmis_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Reddedilmis_Faturalar_Personel:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Reddedilmis_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Reddedilmis_Faturalar_Muhasebeci:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Reddedilmis_Faturalar)));
                        break;

                    case (int)CategoryMenuItemType.Denetim_Geribildirim_Faturalari:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Denetim_Geribildirim_Faturalari)));
                        break;

                    case (int)CategoryMenuItemType.Adat_Hesaplama:
                        MenuItems.Add(id, new NavigationPage(new ComingSoon(Strings.Adat_Hesaplama)));
                        break;
                    }
                }
            }

            var newPage = MenuItems[id];

            if (newPage != null)
            {
                if (hasSubItems)
                {
                    pages.Push(Master);
                    Master = newPage;
                }
                else
                {
                    Detail = newPage;

                    if (Device.RuntimePlatform == Device.Android)
                    {
                        await Task.Delay(100);
                    }

                    IsPresented = false;
                }
            }
        }