예제 #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;
                }
            }
        }