private void getMenuCompleted(object sender, GetByTopTLMENUCompletedEventArgs e) { this.currentMenuData = e.Result; this.isLoading = true; this.LoadMenuRole(this.currentMenuData); if (this.isFirstTime) { this.LoadEditRole(); this.isFirstTime = false; } this.isLoading = false; }
private void searchCompleted(object sender, GetByTopTLMENUCompletedEventArgs e) { try { this.currencyData = e.Result; this.Refresh(); } catch (Exception) { this.messagePop.SetSingleError(CommonResource.errorCannotConnectServer); } finally { MyHelper.IsFree(); } }
private void getMenuCompleted(object sender, GetByTopTLMENUCompletedEventArgs e) { this.currentMenuData = e.Result; this.isLoading=true; this.LoadMenuRole(this.currentMenuData); if (this.isFirstTime) { this.LoadEditRole(); this.isFirstTime = false; } this.isLoading=false; }
private void getMenuCompleted(object sender, GetByTopTLMENUCompletedEventArgs e) { if (e.Result != null && e.Result.Count > 0) { this.lstHyperlink = new List<HyperlinkButton>(); Style hyperlinkStyle = Application.Current.Resources["HyperlinkButtonMenuitemStyle"] as Style; Style accordionItemStyle = Application.Current.Resources["AccordionItemParentStyle"] as Style; Style hplParent = Application.Current.Resources["HyperlinkButtonMenuitemStyle"] as Style; Style accordionItemParent = Application.Current.Resources["AccordionItemHyperlinkStyle"] as Style; //Style hyperlinkStyle = Application.Current.Resources["LinkStyle"] as Style; //Style accordionItemStyle = Application.Current.Resources["gAccordionButtonStyle1"] as Style; //Style hplParent = Application.Current.Resources["HplParent"] as Style; //Style accordionItemParent = Application.Current.Resources["gAccordionParent"] as Style; List<string> lstTempIamge = new List<string>() { "/gMVVM;component/Data/Icons/He Thong.png","/gMVVM;component/Data/Icons/He Thong.png", "/gMVVM;component/Data/Icons/Danh muc.png" , "/gMVVM;component/Data/Icons/Ke hoach.png", "/gMVVM;component/Data/Icons/Mua sam.png" , "/gMVVM;component/Data/Icons/Tai san.png", "/gMVVM;component/Data/Icons/Xe.png", "/gMVVM;component/Data/Icons/CT_XDCB.png" , "/gMVVM;component/Data/Icons/CTXDCB.png", "/gMVVM;component/Data/Icons/Bao cao.png"}; ObservableCollection<TL_MENU> lstMenu = e.Result; List<AccordionItem> lstParentMenu = new List<AccordionItem>();//List Parent Menu AccordionItem accParentMenu;//Parent Menu StackPanel spnChild;//List Menu Child HyperlinkButton hlkChild;//Menu child Dictionary<string, AccordionItem> dicAccParent = new Dictionary<string, AccordionItem>(); string menuNname = ""; CurrentSystemInfor.AvailableLink = new Dictionary<string, string>(); int i=0; foreach (var item in lstMenu) { if (CurrentSystemLogin.Roles.ContainsKey(item.MENU_ID.ToString())) { menuNname = this.isVN ? item.MENU_NAME : item.MENU_NAME_EL; if (item.MENU_PARENT.Equals("")) { if (!item.MENU_LINK.Equals("/")) { accParentMenu = GetAccordionItemHyperlink(menuNname, item.MENU_ID, item.MENU_LINK, lstTempIamge[i%2], accordionItemParent); accParentMenu.ApplyTemplate(); this.lstHyperlink.Add(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(accParentMenu, 0) as Grid, 0) as HyperlinkButton); //accParentMenu = GetAccordionItemParent(GetHyperLinkParent(item.MENU_ID, menuNname, item.MENU_LINK, hplParent), accordionItemParent); lstParentMenu.Add(accParentMenu); } else { accParentMenu = GetAccordionItem(menuNname, accordionItemStyle, lstTempIamge[i % 10]); spnChild = CreateStackPanel(); accParentMenu.Content = spnChild; dicAccParent.Add(item.MENU_ID.ToString(), accParentMenu); lstParentMenu.Add(accParentMenu); } i++; } else { hlkChild = GetHyperLinkButton(item.MENU_ID, menuNname, item.MENU_LINK, hyperlinkStyle); //if ((dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Count > 0) // (dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Add(CreateBorder()); (dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Add(hlkChild); } if (!item.MENU_LINK.Equals("/") && !CurrentSystemInfor.AvailableLink.ContainsKey(item.MENU_LINK)) CurrentSystemInfor.AvailableLink.Add(item.MENU_LINK, item.MENU_ID.ToString()); //Chuc nang cho phep duyet tren tung menu hay khong if (!CurrentSystemLogin.dicApproveFunction.ContainsKey(item.MENU_ID.ToString())) CurrentSystemLogin.dicApproveFunction.Add(item.MENU_ID.ToString(), item.ISAPPROVE_FUNC.Equals("1") ? true : false); } } if (CurrentSystemInfor.AvailableLink.Count == 0) CurrentSystemInfor.AvailableLink.Add("/Home", "1"); IsolatedStorageSettings.ApplicationSettings["MenuLink"] = CurrentSystemInfor.AvailableLink; this.MenuRoot = lstParentMenu; //Set lai IsApprove trong truong hop refresh if (CurrentSystemLogin.dicApproveFunction.ContainsKey(CurrentSystemInfor.CurrentMenuId)) CurrentSystemLogin.IsAppFunction = CurrentSystemLogin.dicApproveFunction[CurrentSystemInfor.CurrentMenuId]; } }
private void getMenuCompleted(object sender, GetByTopTLMENUCompletedEventArgs e) { if (e.Result != null && e.Result.Count > 0) { this.lstHyperlink = new List <HyperlinkButton>(); Style hyperlinkStyle = Application.Current.Resources["HyperlinkButtonMenuitemStyle"] as Style; Style accordionItemStyle = Application.Current.Resources["AccordionItemParentStyle"] as Style; Style hplParent = Application.Current.Resources["HyperlinkButtonMenuitemStyle"] as Style; Style accordionItemParent = Application.Current.Resources["AccordionItemHyperlinkStyle"] as Style; //Style hyperlinkStyle = Application.Current.Resources["LinkStyle"] as Style; //Style accordionItemStyle = Application.Current.Resources["gAccordionButtonStyle1"] as Style; //Style hplParent = Application.Current.Resources["HplParent"] as Style; //Style accordionItemParent = Application.Current.Resources["gAccordionParent"] as Style; List <string> lstTempIamge = new List <string>() { "/gMVVM;component/Data/Icons/He Thong.png", "/gMVVM;component/Data/Icons/He Thong.png", "/gMVVM;component/Data/Icons/Danh muc.png" , "/gMVVM;component/Data/Icons/Ke hoach.png", "/gMVVM;component/Data/Icons/Mua sam.png" , "/gMVVM;component/Data/Icons/Tai san.png", "/gMVVM;component/Data/Icons/Xe.png", "/gMVVM;component/Data/Icons/CT_XDCB.png" , "/gMVVM;component/Data/Icons/CTXDCB.png", "/gMVVM;component/Data/Icons/Bao cao.png" }; ObservableCollection <TL_MENU> lstMenu = e.Result; List <AccordionItem> lstParentMenu = new List <AccordionItem>(); //List Parent Menu AccordionItem accParentMenu; //Parent Menu StackPanel spnChild; //List Menu Child HyperlinkButton hlkChild; //Menu child Dictionary <string, AccordionItem> dicAccParent = new Dictionary <string, AccordionItem>(); string menuNname = ""; CurrentSystemInfor.AvailableLink = new Dictionary <string, string>(); int i = 0; foreach (var item in lstMenu) { if (CurrentSystemLogin.Roles.ContainsKey(item.MENU_ID.ToString())) { menuNname = this.isVN ? item.MENU_NAME : item.MENU_NAME_EL; if (item.MENU_PARENT.Equals("")) { if (!item.MENU_LINK.Equals("/")) { accParentMenu = GetAccordionItemHyperlink(menuNname, item.MENU_ID, item.MENU_LINK, lstTempIamge[i % 2], accordionItemParent); accParentMenu.ApplyTemplate(); this.lstHyperlink.Add(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(accParentMenu, 0) as Grid, 0) as HyperlinkButton); //accParentMenu = GetAccordionItemParent(GetHyperLinkParent(item.MENU_ID, menuNname, item.MENU_LINK, hplParent), accordionItemParent); lstParentMenu.Add(accParentMenu); } else { accParentMenu = GetAccordionItem(menuNname, accordionItemStyle, lstTempIamge[i % 10]); spnChild = CreateStackPanel(); accParentMenu.Content = spnChild; dicAccParent.Add(item.MENU_ID.ToString(), accParentMenu); lstParentMenu.Add(accParentMenu); } i++; } else { hlkChild = GetHyperLinkButton(item.MENU_ID, menuNname, item.MENU_LINK, hyperlinkStyle); //if ((dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Count > 0) // (dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Add(CreateBorder()); (dicAccParent[item.MENU_PARENT].Content as StackPanel).Children.Add(hlkChild); } if (!item.MENU_LINK.Equals("/") && !CurrentSystemInfor.AvailableLink.ContainsKey(item.MENU_LINK)) { CurrentSystemInfor.AvailableLink.Add(item.MENU_LINK, item.MENU_ID.ToString()); } //Chuc nang cho phep duyet tren tung menu hay khong if (!CurrentSystemLogin.dicApproveFunction.ContainsKey(item.MENU_ID.ToString())) { CurrentSystemLogin.dicApproveFunction.Add(item.MENU_ID.ToString(), item.ISAPPROVE_FUNC.Equals("1") ? true : false); } } } if (CurrentSystemInfor.AvailableLink.Count == 0) { CurrentSystemInfor.AvailableLink.Add("/Home", "1"); } IsolatedStorageSettings.ApplicationSettings["MenuLink"] = CurrentSystemInfor.AvailableLink; this.MenuRoot = lstParentMenu; //Set lai IsApprove trong truong hop refresh if (CurrentSystemLogin.dicApproveFunction.ContainsKey(CurrentSystemInfor.CurrentMenuId)) { CurrentSystemLogin.IsAppFunction = CurrentSystemLogin.dicApproveFunction[CurrentSystemInfor.CurrentMenuId]; } } }