예제 #1
0
 public IResource  ReregisterTrayIconRule(IResource rule, string name, string[] types,
                                          IResource[] conditions, IResource[] exceptions,
                                          Icon icon)
 {
     IResource[][] group = FilterRegistry.Convert2Group(conditions);
     return(ReregisterTrayIconRule(rule, name, types, group, exceptions, icon));
 }
예제 #2
0
 public void  ShowAdvancedSearchForm(string query, string[] resTypes,
                                     IResource[] conditions, IResource[] exceptions)
 {
     IResource[][] group = FilterRegistry.Convert2Group(conditions);
     ShowAdvancedSearchForm(query, resTypes, group, exceptions);
 }
예제 #3
0
        private void PerformSearch()
        {
            string query = _editHeading.Text.Trim();

            IResource[][] conditions = Controls2Resources(panelConditions.Controls);
            if (query.Length > 0)
            {
                IResource queryCondition = ((FilterRegistry)FMgr).CreateQueryConditionAux(null, query, comboSection.Text);
                FilterRegistry.ReferCondition2Template(queryCondition, FMgr.Std.BodyMatchesSearchQueryXName);

                //  Copy query condition to every subgroup or create the single one.
                if (conditions != null && conditions.Length > 0)
                {
                    for (int i = 0; i < conditions.Length; i++)
                    {
                        IResource[] group    = conditions[i];
                        IResource[] newGroup = new IResource[group.Length + 1];

                        for (int j = 0; j < group.Length; j++)
                        {
                            newGroup[j] = group[j];
                        }
                        newGroup[newGroup.Length - 1] = queryCondition;

                        conditions[i] = newGroup;
                    }
                }
                else
                {
                    conditions = FilterRegistry.Convert2Group(queryCondition);
                }
                UpdateStoredQueriesList(query);
            }

            IResource[] exceptions = ConvertTemplates2Conditions(panelExceptions.Controls);

            //-----------------------------------------------------------------
            //  need to remove existing basic View?
            //  NB: it removes all underlying AUX conditions including query search
            //-----------------------------------------------------------------
            IResource view = RStore.FindUniqueResource(FilterManagerProps.ViewResName, "DeepName", FMgr.ViewNameForSearchResults);

            string[] formTypes = ReformatTypes(CurrentResTypeDeep);
            if (view != null)
            {
                BaseResource = view;
                FMgr.ReregisterView(view, FMgr.ViewNameForSearchResults, formTypes, conditions, exceptions);
            }
            else
            {
                BaseResource = FMgr.RegisterView(FMgr.ViewNameForSearchResults, formTypes, conditions, exceptions);
            }

            //-----------------------------------------------------------------
            bool          showContext = (query.Length > 0) && Core.SettingStore.ReadBool("Resources", "ShowSearchContext", true);
            ResourceProxy proxy       = new ResourceProxy(BaseResource);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Name, SearchViewPrefix + query);
            proxy.SetProp(Core.Props.ShowDeletedItems, true);
            proxy.SetProp("ForceExec", true);
            proxy.SetProp("ShowContexts", showContext);
            if (BaseResource.HasProp(Core.Props.ContentType) || BaseResource.HasProp("ContentLinks"))
            {
                proxy.DeleteProp("ShowInAllTabs");
            }
            else
            {
                proxy.SetProp("ShowInAllTabs", true);
            }
            proxy.EndUpdate();

            //  if search is done specifically for the particular resource
            //  type - set the focus onto that tab.
            Core.ResourceTreeManager.LinkToResourceRoot(BaseResource, 1);
            if ((CurrentResTypeDeep != null) &&
                (CurrentResTypeDeep.IndexOf('|') == -1) && (CurrentResTypeDeep.IndexOf('#') == -1))
            {
                Core.TabManager.SelectResourceTypeTab(CurrentResTypeDeep);
            }
            else
            {
                Core.TabManager.SelectResourceTypeTab("");
            }

            Core.UIManager.BeginUpdateSidebar();
            Core.LeftSidebar.ActivateViewPane(StandardViewPanes.ViewsCategories);
            Core.UIManager.EndUpdateSidebar();
            Core.LeftSidebar.DefaultViewPane.SelectResource(BaseResource);
            BringToFront();
        }