示例#1
0
        public static void Show(IServiceProvider serviceProvider, Control parent, NiFindOptions options, NiFindOptions optionsMask, INiFindTarget findTarget)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");
            if (parent == null)
                throw new ArgumentNullException("parent");
            if (findTarget == null)
                throw new ArgumentNullException("findTarget");

            var control = parent.Controls.OfType<FindControl>().SingleOrDefault();

            if (control == null)
            {
                control = new FindControl
                {
                    Anchor = AnchorStyles.Right,
                    Site = new SiteProxy(serviceProvider)
                };

                control.Left = parent.ClientSize.Width - control.Width;

                parent.Controls.Add(control);
            }

            control._findManager.FindTarget = findTarget;
            control._findManager.SetOptions(options, optionsMask);

            control._findWhat.Focus();
        }
示例#2
0
            public bool IsNewFindTarget(INiFindTarget findTarget)
            {
                if (findTarget == null)
                {
                    throw new ArgumentNullException("findTarget");
                }

                return(_findTargetsSeen.Add(findTarget));
            }
示例#3
0
 public static FindState Create(FindManager manager, NiFindOptions options, INiFindTarget findTarget)
 {
     return new FindState(findTarget)
     {
         Options = options,
         FindWhat = manager._view.GetFindWhatText(),
         ReplaceWith = manager._view.GetReplaceWithText(),
         LookIn = manager._view.GetLookInText(),
         LookInFileTypes = manager._view.GetLookAtFileTypesText()
     };
 }
示例#4
0
        private bool PerformSingleFind(INiFindTarget findTarget)
        {
            bool reset = _state.IsNewFindTarget(findTarget);

            NiFindResult result;

            ErrorUtil.ThrowOnFailure(findTarget.Find(
                                         _state.FindWhat,
                                         _state.Options,
                                         reset,
                                         _findHelper,
                                         out result
                                         ));

            if (result == NiFindResult.Found)
            {
                return(true);
            }
            return(false);
        }
示例#5
0
 public SingleTargetIterator(INiFindTarget findTarget)
 {
     _findTarget = findTarget;
 }
示例#6
0
 public static FindState Create(FindManager manager, NiFindOptions options, INiFindTarget findTarget)
 {
     return(new FindState(findTarget)
     {
         Options = options,
         FindWhat = manager._view.GetFindWhatText(),
         ReplaceWith = manager._view.GetReplaceWithText(),
         LookIn = manager._view.GetLookInText(),
         LookInFileTypes = manager._view.GetLookAtFileTypesText()
     });
 }
示例#7
0
 private FindState(INiFindTarget findTarget)
 {
     _findTarget = findTarget;
     BeforeFirst = true;
 }
示例#8
0
 public SingleTargetIterator(INiFindTarget findTarget)
 {
     _findTarget = findTarget;
 }
示例#9
0
 private FindState(INiFindTarget findTarget)
 {
     _findTarget = findTarget;
     BeforeFirst = true;
 }
示例#10
0
            public bool IsNewFindTarget(INiFindTarget findTarget)
            {
                if (findTarget == null)
                    throw new ArgumentNullException("findTarget");

                return _findTargetsSeen.Add(findTarget);
            }
示例#11
0
        private bool PerformSingleFind(INiFindTarget findTarget)
        {
            bool reset = _state.IsNewFindTarget(findTarget);

            NiFindResult result;
            ErrorUtil.ThrowOnFailure(findTarget.Find(
                _state.FindWhat,
                _state.Options,
                reset,
                _findHelper,
                out result
                ));

            if (result == NiFindResult.Found)
                return true;
            return false;
        }
示例#12
0
        public static void Show(IServiceProvider serviceProvider, Control parent, NiFindOptions options, NiFindOptions optionsMask, INiFindTarget findTarget)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (findTarget == null)
            {
                throw new ArgumentNullException("findTarget");
            }

            var control = parent.Controls.OfType <FindControl>().SingleOrDefault();

            if (control == null)
            {
                control = new FindControl
                {
                    Anchor = AnchorStyles.Right,
                    Site   = new SiteProxy(serviceProvider)
                };

                control.Left = parent.ClientSize.Width - control.Width;

                parent.Controls.Add(control);
            }

            control._findManager.FindTarget = findTarget;
            control._findManager.SetOptions(options, optionsMask);

            control._findWhat.Focus();
        }