Exemplo n.º 1
0
        //public event EventHandler<AdvanceOrRawArg> SearchDataDefined;

        //void SearchView_CommandExecuted(object sender, Arg_CommandExecuted e)
        //{
        //    (e.Command as I_Command).Execute(this);
        //}
        public void SetAreaInitializer(SearchEntityAreaInitializer newAreaInitializer)
        {
            SearchInitializer = newAreaInitializer;

            SearchView          = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateViewOfSearchEntityArea();
            RawSearchEntityArea = new RawSearchEntityArea();
            RawSearchEntityArea.SetAreaInitializer(newAreaInitializer);
            RawSearchEntityArea.SearchDataDefined += RawSearchEntityArea_SearchDataDefined;
            SearchView.AddSimpleSearchView(RawSearchEntityArea.RawSearchView);


            AdvancedSearchEntityAre = new AdvancedSearchEntityArea();
            AdvancedSearchEntityAre.SetAreaInitializer(newAreaInitializer);
            AdvancedSearchEntityAre.SearchDataDefined += AdvancedSearchEntityAre_SearchDataDefined;
            SearchView.AddAdvancedSearchView(AdvancedSearchEntityAre.AdvancedSearchView);

            if (newAreaInitializer.EditSearchRepository != null)
            {
                if (newAreaInitializer.EditSearchRepository.Phrases.Any(x => !(x is SearchProperty)))
                {
                    SearchView.ActivateAdvancedView();
                }
                else
                {
                    SearchView.ActivateRawView();
                }
            }
        }
        public void SetAreaInitializer(SearchEntityAreaInitializer newAreaInitializer)
        {
            SearchInitializer = newAreaInitializer;

            SearchView                        = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateViewOfSearchEntityArea();
            SimpleSearchEntityArea            = new SimpleSearchEntityArea();
            newAreaInitializer.SearchEntityID = newAreaInitializer.SearchEntityID;
            SimpleSearchEntityArea.SetAreaInitializer(newAreaInitializer);
            SimpleSearchEntityArea.SearchDataDefined += SimpleSearchEntityArea_SearchDataDefined;
            SearchView.AddSimpleSearchView(SimpleSearchEntityArea.SimpleSearchView);

            AdvancedSearchEntityAre = new AdvancedSearchEntityArea();
            AdvancedSearchEntityAre.SetAreaInitializer(newAreaInitializer);
            AdvancedSearchEntityAre.SearchDataDefined += SimpleSearchEntityArea_SearchDataDefined;
            SearchView.AddAdvancedSearchView(AdvancedSearchEntityAre.AdvancedSearchView);
            //if (newAreaInitializer.PreDefinedSearch != null && newAreaInitializer.EditSearchRepository != null)
            //    throw new Exception("sdfsbvxzcv");

            //بررسی شود دوتاشون میتونن باشن یا خطا باید بده
            //if (newAreaInitializer.PreDefinedSearch != null)
            //{
            //    newAreaInitializer.EditSearchRepository = newAreaInitializer.PreDefinedSearch;
            //}
            if (newAreaInitializer.PreDefinedSearch != null)
            {
                ShowSearchRepository(newAreaInitializer.PreDefinedSearch);
            }
        }