Exemplo n.º 1
0
 public void CreateMenu()
 {
     using (MenuHandle menu = Windows.CreateMenu())
     {
         menu.IsInvalid.Should().BeFalse();
     }
 }
Exemplo n.º 2
0
 public void CreateMenu()
 {
     using (MenuHandle menu = ResourceMethods.CreateMenu())
     {
         menu.IsInvalid.Should().BeFalse();
     }
 }
Exemplo n.º 3
0
 public void AppendMenu()
 {
     using (MenuHandle menu = Windows.CreateMenu())
     {
         menu.IsInvalid.Should().BeFalse();
         Windows.AppendMenu(menu, "&File", 1000);
     }
 }
Exemplo n.º 4
0
 public void AppendMenu()
 {
     using (MenuHandle menu = ResourceMethods.CreateMenu())
     {
         menu.IsInvalid.Should().BeFalse();
         ResourceMethods.AppendMenu(menu, "&File", 1000);
     }
 }
Exemplo n.º 5
0
        public static MenuHandle CreateMenu()
        {
            MenuHandle menu = Imports.CreateMenu();

            if (menu.IsInvalid)
            {
                throw Errors.GetIoExceptionForLastError();
            }
            return(menu);
        }
Exemplo n.º 6
0
 void Awake()
 {
     if (inst != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         inst = this;
         DontDestroyOnLoad(this);
     }
 }
Exemplo n.º 7
0
    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;
        }
    }
Exemplo n.º 8
0
        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();
                }
            }
        }
Exemplo n.º 9
0
        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);
                        }
        }
Exemplo n.º 10
0
        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());
        }
Exemplo n.º 11
0
        /// <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);
        }
Exemplo n.º 12
0
        /// <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());
        }
Exemplo n.º 13
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     Handler.Dispose();
     Handler = null;
 }
Exemplo n.º 14
0
 void Start()
 {
     MenuHandle handle = MenuHandle.instance;
 }
Exemplo n.º 15
0
 public MenuPage(MenuHandle display)
 {
     InitializeComponent();
     BindingContext = vm = new MenuPageViewModel(display);
 }
Exemplo n.º 16
0
 public static extern bool SetMenu(
     WindowHandle hWnd,
     MenuHandle hMenu);
Exemplo n.º 17
0
 public static extern bool HiliteMenuItem(
     WindowHandle hwnd,
     MenuHandle hmenu,
     uint uItemHitite,
     MenuFlags uHilite);
Exemplo n.º 18
0
 public static extern bool SetMenuInfo(
     MenuHandle hmenu,
     [In] ref MENUINFO lpcmi);
Exemplo n.º 19
0
 public static extern MenuFlags GetMenuState(
     MenuHandle hMenu,
     uint uId,
     MenuFlags uFlags);
Exemplo n.º 20
0
 public static extern SharedMenuHandle GetSubMenu(
     MenuHandle hMenu,
     int nPos);
Exemplo n.º 21
0
 public static extern bool GetMenuItemRect(
     WindowHandle hWnd,
     MenuHandle hMenu,
     uint uItem,
     out RECT lprcItem);
Exemplo n.º 22
0
        /// <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);
        }
Exemplo n.º 23
0
 public static extern bool SetMenuItemInfoW(
     MenuHandle hMenu,
     uint uItem,
     bool fByPosition,
     [In] ref MENUITEMINFO lpmii);
Exemplo n.º 24
0
 public static extern bool SetMenuItemBitmaps(
     MenuHandle hMenu,
     uint uPosition,
     MenuFlags uFlags,
     BitmapHandle hBitmapUnchecked,
     BitmapHandle hBitmapChecked);
Exemplo n.º 25
0
 public MenuModule(UserInfo user)
     : base(user)
 {
     Handler = new MenuHandle(Repository);
 }
Exemplo n.º 26
0
 public static extern bool RemoveMenu(
     MenuHandle hMenu,
     uint uPosition,
     MenuFlags uFlags);
Exemplo n.º 27
0
 public static extern bool SetMenuDefaultItem(
     MenuHandle hMenu,
     uint uItem,
     bool fByPos);
Exemplo n.º 28
0
 public static extern int GetMenuString(
     MenuHandle hMenu,
     uint uIDItem,
     SafeHandle lpString,
     int nMaxCount,
     MenuFlags uFlag);
Exemplo n.º 29
0
 //Initialise the menu
 void Start()
 {
     menu = this.GetComponent<MenuHandle> ();
     isActive = menu.isActive;
     firstScan = true;
 }
Exemplo n.º 30
0
 public static extern bool GetMenuItemInfoW(
     MenuHandle hMenu,
     uint uItem,
     bool fByPos,
     ref MENUITEMINFO lpmii);
Exemplo n.º 31
0
 public static extern int MenuItemFromPoint(
     WindowHandle hWnd,
     MenuHandle hMenu,
     POINT ptScreen);