public QuickLinkNavigate(UniqueOptions options)
 {
     FindUniqueOptions = options;
     Label             = typeof(T).NiceName();
     //Icon = Navigator.Manager.GetEntityIcon(typeof(T), false);
     IsVisible = Finder.IsFindable(FindUniqueOptions.QueryName) && Navigator.IsNavigable(typeof(T), isSearch: true);
 }
Beispiel #2
0
        private void QueryNameChanged(DependencyPropertyChangedEventArgs s)
        {
            if (DesignerProperties.GetIsInDesignMode(this) || s.NewValue == null)
            {
                return;
            }

            if (!Finder.IsFindable(s.NewValue))
            {
                Common.VoteCollapsed(this);
                return;
            }

            Common.VoteVisible(this);


            Settings = Finder.GetQuerySettings(s.NewValue);

            Description = DynamicQueryServer.GetQueryDescription(s.NewValue);

            if (Settings.SimpleFilterBuilder != null)
            {
                SimpleFilterBuilder = Settings.SimpleFilterBuilder(Description);
            }

            tokenBuilder.Token           = null;
            tokenBuilder.SubTokensEvent += tokenBuilder_SubTokensEvent;

            entityColumn = Description.Columns.SingleOrDefaultEx(a => a.IsEntity);
            if (entityColumn == null)
            {
                throw new InvalidOperationException("Entity Column not found on {0}".FormatWith(QueryUtils.GetKey(QueryName)));
            }
        }
Beispiel #3
0
        void SearchControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= SearchControl_Loaded;

            if (DesignerProperties.GetIsInDesignMode(this) || QueryName == null || !Finder.IsFindable(QueryName))
            {
                tokenBuilder.Token           = null;
                tokenBuilder.SubTokensEvent += q => new List <QueryToken>();

                return;
            }

            Common.VoteVisible(this);

            OnLoaded();
        }
        public QuickLinkExplore(ExploreOptions options)
        {
            Options = options;
            Label   = QueryUtils.GetNiceName(Options.QueryName);
            //Icon = Navigator.Manager.GetFindIcon(Options.QueryName, false);
            IsVisible = Finder.IsFindable(Options.QueryName);

            if (ShowResultCount && IsVisible)
            {
                EvaluateFunValues();

                DynamicQueryServer.QueryCountBatch(new QueryCountOptions(Options.QueryName)
                {
                    FilterOptions = options.FilterOptions,
                }, count =>
                {
                    Label = "{0} ({1})".FormatWith(Label, count);
                }, () => { });
            }
        }
Beispiel #5
0
        public override void OnLoad(object sender, RoutedEventArgs e)
        {
            base.OnLoad(sender, e);

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            if (this.NotSet(EntityBase.EntityTemplateProperty) && this.NotSet(EntityBase.EntityTemplateSelectorProperty))
            {
                var type = Type;

                if (this is EntityCombo && !type.IsLite()) //Allways going to be lite
                {
                    type = Lite.Generate(type);
                }

                EntityTemplate = Navigator.FindDataTemplate(this, type);
            }

            if (this.NotSet(EntityBase.ImplementationsProperty) && CleanType.IsEntity() && !CleanType.IsAbstract)
            {
                Implementations = Signum.Entities.Implementations.By(CleanType);
            }

            if (this.NotSet(EntityBase.CreateProperty) && Create)
            {
                Create =
                    CleanType.IsEmbeddedEntity() ? Navigator.IsCreable(CleanType) :
                    Implementations.Value.IsByAll ? false:
                    Implementations.Value.Types.Any(t => Navigator.IsCreable(t, isSearch: false));
            }

            if (this.NotSet(EntityBase.ViewProperty) && View)
            {
                View = CleanType.IsEmbeddedEntity() ? Navigator.IsViewable(CleanType) :
                       Implementations.Value.IsByAll ? true :
                       Implementations.Value.Types.Any(t => Navigator.IsViewable(t));
            }

            if (this.NotSet(EntityBase.NavigateProperty) && Navigate)
            {
                Navigate = CleanType.IsEmbeddedEntity() ? Navigator.IsNavigable(CleanType, isSearch: false) :
                           Implementations.Value.IsByAll ? true :
                           Implementations.Value.Types.Any(t => Navigator.IsNavigable(t, isSearch: false));
            }

            if (this.NotSet(EntityBase.FindProperty) && Find)
            {
                Find = CleanType.IsEmbeddedEntity() ? false:
                       Implementations.Value.IsByAll ? false :
                       Implementations.Value.Types.Any(t => Finder.IsFindable(t));
            }

            if (this.NotSet(EntityBase.ViewOnCreateProperty) && ViewOnCreate && !View)
            {
                ViewOnCreate = false;
            }

            UpdateVisibility();
        }