Пример #1
0
        static void TaskSetIcon(MenuItem menuItem)
        {
            if (menuItem.NotSet(MenuItem.IconProperty))
            {
                object o = menuItem.Tag;

                if (o == null)
                    return;

                ImageSource source = 
                    o is FindOptionsBase ? Finder.Manager.GetFindIcon(((FindOptionsBase)o).QueryName, false) : null;

                menuItem.Icon = source.ToSmallImage(); 
            }
        }
Пример #2
0
        public static void TaskSetHeader(MenuItem menuItem)
        {
            if (menuItem.NotSet(MenuItem.HeaderProperty))
            {
                object o = menuItem.Tag;

                if (o == null)
                    return;

                if (o is FindOptionsBase)
                    menuItem.Header = QueryUtils.GetNiceName(((FindOptionsBase)o).QueryName);
                else if (o is Type)
                    menuItem.Header = ((Type)o).NicePluralName();
                else if (o is Enum)
                    menuItem.Header = ((Enum)o).NiceToString();
                else
                    menuItem.Header = o.ToString();
            }
        }
Пример #3
0
        static void MenuManager_TasksQueries(MenuItem menuItem)
        {
            if (menuItem.NotSet(MenuItem.VisibilityProperty))
            {
                object tag = menuItem.Tag;

                if (tag == null)
                    return;

                object queryName =
                    tag is Type ? null : //maybe a type but only if in FindOptions
                    tag is FindOptionsBase ? ((FindOptionsBase)tag).QueryName :
                    tag;

                if (queryName != null && Finder.Manager.QuerySettings.ContainsKey(queryName))
                {
                    if (!GetAllowed(queryName))
                        menuItem.Visibility = Visibility.Collapsed;
                }
            }
        }
Пример #4
0
        static void MenuManager_TasksTypes(MenuItem menuItem)
        {
            if (menuItem.NotSet(MenuItem.VisibilityProperty))
            {
                object tag = menuItem.Tag;

                if (tag == null)
                    return;

                Type type = tag as Type;

                if (type != null && Navigator.Manager.EntitySettings.ContainsKey(type))
                {
                    if (GetAllowed(type).MaxUI() < TypeAllowedBasic.Read)
                        menuItem.Visibility = Visibility.Collapsed;
                }
            }
        }