public NestedDrawerPage() { InitializeComponent(); Tizen.TV.UIControls.Forms.InputEvents.GetEventHandlers(MainMenuList).Add( new Tizen.TV.UIControls.Forms.RemoteKeyHandler((t) => { if (t.KeyName == Tizen.TV.UIControls.Forms.RemoteControlKeyNames.Right) { SubMenuList.Focus(); t.Handled = true; } }, Tizen.TV.UIControls.Forms.RemoteControlKeyTypes.KeyDown)); Tizen.TV.UIControls.Forms.InputEvents.GetEventHandlers(SubMenuList).Add( new Tizen.TV.UIControls.Forms.RemoteKeyHandler((t) => { if (t.KeyName == Tizen.TV.UIControls.Forms.RemoteControlKeyNames.Left) { MainMenuList.Focus(); t.Handled = true; } }, Tizen.TV.UIControls.Forms.RemoteControlKeyTypes.KeyDown)); FocusHolder.Focused += (s, e) => { SubDrawer.IsOpen = false; }; FocusHolder.Unfocused += (s, e) => { SubDrawer.IsOpen = true; }; }
/// <summary> /// 展开/折叠 /// </summary> /// <param name="subMenuList"></param> private void ShowOrHideChild(SubMenuList subMenuList, double from, double to) { subMenuList._Opened = to > 0; //实例化一个DoubleAninmation对象 DoubleAnimation myani = new DoubleAnimation(); //开始值 myani.From = from; //结束值 myani.To = to; //所用时间 myani.Duration = TimeSpan.FromMilliseconds(300); //设置应用的对象 Storyboard.SetTarget(myani, subMenuList); //设置应用的依赖项属性 Storyboard.SetTargetProperty(myani, new PropertyPath("Height")); // 实例化一个故事板 Storyboard s = new Storyboard(); //s.Completed += new EventHandler(ShowChildConmplete); //将先前动画添加进来 s.Children.Add(myani); //启动故事版 s.Begin(); }
/// <summary> /// 获取所有菜单 /// </summary> /// <returns></returns> private void Init(List <MenuModel> menuList) { int i = 1; foreach (var model in menuList) { var parentBtn = new MenuButton(); parentBtn._MenuInfo = model; parentBtn._MenuInfo.id = i.ToString(); parentBtn.FIcon = model.iconName.IsNullOrEmpty() ? parentBtn.FIcon : StringToUnicode(model.iconName); parentBtn.Width = pnlList.Width; parentBtn.Content = model.menuTitle; parentBtn.Background = CommonUtils.CommonUtil.ToBrush("#4b4b4b"); parentBtn.Foreground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); parentBtn.MouseOverBackground = CommonUtils.CommonUtil.ToBrush("#4b4b4b"); parentBtn.MouseOverForeground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); parentBtn.PressedBackground = CommonUtils.CommonUtil.ToBrush("#000000"); parentBtn.PressedForeground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); parentBtn.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left; parentBtn.FontSize = 11; parentBtn.Height = rowHeight; parentBtn.Click += ParentClick; pnlList.Children.Add(parentBtn); var border = new SubMenuList(); border.Background = CommonUtils.CommonUtil.ToBrush("#4a4a4a"); border._ParentId = parentBtn._MenuInfo.id; border.Height = 0; int j = 1; foreach (var subItem in model.subList) { var childBtn = new MenuButton(); childBtn._MenuInfo = subItem; childBtn._MenuInfo.id = string.Format("{0}-{1}", i, j); childBtn.FIcon = subItem.iconName.IsNullOrEmpty() ? parentBtn.FIcon : StringToUnicode(subItem.iconName); childBtn.Width = pnlList.Width; childBtn.Content = subItem.menuTitle; childBtn.Margin = new Thickness(15, 0, 0, 0); childBtn.Background = CommonUtils.CommonUtil.ToBrush("#4a4a4a"); childBtn.Foreground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); childBtn.MouseOverBackground = CommonUtils.CommonUtil.ToBrush("#4b4b4b"); childBtn.MouseOverForeground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); childBtn.PressedBackground = CommonUtils.CommonUtil.ToBrush("#000000"); childBtn.PressedForeground = CommonUtils.CommonUtil.ToBrush("#FFFFFF"); childBtn.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left; childBtn.FontSize = 11; childBtn.Height = rowHeight; childBtn.Click += ChildClick; border.Children.Add(childBtn); j++; } pnlList.Children.Add(border); i++; } if (pnlList.Children.Count > 0) { ParentClick(pnlList.Children[0], null); } }
public void ExecuteDecreaseOrderCommand(KOTProd obj) { try { //new KOTProd (SNO = 0 ) if (obj.SNO == 0) { if (obj.Quantity > 1) { var item = OrderItemsList.ToList().Find(x => (x.MCODE == obj.MCODE) && (x.SNO == 0)); item.Quantity -= 1; OrderItemsList = new ObservableCollection <KOTProd>(OrderItemsList); OrderItemsList.OrderBy(x => x.SNO); M.MenuItem selectedObj = new M.MenuItem() { MCODE = obj.MCODE }; SelectedItemCount(selectedObj); } else if (obj.Quantity == 1) { var item = OrderItemsList.ToList().Find(x => (x.MCODE == obj.MCODE) && (x.SNO == 0)); OrderItemsList.Remove(item); M.MenuItem selectedObj = new M.MenuItem() { MCODE = obj.MCODE }; SelectedItemCount(selectedObj); } else if (obj.Quantity < 1) { DependencyService.Get <IMessage>().ShortAlert("Cannot decrease"); } } //old saved KOTProd ( SNO > 0 ) else { //if quantity is negative return if (obj.Quantity <= 1 || (obj.Quantity + obj.DecQuantity) <= 1) { DependencyService.Get <IMessage>().ShortAlert("Cannot Decrease. Only one Item left.Click Cancel"); return; } var items = OrderItemsList.Where(x => x.MCODE == obj.MCODE).ToList(); var negativeItems = items.Where(x => x.REFSNO == obj.SNO); double qty = 0; double negQty = 0; foreach (var i in negativeItems) { negQty += i.Quantity; } var match = items.Find(x => x.REFSNO == obj.SNO && x.SNO == 0); if (match != null) { qty = obj.Quantity + negQty; if (qty > 1) { obj.DecQuantity -= 1; match.Quantity -= 1; } else if (qty == 1) { SelectedOrderItem = obj; IsCancel = true; } } else { obj.DecQuantity -= 1; var item = SubMenuList.Find(x => x.MCODE == obj.MCODE); var KOTItem = M.MenuItem.MenuItemsToKOTProd(item); KOTItem.Quantity = -1; KOTItem.REFSNO = obj.SNO; OrderItemsList.Add(KOTItem); DependencyService.Get <IMessage>().ShortAlert("Item added to Order List"); } RefreshOrderItemsList(); } } catch (Exception ex) { DependencyService.Get <IMessage>().ShortAlert(ex.Message); } }
public async void ExecuteLoginCheckCommand() { try { LoadingMessage = "Loading!! Please wait a while"; IsLoading = true; if (CancelingUser == null) { return; } if (string.IsNullOrEmpty(CancelingUser.UserName)) { DependencyService.Get <IMessage>().ShortAlert("UserName is empty"); } else if (string.IsNullOrEmpty(CancelingUser.Password)) { DependencyService.Get <IMessage>().ShortAlert("Password is empty"); } else { var res = await LoginConnection.CheckAccessAsync(CancelingUser); if (res.ToLower() == "success") { double qty = 0; double decreased = 0; double left = 0; if (SelectedOrderItem.Quantity > 0) { var items = OrderItemsList.Where(x => x.REFSNO == SelectedOrderItem.SNO).ToList(); foreach (var i in items) { qty += i.Quantity; if (i.SNO > 0) { decreased += i.Quantity; } } } var neg = -(SelectedOrderItem.Quantity + qty); if (neg < 0) { var items = OrderItemsList.Where(x => x.REFSNO == SelectedOrderItem.SNO).ToList(); foreach (var i in items) { if (i.SNO == 0) { i.Quantity = -(SelectedOrderItem.Quantity - decreased); i.Remarks = CancelingUser.Remarks; RefreshOrderItemsList(); CancelingUser = new User(); IsCancel = false; IsLoading = false; return; } } var item = SubMenuList.Find(x => x.MCODE == SelectedOrderItem.MCODE); var KOTItem = M.MenuItem.MenuItemsToKOTProd(item); KOTItem.Remarks = CancelingUser.Remarks; KOTItem.Quantity = neg; KOTItem.REFSNO = SelectedOrderItem.SNO; OrderItemsList.Add(KOTItem); } } else { DependencyService.Get <IMessage>().ShortAlert(res); } } RefreshOrderItemsList(); CancelingUser = new User(); IsCancel = false; IsLoading = false; }catch (Exception ex) { IsCancel = false; IsLoading = false; DependencyService.Get <IMessage>().ShortAlert(ex.Message); } }