Example #1
0
        public EventToCommandBehaviorPageViewModel(INavigationService navigationService)
        {
            #region 相依性服務注入的物件

            _navigationService = navigationService;
            #endregion

            #region 頁面中綁定的命令
            MainCategoryChangeCommand = new DelegateCommand(() =>
            {
                if (string.IsNullOrEmpty(SelectedMainCategory) == false)
                {
                    SubCategoryList.Clear();
                }
                for (int i = 0; i < 50; i++)
                {
                    SubCategoryList.Add($"{SelectedMainCategory} - {i}");
                }
            });
            #endregion

            #region 事件聚合器訂閱

            #endregion
        }
Example #2
0
 public MainPageViewModel()
 {
     MainCategoryChangeCommand = new DelegateCommand(() =>
     {
         if (string.IsNullOrEmpty(SelectedMainCategory) == false)
         {
             SubCategoryList.Clear();
         }
         for (int i = 0; i < 50; i++)
         {
             SubCategoryList.Add($"{SelectedMainCategory} - {i}");
         }
     });
     CustMainCategoryChangeCommand = new DelegateCommand(() =>
     {
         if (string.IsNullOrEmpty(CustSelectedMainCategory) == false)
         {
             CustSubCategoryList.Clear();
         }
         for (int i = 0; i < 50; i++)
         {
             CustSubCategoryList.Add($"{CustSelectedMainCategory} - {i}");
         }
     });
 }
        public MainPageViewModel(INavigationService navigationService)
        {
            #region 相依性服務注入的物件

            _navigationService = navigationService;
            #endregion

            #region 頁面中綁定的命令
            變更工作名稱Command = new DelegateCommand(() =>
            {
                fooMyTask.Name = $"現在時間:{DateTime.Now.ToString()}";
            });
            MainCategoryChangeCommand = new DelegateCommand(() =>
            {
                SubCategoryList.Clear();
                for (int i = 0; i < 50; i++)
                {
                    SubCategoryList.Add($"{SelectedMainCategory} - {i}");
                }
            });
            使用EventToCommandBehaviorCommand = new DelegateCommand(async() =>
            {
                await _navigationService.NavigateAsync("EventToCommandBehaviorPage");
            });
            #endregion

            #region 事件聚合器訂閱

            #endregion
        }
Example #4
0
        /// <summary>
        /// Method to Get the Product Structures(Hierachie) to fill the Category and Subcategory Combobox
        /// </summary>
        public void GetProductStructure()
        {
            if (CategoryList.Count() > 0)
            {
                CategoryList.Clear();
            }

            if (SubCategoryList.Count() > 0)
            {
                SubCategoryList.Clear();
            }

            using (var db = new DataSmartDBContext())
            {
                var structure = db.ProductStructure.ToList();

                if (structure != null)
                {
                    foreach (var d in structure)
                    {
                        CategoryList.Add(d.Category_1);
                        SubCategoryList.Add(d.Category_2);
                    }
                    CategoryList    = CategoryList.Distinct().ToList();
                    SubCategoryList = SubCategoryList.Distinct().ToList();
                }
            }
        }
        /// <summary>
        /// 获取二级目录
        /// </summary>
        /// <param name="index"></param>
        public void GetSubCategories(int parentId)
        {
            SubCategoryList.Clear();

            foreach (var item in categoryList)
            {
                if (item.parentId == parentId)
                {
                    SubCategoryList.Add(item);
                }
            }
        }
Example #6
0
 public MainPageViewModel(INavigationService navigationService)
 {
     this.navigationService    = navigationService;
     MainCategoryChangeCommand = new DelegateCommand(() =>
     {
         if (string.IsNullOrEmpty(SelectedMainCategory) == false)
         {
             SubCategoryList.Clear();
         }
         for (int i = 0; i < 50; i++)
         {
             SubCategoryList.Add($"{SelectedMainCategory} - {i}");
         }
     });
 }