示例#1
0
        public void Should_Query_With_simple_args()
        {
            // HACK: hardcoded result
            const string expectedResult = "<?xml version=\"1.0\" encoding=\"utf-8\"?><SimpleCall>" +
                                          "<methodName>simpleMethod</methodName><params><param><value>" +
                                          "<i4>12</i4></value></param></params></SimpleCall>";

            var call = new SimpleCall
            {
                Method    = "simpleMethod",
                Arguments = new List <MethodCallArgument>
                {
                    new MethodCallArgument {
                        Value = 12
                    }
                }
            };

            string serializedCall;

            using (var memoryStream = new MemoryStream(call.Serialize()))
                using (var streamReader = new StreamReader(memoryStream))
                    serializedCall = streamReader.ReadToEnd();

            Log.Info(serializedCall);

            Assert.That(serializedCall, Is.EqualTo(expectedResult));
        }
示例#2
0
        /// <summary>
        /// Initialize a new instance of the VisualContainerControlBase class.
        /// </summary>
        protected VisualContainerControlBase()
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //    True  - AllPaintingInWmPaint
            //    False - CacheText
            //    False - ContainerControl
            //    False - EnableNotifyMessage
            //    False - FixedHeight
            //    False - FixedWidth
            //    False - Opaque
            //    False - OptimizedDoubleBuffer
            //    False - ResizeRedraw
            //    True  - Selectable
            //    True  - StandardClick
            //    True  - StandardDoubleClick
            //    False - SupportsTransparentBackColor
            //    False - UserMouse
            //    True  - UserPaint
            //    True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Yes, we want to be drawn double buffered by default
            DoubleBuffered = true;

            // Setup the invokes
            _refreshCall = OnPerformRefresh;
            _layoutCall  = OnPerformLayout;

            // Setup the need paint delegate
            NeedPaintDelegate        = OnNeedPaint;
            NeedPaintPaletteDelegate = OnPaletteNeedPaint;

            // Must layout before first draw attempt
            _layoutDirty        = true;
            _evalTransparent    = true;
            DirtyPaletteCounter = 1;

            // Set the palette and renderer to the defaults as specified by the manager
            _localPalette = null;
            SetPalette(KryptonManager.CurrentGlobalPalette);
            _paletteMode = PaletteMode.Global;

            // Create constant target for resolving palette delegates
            Redirector = CreateRedirector();

            // Hook into global palette changing events
            KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged;

            // We need to notice when system color settings change
            SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
        }
示例#3
0
        /// <summary>
        /// Initialize a new instance of the VisualPopup class.
        /// </summary>
        /// <param name="viewManager">View manager instance for managing view display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="shadow">Does the popup need a shadow effect.</param>
        public VisualPopup(ViewManager viewManager,
                           IRenderer renderer,
                           bool shadow)
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //    True  - AllPaintingInWmPaint
            //    False - CacheText
            //    False - ContainerControl
            //    False - EnableNotifyMessage
            //    False - FixedHeight
            //    False - FixedWidth
            //    False - Opaque
            //    False - OptimizedDoubleBuffer
            //    False - ResizeRedraw
            //    False - Selectable
            //    True  - StandardClick
            //    True  - StandardDoubleClick
            //    False - SupportsTransparentBackColor
            //    False - UserMouse
            //    True  - UserPaint
            //    True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Cannot select control by using mouse to click it
            SetStyle(ControlStyles.Selectable, false);

            // Cache incoming references
            Renderer    = renderer;
            ViewManager = viewManager;

            // Setup the need paint delegate
            NeedPaintDelegate = OnNeedPaint;

            // Setup the invokes
            _refreshCall = OnPerformRefresh;

            // Default other properties
            _layoutDirty = true;
            _refresh     = true;

            // Create the shadow control
            if (shadow)
            {
                _shadow = new VisualPopupShadow();
            }
        }
        /// <summary>
        /// Initialize a new instance of the VisualPanel class.
        /// </summary>
        protected VisualPanel()
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //    True  - AllPaintingInWmPaint
            //    False - CacheText
            //    False - ContainerControl
            //    False - EnableNotifyMessage
            //    False - FixedHeight
            //    False - FixedWidth
            //    False - Opaque
            //    False - OptimizedDoubleBuffer
            //    False - ResizeRedraw
            //    True  - Selectable
            //    True  - StandardClick
            //    True  - StandardDoubleClick
            //    False - SupportsTransparentBackColor
            //    False - UserMouse
            //    True  - UserPaint
            //    True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to allow a transparent background
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // We act as a container for child controls
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select a panel
            SetStyle(ControlStyles.Selectable, false);

            // Yes, we want to be drawn double buffered by default
            DoubleBuffered = true;

            // Setup the invoke used to refresh display
            _refreshCall = OnPerformRefresh;

            // Setup the need paint delegate
            NeedPaintDelegate = OnNeedPaint;

            // Must layout before first draw attempt
            _layoutDirty     = true;
            _evalTransparent = true;
            _lastLayoutSize  = Size.Empty;

            // Set the palette to the defaults as specified by the manager
            _localPalette = null;
            SetPalette(KryptonManager.CurrentGlobalPalette);
            _paletteMode = PaletteMode.Global;

            // Create constant target for resolving palette delegates
            Redirector = new PaletteRedirect(_palette);

            AttachGlobalEvents();
        }
        /// <summary>
        /// Initialize a new instance of the VisualControl class.
        /// </summary>
        protected VisualControlBase()
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //    True  - AllPaintingInWmPaint
            //    False - CacheText
            //    False - ContainerControl
            //    False - EnableNotifyMessage
            //    False - FixedHeight
            //    False - FixedWidth
            //    False - Opaque
            //    False - OptimizedDoubleBuffer
            //    False - ResizeRedraw
            //    True  - Selectable
            //    True  - StandardClick
            //    True  - StandardDoubleClick
            //    False - SupportsTransparentBackColor
            //    False - UserMouse
            //    True  - UserPaint
            //    True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Yes, we want to be drawn double buffered by default
            base.DoubleBuffered = true;

            // Setup the invokes
            _refreshCall = OnPerformRefresh;
            _layoutCall  = OnPerformLayout;

            // Setup the need paint delegate
            NeedPaintDelegate        = OnNeedPaint;
            NeedPaintPaletteDelegate = OnPaletteNeedPaint;

            // Must layout before first draw attempt
            _layoutDirty        = true;
            _evalTransparent    = true;
            DirtyPaletteCounter = 1;

            // Set the palette and renderer to the defaults as specified by the manager
            _localPalette = null;
            SetPalette(KryptonManager.CurrentGlobalPalette);
            _paletteMode = PaletteMode.Global;

            // Create constant target for resolving palette delegates
            Redirector = CreateRedirector();

            AttachGlobalEvents();

            // Do the Tooltip Magic
            ToolTipValues = new ToolTipValues(NeedPaintDelegate);
            // Create the manager for handling tooltips
            // ReSharper disable once UseObjectOrCollectionInitializer
            _toolTipManager                = new ToolTipManager();
            _toolTipManager.ShowToolTip   += OnShowToolTip;
            _toolTipManager.CancelToolTip += OnCancelToolTip;
        }
示例#6
0
 public void remove_Click(SimpleCall handler)
 {
 }
示例#7
0
 public void add_Click(SimpleCall handler)
 {
 }
示例#8
0
        /// <summary>
        /// Initialize a new instance of the VisualPopup class.
        /// </summary>
        /// <param name="viewManager">View manager instance for managing view display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="shadow">Does the popup need a shadow effect.</param>
        public VisualPopup(ViewManager viewManager,
                           IRenderer renderer,
                           bool shadow)
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //	True  - AllPaintingInWmPaint
            //	False - CacheText
            //	False - ContainerControl
            //	False - EnableNotifyMessage
            //	False - FixedHeight
            //	False - FixedWidth
            //	False - Opaque
            //	False - OptimizedDoubleBuffer
            //	False - ResizeRedraw
            //	False - Selectable
            //	True  - StandardClick
            //	True  - StandardDoubleClick
            //	False - SupportsTransparentBackColor
            //	False - UserMouse
            //	True  - UserPaint
            //	True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Cannot select control by using mouse to click it
            SetStyle(ControlStyles.Selectable, false);

            // Cache incoming references
            _renderer = renderer;
            _viewManager = viewManager;

            // Setup the need paint delegate
            _needPaintDelegate = new NeedPaintHandler(OnNeedPaint);

            // Setup the invokes
            _refreshCall = new SimpleCall(OnPerformRefresh);

            // Default other properties
            _layoutDirty = true;
            _refresh = true;

            // Create the shadow control
            if (shadow)
                _shadow = new VisualPopupShadow();
        }
        protected VisualContainerControlBase()
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //	True  - AllPaintingInWmPaint
            //	False - CacheText
            //	False - ContainerControl
            //	False - EnableNotifyMessage
            //	False - FixedHeight
            //	False - FixedWidth
            //	False - Opaque
            //	False - OptimizedDoubleBuffer
            //	False - ResizeRedraw
            //	True  - Selectable
            //	True  - StandardClick
            //	True  - StandardDoubleClick
            //	False - SupportsTransparentBackColor
            //	False - UserMouse
            //	True  - UserPaint
            //	True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Yes, we want to be drawn double buffered by default
            DoubleBuffered = true;

            // Setup the invokes
            _refreshCall = new SimpleCall(OnPerformRefresh);
            _layoutCall = new SimpleCall(OnPerformLayout);

            // Setup the need paint delegate
            _needPaintDelegate = new NeedPaintHandler(OnNeedPaint);
            _needPaintPaletteDelegate = new NeedPaintHandler(OnPaletteNeedPaint);

            // Must layout before first draw attempt
            _layoutDirty = true;
            _evalTransparent = true;
            _dirtyPaletteCounter = 1;

            // Set the palette and renderer to the defaults as specified by the manager
            _localPalette = null;
            SetPalette(KryptonManager.CurrentGlobalPalette);
            _paletteMode = PaletteMode.Global;

            // Create constant target for resolving palette delegates
            _redirector = CreateRedirector();

            // Hook into global palette changing events
            KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged);

            // We need to notice when system color settings change
            SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(OnUserPreferenceChanged);
        }
示例#10
0
        /// <summary>
        /// Initialize a new instance of the VisualPanel class.
        /// </summary>
        protected VisualPanel()
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //	True  - AllPaintingInWmPaint
            //	False - CacheText
            //	False - ContainerControl
            //	False - EnableNotifyMessage
            //	False - FixedHeight
            //	False - FixedWidth
            //	False - Opaque
            //	False - OptimizedDoubleBuffer
            //	False - ResizeRedraw
            //	True  - Selectable
            //	True  - StandardClick
            //	True  - StandardDoubleClick
            //	False - SupportsTransparentBackColor
            //	False - UserMouse
            //	True  - UserPaint
            //	True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to allow a transparent background
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // We act as a container for child controls
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select a panel
            SetStyle(ControlStyles.Selectable, false);

            // Yes, we want to be drawn double buffered by default
            DoubleBuffered = true;

            // Setup the invoke used to refresh display
            _refreshCall = new SimpleCall(OnPerformRefresh);

            // Setup the need paint delegate
            _needPaintDelegate = new NeedPaintHandler(OnNeedPaint);

            // Must layout before first draw attempt
            _layoutDirty = true;
            _evalTransparent = true;
            _lastLayoutSize = Size.Empty;

            // Set the palette to the defaults as specified by the manager
            _localPalette = null;
            SetPalette(KryptonManager.CurrentGlobalPalette);
            _paletteMode = PaletteMode.Global;

            // Create constant target for resolving palette delegates
            _redirector = new PaletteRedirect(_palette);

            AttachGlobalEvents();
        }
示例#11
0
        public void _Search()
        {
            //string request = (searchParams as string);
            string old_request = "";
            string new_request = "";

            while (true)
            {
                lock (_request)
                {
                    new_request = _request;
                }

                if (new_request != old_request)
                {
                    old_request = new_request;
                    if (new_request.Length != 0)
                    {
                        IndexReader reader    = null;
                        Stopwatch   stopWatch = new Stopwatch();
                        stopWatch.Start();

                        string index_path = Owl.Properties.Settings.Default.IndexPath;
                        try
                        {
                            reader = IndexReader.Open(index_path);
                        }
                        catch
                        {
                            status.SearchStatus = string.Format("Problems while opening Index: has it been created in {0} ?", Owl.Properties.Settings.Default.IndexPath);
                        }
                        int nb_docs    = 0;
                        int found_docs = 0;
                        if (reader != null)
                        {
                            try
                            {
                                Searcher searcher = new IndexSearcher(reader);
                                Analyzer analyzer = new StandardAnalyzer();
                                //QueryParser parser = new QueryParser("contents", analyzer);
                                MultiFieldQueryParser parser = new MultiFieldQueryParser(new string[] { "contents", "path" }, analyzer);

                                Query query = parser.Parse(new_request);

                                SimpleCall sc = delegate() { resultItems.Clear(); };
                                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, sc);

                                //Hits hits = searcher.Search(query);
                                TopDocs docs    = searcher.Search(query, null, 100);
                                int     num_doc = 1;
                                foreach (ScoreDoc score_doc in docs.scoreDocs)
                                {
                                    if (HasRequestChanged(new_request))
                                    {
                                        break;
                                    }

                                    Document      doc  = searcher.Doc(score_doc.doc);
                                    System.String path = doc.Get("path");
                                    //
                                    SimpleCall sc2 = delegate()
                                    {
                                        resultItems.Add(new Result(string.Format("{0} - {2} ({1})%\n{3}",
                                                                                 num_doc++, (int)((score_doc.score * 100) / docs.GetMaxScore()),
                                                                                 System.IO.Path.GetFileName(path), System.IO.Path.GetDirectoryName(path)), path));
                                    };
                                    Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, sc2);

                                    //
                                }
                                found_docs = docs.scoreDocs.Length;
                                nb_docs    = reader.NumDocs();
                                searcher.Close();
                            }
                            //catch (TokenMgrError)
                            //{ }
                            catch (Exception e)
                            {
                                status.SearchStatus = string.Format("Problems with request {0} ", new_request);
                                Log.Error(e);
                            }
                            finally
                            {
                                reader.Close();
                                stopWatch.Stop();
                            }
                        }
                        //---
                        status.SearchStatus = string.Format("{0} results for '{3}' in {1} docs (took {2} ms)", found_docs,
                                                            nb_docs, stopWatch.ElapsedMilliseconds, new_request);
                    }
                }
                else
                {
                    _mre.Reset();
                    _mre.WaitOne();
                }
                //Thread.Sleep(250);
            }
        }
示例#12
0
 public QueryProvider(IDataProvider dataProvider)
 {
     _impl = _simpleCall = new SimpleCall(dataProvider);
     _callWithInterception = new CallWithInterception(dataProvider);
 }