Exemplo n.º 1
0
 /// <summary>
 /// 初始化依赖引导器
 /// </summary>
 /// <param name="finder">类型查找器</param>
 /// <param name="context">上下文</param>
 /// <param name="services">服务集合</param>
 /// <param name="configs">依赖配置</param>
 public Bootstrapper(IServiceCollection services, IContext context, IConfig[] configs, IFind finder)
 {
     _services = services ?? new ServiceCollection();
     _context  = context;
     _configs  = configs;
     _finder   = finder ?? new Finder();
 }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化依赖引导器
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="configs">依赖配置</param>
 /// <param name="aopConfigAction">Aop配置操作</param>
 /// <param name="finder">类型查找器</param>
 public Bootstrapper(IServiceCollection services, IConfig[] configs, Action <IAspectConfiguration> aopConfigAction, IFind finder)
 {
     _services        = services ?? new ServiceCollection();
     _configs         = configs;
     _aopConfigAction = aopConfigAction;
     _finder          = finder ?? new Finder();
 }
Exemplo n.º 3
0
        public IArray Find(IFind ifind_0)
        {
            IArray array    = null;
            bool   contains = this.chkContains.Checked;
            string text     = this.cboSearchString.Text;

            this.m_strSearch = this.cboSearchString.Text;
            string[] fields = new string[1];
            switch (this.radioGroup.SelectedIndex)
            {
            case 0:
                array = ifind_0.Find(text, contains, ifind_0.FindFields, null);
                this.m_strFindField = "所有字段";
                return(array);

            case 1:
                fields[0]           = this.cboFields.Text;
                array               = ifind_0.Find(text, contains, fields, null);
                this.m_strFindField = this.cboFields.Text;
                return(array);
            }
            fields[0]           = ifind_0.FindDisplayField;
            array               = ifind_0.Find(text, contains, fields, null);
            this.m_strFindField = ifind_0.FindDisplayField;
            return(array);
        }
 /// <summary>
 /// Finds Book object by given parameter
 /// </summary>
 /// <param name="param"></param>
 /// <returns>Book object that contains given parameter</returns>
 public Book FindBook(IFind param)
 {
     if (ReferenceEquals(param, null))
     {
         throw new ArgumentNullException();
     }
     return(param.FindBookByTag());
 }
Exemplo n.º 5
0
 /// <summary>
 /// 注册服务集合
 /// </summary>
 private void RegistServices(ContainerBuilder builder)
 {
     _builder    = builder;
     _finder     = new WebFinder();
     _assemblies = _finder.GetAssemblies();
     RegistInfrastracture();
     RegistEventHandlers();
     RegistDependency();
 }
Exemplo n.º 6
0
        public override void GenerateRDF(IFind modelRef, XmlTextWriter xmlWriter)
        {
            // base class
            base.GenerateRDF(modelRef, xmlWriter);

            // reference
            xmlWriter.WriteStartElement("cim:BusbarSection.baseVoltage");
            xmlWriter.WriteAttributeString("rdf:resource", "#0x" + (baseVoltage == 0 ? 0.ToString("x16") : (modelRef.GetEntityForLocalId(baseVoltage).GlobalId).ToString("x16")));
            xmlWriter.WriteEndElement();
        }
Exemplo n.º 7
0
 /// <summary>
 /// Finds all matching elements. Does not throw exceptions; an empty enumeration is returned if any errors occur.
 /// </summary>
 /// <param name="this">The finder.</param>
 /// <param name="context">The context of the search. All results should be within this context.</param>
 /// <param name="searchText">The search string used to match the elements.</param>
 public static IReadOnlyCollection <IWebElement> TryFind(this IFind @this, ISearchContext context, string searchText)
 {
     try
     {
         return(@this.Find(context, searchText).Where(x => x.Displayed).ToList());
     }
     catch
     {
         return(new IWebElement[0]);
     }
 }
Exemplo n.º 8
0
 public frm_findcs(IFind ifind, string select_text)
 {
     InitializeComponent();
     ifnd = ifind;
     if (ifnd.list_text == null)
     {
         ifnd.list_text = new List <string>();
     }
     else
     {
         cmb_find.Items.AddRange(ifnd.list_text.ToArray());
     }
     cmb_find.Text = select_text;
 }
Exemplo n.º 9
0
        public FindViewModel(IFind hot)
            : this()
        {
            _hot = hot;

            GetBanner          = new RelayCommand(GetBannerMethod);
            RefreshRecommends  = new RelayCommand(RefreshRecommendsMethod);
            RefreshHotAnswers  = new RelayCommand(RefreshHotAnswersMethod);
            RefreshCollections = new RelayCommand(RefreshHotCollectionsMethod);

            Recommends = new IncrementalLoading <EditorRecommend>(GetMoreRecommends, "/hot/editor/recommend", FirstOffset, false);

            HotAnswers = new IncrementalLoading <HotAnswer>(GetMoreHotAnswers, "/hot/top/answers/day", FirstOffset, false);

            Collections = new IncrementalLoading <HotCollection>(GetMoreHotCollections, "/explore/collections", FirstOffset, false);
        }
Exemplo n.º 10
0
        /// <summary>
        /// find the book usinf criterion
        /// </summary>
        /// <param name="obj">search this object in list</param>
        /// <param name="criterion">criterion which is used to define the way of finding</param>
        /// <returns></returns>
        public List <Book> FindBookByTag(IFind criterion)
        {
            log.Debug("Try to find book by tag");
            List <Book> findList = new List <Book>();

            findList = listBooks.FindAll(book => criterion.Find(book));

            if (findList.Count == 0)
            {
                log.Trace("The book was not found");
                throw new ArgumentException();
            }
            else
            {
                log.Debug("The book was found by tag");
                return(findList);
            }
        }
Exemplo n.º 11
0
 public ReadPresenter(IFind view, UpdateDeletePresenter updateDeletePresenter, CreatePresenter createPresenter)
 {
     _view           = view;
     _view.OnShow   += FilterSort;
     _view.OnFilter += () =>
     {
         //Hop over sortering og sæt radioSortName og sortdirection, når der indtastes filterkriterie:
         //Hvis der er tale om en meget stor datasamling eg. 1/2 million+,
         //kan man vælge at undlade sortering efterfølgende og kun vise listen som den er sorteret i forvejen (efter LastName)
         skipSort            = true;
         _view.SortNameRadio = false;
         _view.SortAgeRadio  = false;
         _view.Sort_Salary_Major_Type_Radio = false;
         _view.SortDirectionCheck           = false;
         FilterSort();
     };
     updateDeletePresenter.CallShow += FilterSort;
     createPresenter.CallShow       += FilterSort;
 }
Exemplo n.º 12
0
        public override List <IEntity> GetReferencedEntities(IFind modelRef, ModelCode referenceId)
        {
            switch (referenceId)
            {
            case ModelCode.BUSBAR_VOLTAGE:
                List <IEntity> referencedEntities = new List <IEntity>();
                if (baseVoltage > 0)
                {
                    referencedEntities.Add(modelRef.GetEntityForLocalId(baseVoltage));
                }
                else
                {
                    referencedEntities.Add(null);
                }

                return(referencedEntities);

            default:
                return(base.GetReferencedEntities(modelRef, referenceId));
            }
        }
Exemplo n.º 13
0
        public IArray Find()
        {
            if (this.cboLayers.SelectedIndex < 0)
            {
                return(null);
            }
            this.AddSearchStingToComboBox();
            IArray array2 = new ArrayClass();
            IFind  layer  = (this.cboLayers.SelectedItem as LayerObject).Layer as IFind;

            this.m_strFindLayers = this.cboLayers.Text;
            IArray unk = this.Find(layer);

            if (unk != null)
            {
                array2.Add(unk);
            }
            if (array2.Count == 0)
            {
                return(null);
            }
            return(array2);
        }
Exemplo n.º 14
0
 /// <summary>
 /// 启动引导
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="configs">依赖配置</param>
 /// <param name="aopConfigAction">Aop配置操作</param>
 /// <param name="finder">类型查找器</param>
 public static IServiceProvider Run(IServiceCollection services = null, IConfig[] configs = null,
                                    Action <IAspectConfiguration> aopConfigAction = null, IFind finder = null)
 {
     return(new Bootstrapper(services, configs, aopConfigAction, finder).Bootstrap());
 }
Exemplo n.º 15
0
 /// <summary>
 /// 启动引导
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="configs">依赖配置</param>
 /// <param name="finder">类型查找器</param>
 /// <param name="context">上下文</param>
 public static IServiceProvider Run(IServiceCollection services = null, IContext context = null, IConfig[] configs = null, IFind finder = null)
 {
     return(new Bootstrapper(services, context, configs, finder).Bootstrap());
 }
Exemplo n.º 16
0
 //IFind
 public static void Clear(this IFind fc)
 {
     fc.transform.ClearChildren();
 }
Exemplo n.º 17
0
 public TransactionsController(IDataService dataService, IFind dataFind, ILogger <TransactionsController> logger)
 {
     _dataFind    = dataFind;
     _dataService = dataService;
     _logger      = logger;
 }
Exemplo n.º 18
0
        public static void LoadWriteFile(string filenameIn, string filenameOut, int numOfThreads, IFind parent)
        {
            string bug;
            string program = "";

            string[]           programSplitted = null;
            ManualResetEvent[] doneEvents;
            BugFind[]          bugFinders;

            using (TextReader reader = new StreamReader(filenameIn))
            {
                if ((bug = reader.ReadLine()) != null && (program = reader.ReadLine()) != null)
                {
                    do
                    {
                        parent.NextLoop();

                        programSplitted = Regex.Split(program, bug);
                        if (programSplitted.Length < numOfThreads)
                        {
                            numOfThreads = programSplitted.Length;
                        }
                        doneEvents = new ManualResetEvent[numOfThreads];
                        bugFinders = new BugFind[numOfThreads];
                        int[] stringsForThreadsCount = new int[numOfThreads];
                        for (int i = 0, threadIndex = 0; i < programSplitted.Length; i++, threadIndex++)
                        {
                            if (threadIndex >= bugFinders.Length)
                            {
                                threadIndex = 0;
                            }
                            ++stringsForThreadsCount[threadIndex];
                        }

                        int textIndexStop = 0;
                        for (int i = 0, textIndexStart = 0
                             ; i < stringsForThreadsCount.Length
                             ; i++, textIndexStart = textIndexStop + 1)
                        {
                            textIndexStop = textIndexStart + stringsForThreadsCount[i] - 1;

                            doneEvents[i] = new ManualResetEvent(false);
                            bugFinders[i] = new BugFind(textIndexStart, textIndexStop,
                                                        bug, programSplitted, doneEvents[i]);

                            ThreadPool.QueueUserWorkItem(bugFinders[i].ThreadPoolCallback, i);
                        }
                        WaitHandle.WaitAll(doneEvents);
                        program = "";
                        for (int i = 0; i < bugFinders.Length; i++)
                        {
                            program += bugFinders[i].Output;
                        }
                    } while (program.Contains(bug));
                }
            }
            parent.FindingFinished();

            if (program != null)
            {
                using (TextWriter writer = File.CreateText(filenameOut))
                {
                    program = program.Replace("\r\n", "");
                    writer.Write(program);
                    writer.WriteLine();
                    parent.FileSavedAs(filenameOut);
                }
            }
        }
Exemplo n.º 19
0
 public static Transform Find(this IFind fc)
 {
     return(GOTool.GetOrAddTrans(fc.transform, fc.findName));
 }
Exemplo n.º 20
0
 public void Open(IFind finder)
 {
     m_finder = finder;
     window().makeKeyAndOrderFront(null);
     Unused.Value = window().makeFirstResponder(m_findBox.Value);
     OnEnableButtons();
 }
Exemplo n.º 21
0
 /// <summary>
 /// 初始化依赖引导器
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="finder">类型查找器</param>
 public Bootstrapper(IServiceCollection services, IFind finder)
 {
     _services = services ?? new ServiceCollection();
     _finder   = finder ?? new Finder();
 }
Exemplo n.º 22
0
 /// <summary>
 /// 启动引导
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="finder">类型查找器</param>
 public static ContainerBuilder Run(IServiceCollection services = null, IFind finder = null)
 {
     return(new Bootstrapper(services, finder).Bootstrap());
 }
Exemplo n.º 23
0
 /// <summary>
 /// 初始化类型查找器测试
 /// </summary>
 public FinderTest()
 {
     _finder = new Finder();
 }
Exemplo n.º 24
0
        public static void LoadWriteFile(string filenameIn, string filenameOut, int numOfThreads, IFind parent)
        {
            string bug;
            string program = "";
            string[] programSplitted = null;
            ManualResetEvent[] doneEvents;
            BugFind[] bugFinders;

            using (TextReader reader = new StreamReader(filenameIn))
            {
                if ((bug = reader.ReadLine()) != null && (program = reader.ReadLine()) != null)
                {
                    do
                    {
                        parent.NextLoop();

                        programSplitted = Regex.Split(program, bug);
                        if (programSplitted.Length < numOfThreads)
                            numOfThreads = programSplitted.Length;
                        doneEvents = new ManualResetEvent[numOfThreads];
                        bugFinders = new BugFind[numOfThreads];
                        int[] stringsForThreadsCount = new int[numOfThreads];
                        for (int i = 0, threadIndex = 0; i < programSplitted.Length; i++, threadIndex++)
                        {
                            if (threadIndex >= bugFinders.Length)
                                threadIndex = 0;
                            ++stringsForThreadsCount[threadIndex];
                        }

                        int textIndexStop = 0;
                        for (int i = 0, textIndexStart = 0
                            ; i < stringsForThreadsCount.Length
                            ; i++, textIndexStart = textIndexStop + 1)
                        {
                            textIndexStop = textIndexStart + stringsForThreadsCount[i] - 1;

                            doneEvents[i] = new ManualResetEvent(false);
                            bugFinders[i] = new BugFind(textIndexStart, textIndexStop,
                                bug, programSplitted, doneEvents[i]);

                            ThreadPool.QueueUserWorkItem(bugFinders[i].ThreadPoolCallback, i);
                        }
                        WaitHandle.WaitAll(doneEvents);
                        program = "";
                        for (int i = 0; i < bugFinders.Length; i++)
                        {
                            program += bugFinders[i].Output;
                        }
                    } while (program.Contains(bug));
                }
            }
            parent.FindingFinished();

            if (program != null)
            {
                using (TextWriter writer = File.CreateText(filenameOut))
                {
                    program = program.Replace("\r\n", "");
                    writer.Write(program);
                    writer.WriteLine();
                    parent.FileSavedAs(filenameOut);
                }
            }
        }