public void CreateMenu() { using (MenuHandle menu = Windows.CreateMenu()) { menu.IsInvalid.Should().BeFalse(); } }
public void CreateMenu() { using (MenuHandle menu = ResourceMethods.CreateMenu()) { menu.IsInvalid.Should().BeFalse(); } }
public void AppendMenu() { using (MenuHandle menu = Windows.CreateMenu()) { menu.IsInvalid.Should().BeFalse(); Windows.AppendMenu(menu, "&File", 1000); } }
public void AppendMenu() { using (MenuHandle menu = ResourceMethods.CreateMenu()) { menu.IsInvalid.Should().BeFalse(); ResourceMethods.AppendMenu(menu, "&File", 1000); } }
public static MenuHandle CreateMenu() { MenuHandle menu = Imports.CreateMenu(); if (menu.IsInvalid) { throw Errors.GetIoExceptionForLastError(); } return(menu); }
void Awake() { if (inst != null) { Destroy(this.gameObject); } else { inst = this; DontDestroyOnLoad(this); } }
public void PlayMenuSound(MenuHandle handle) { switch (handle) { case MenuHandle.ForwardButtonPressed: AkSoundEngine.PostEvent("normal_button_forward_pressed", gameObject); break; case MenuHandle.BackwardsButtonPressed: AkSoundEngine.PostEvent("normal_button_backwards_pressed", gameObject); break; case MenuHandle.PlayButtonPressed: AkSoundEngine.PostEvent("play_button_pressed", gameObject); break; default: LogError(handle); return; } }
public unsafe static void AppendMenu(MenuHandle menu, string text, int id, bool disabled = false, bool @checked = false) { MenuFlags flags = MenuFlags.String; if (disabled) { flags |= MenuFlags.Grayed; } if (@checked) flags |= MenuFlags.Checked; fixed(char *c = text) { if (!Imports.AppendMenuW(menu, flags, (IntPtr)id, (IntPtr)c)) { throw Errors.GetIoExceptionForLastError(); } } }
public IEnumerable <RoleFeatureModel> FeatchAll() { var noDel = (short)DeleteStatus.No; using (var featureHandler = new FeatureHandle(Repository)) using (var roleHandler = new RoleHandle(Repository)) using (var menuHandler = new MenuHandle(Repository)) using (var orgHandler = new OrganizationHandle(Repository)) { var query = from role in roleHandler.All(t => t.IsDel == noDel) join featureitem in featureHandler.All(t => t.IsDel == noDel) on role.Id equals featureitem.RoleId into features from feature in features.DefaultIfEmpty(new Feature { }) join menuitem in menuHandler.All(t => t.IsDel == noDel) on feature.MenuId equals menuitem.Id into menus from menu in menus.DefaultIfEmpty(new Menu { }) select new { feature = feature, role = role, menu = menu }; if (!User.IsSupperAdministrator) { var orgcode = User.Organization.Code; var orgs = orgHandler.All(t => t.IsDel == noDel && t.Code.StartsWith(orgcode)).Select(t => t.Id).ToArray(); query = query.Where(t => orgs.Any(x => t.role.OrgId == x)); } var data = query.ToArray().GroupBy(t => t.role).Select( t => new RoleFeatureModel { role = t.Key, menus = t.GroupBy(x => x.menu).Select(x => new RoleMenuFeatureModel { menu = x.Key, role = t.Key, features = Union(x.Select(f => f.feature)).ToArray() }).ToArray() }).ToArray(); return(data); } }
public MenuPageViewModel(MenuHandle display = null) { restService = DependencyService.Get <IRestService>(); contextService = DependencyService.Get <IContextService>(); if (display is null) // Handle top level case { display = new MenuHandle { Name = "Menu", UrlName = "", Description = null, ImageURI = null }; } MenuHandle = display; Title = MenuHandle.Name; contextService.Context.Basket.OrderUpdated += Basket_OrderUpdated; _refreshCommand = new Command(async() => await OnRefresh()); _searchCommand = new Command(async() => await OnSearch()); _filterCommand = new Command(async() => await OnFilter()); }
/// <summary> /// Gets menu from the server using REST API. /// Gets top level if handle is null otherwise gets the menu decribed by handle /// </summary> /// <param name="handle">The menu handle assosiated with the menu to get.</param> /// <returns>Task returning a Menu object</returns> public async Task <Menu> GetMenuAsync(MenuHandle handle) { Uri uri = new Uri(Constants.RestUrl + "menus/" + handle.UrlName); Menu menu = null; try { HttpResponseMessage response = await client.GetAsync(uri); if (response.IsSuccessStatusCode) { string content = await response.Content.ReadAsStringAsync(); menu = JsonConvert.DeserializeObject <Menu>(content); } } catch (Exception ex) { Debug.WriteLine(@"\tERROR {0}", ex.Message); await WarnUserCannotConnect(); } return(menu); }
/// <summary> /// 我的菜单内容 /// </summary> /// <returns></returns> public IEnumerable <Menu> MyMenus() { var menus = User.Menus; var menuHandler = new MenuHandle(Repository); var featureHandler = new FeatureHandle(Repository); if (0 == menus.Count()) { var isDel = (short)DeleteStatus.No; var query = menuHandler.All(t => t.IsDel == isDel); // 非管理员用户,需要根据角色来进行边界数据处理 if (!User.IsSupperAdministrator) { var roleId = User.Role.Id; query = query.Join( featureHandler.All(t => t.IsDel == isDel && t.RoleId == roleId), m => m.Id, f => f.MenuId, (m, f) => m); } menus = query.OrderByDescending(t => t.Order).ToArray(); } var arr = new List <Menu>(); if (!User.IsSupperAdministrator) { var ids = menus.Select(t => t.Pid).Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToArray(); var parents = menuHandler.All(t => ids.Any(x => t.Id == x)).ToArray(); arr.AddRange(menus); arr.AddRange(parents); menus = arr.ToArray(); arr.Clear(); } arr = null; return(menus.Distinct()); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); Handler.Dispose(); Handler = null; }
void Start() { MenuHandle handle = MenuHandle.instance; }
public MenuPage(MenuHandle display) { InitializeComponent(); BindingContext = vm = new MenuPageViewModel(display); }
public static extern bool SetMenu( WindowHandle hWnd, MenuHandle hMenu);
public static extern bool HiliteMenuItem( WindowHandle hwnd, MenuHandle hmenu, uint uItemHitite, MenuFlags uHilite);
public static extern bool SetMenuInfo( MenuHandle hmenu, [In] ref MENUINFO lpcmi);
public static extern MenuFlags GetMenuState( MenuHandle hMenu, uint uId, MenuFlags uFlags);
public static extern SharedMenuHandle GetSubMenu( MenuHandle hMenu, int nPos);
public static extern bool GetMenuItemRect( WindowHandle hWnd, MenuHandle hMenu, uint uItem, out RECT lprcItem);
/// <summary> /// 使用用户名和密码获取用户内容 /// </summary> /// <param name="userId">用户名</param> /// <param name="passwd">密码</param> /// <param name="user">返回的用户信息</param> /// <returns></returns> public AccountLoginStatus Signin(string userId, string passwd, out UserInfo user) { var userHandler = new UserHandle(Repository); var roleHandler = new RoleHandle(Repository); var officerHandler = new OfficerHandle(Repository); var orgHandler = new OrganizationHandle(Repository); var featureHandler = new FeatureHandle(Repository); var menuHandler = new MenuHandle(Repository); var isDel = (short)DeleteStatus.No; var query = from usr in userHandler.All(t => t.Account == userId && t.IsDel == isDel) join orgitem in orgHandler.All(t => t.IsDel == isDel) on usr.OrgId equals orgitem.Id into orgarr from org in orgarr.DefaultIfEmpty(new data.entity.Organization()) join officeritem in officerHandler.All(t => t.IsDel == isDel) on usr.Id equals officeritem.UserId into officers from officer in officers.DefaultIfEmpty(new data.entity.Officer()) join roleitem in roleHandler.All(t => t.IsDel == isDel) on usr.RoleId equals roleitem.Id into roles from role in roles.DefaultIfEmpty(new data.entity.Role()) join fitem in featureHandler.All(t => t.IsDel == isDel) on role.Id equals fitem.RoleId into farr from feature in farr.DefaultIfEmpty(new data.entity.Feature()) join mitem in menuHandler.All(t => t.IsDel == isDel) on feature.MenuId equals mitem.Id into marr from menu in marr.DefaultIfEmpty(new data.entity.Menu()) select new { usr = usr, org = org, officer = officer, role = role, feature = feature, menu = menu }; user = query .GroupBy(t => new { usr = t.usr, org = t.org, officer = t.officer, role = t.role }) .ToArray() .Select(t => new UserInfo { User = t.Key.usr, Officer = t.Key.officer, Organization = t.Key.org, Role = t.Key.role, Features = t.Select(x => x.feature).Where(x => !string.IsNullOrWhiteSpace(x.MenuId)), Menus = t.Select(x => x.menu).Where(x => !string.IsNullOrWhiteSpace(x.Title)) }) .FirstOrDefault(); if (user == null) { return(AccountLoginStatus.UserNoExist); } if (user.User.Passwd != EscapePassword(userId, passwd)) { return(AccountLoginStatus.PasswordError); } if (user.User.Status == (int)AccountStatus.Exception) { return(AccountLoginStatus.ExceptionAccount); } if (user.User.Status == (int)AccountStatus.Locked) { return(AccountLoginStatus.LockedAccount); } user.User.SigninStatus = (short)AccountSigninStatus.Online; if (null == userHandler.Modify(user.User, true)) { return(AccountLoginStatus.Error); } return(AccountLoginStatus.Success); }
public static extern bool SetMenuItemInfoW( MenuHandle hMenu, uint uItem, bool fByPosition, [In] ref MENUITEMINFO lpmii);
public static extern bool SetMenuItemBitmaps( MenuHandle hMenu, uint uPosition, MenuFlags uFlags, BitmapHandle hBitmapUnchecked, BitmapHandle hBitmapChecked);
public MenuModule(UserInfo user) : base(user) { Handler = new MenuHandle(Repository); }
public static extern bool RemoveMenu( MenuHandle hMenu, uint uPosition, MenuFlags uFlags);
public static extern bool SetMenuDefaultItem( MenuHandle hMenu, uint uItem, bool fByPos);
public static extern int GetMenuString( MenuHandle hMenu, uint uIDItem, SafeHandle lpString, int nMaxCount, MenuFlags uFlag);
//Initialise the menu void Start() { menu = this.GetComponent<MenuHandle> (); isActive = menu.isActive; firstScan = true; }
public static extern bool GetMenuItemInfoW( MenuHandle hMenu, uint uItem, bool fByPos, ref MENUITEMINFO lpmii);
public static extern int MenuItemFromPoint( WindowHandle hWnd, MenuHandle hMenu, POINT ptScreen);