Exemplo n.º 1
0
        private void DoSearch()
        {
            if (!_catalog.IsOpen)
            {
                MessageBox.Show("Open a _catalog first!");
                return;
            }

            HelpFilter filter = null;  //no fancy adv filtering yet

            UpdateStatus(false);
            searchListView.VirtualListSize = 0;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                _searchTopics = _catalogRead.GetSearchResults(_catalog, _sQuery, filter, SearchOptions.None, _pageSize, _pageNumber, out _totalAvailableHits);
                searchListView.VirtualListSize = _searchTopics.Count;
                UpdateStatus(true);
            }
            catch
            {
                searchListView.VirtualListSize = 0;
                _pageNumber         = 1;
                _totalAvailableHits = 0;
                MessageBox.Show("Exception calling ICatalogRead.GetSearchResults(..)");
                return;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 2
0
        public int _totalAvailableHits = 0;   //total hits in all _pages -- Do a search call to fill each page

        private void DoSearch()
        {
            if (!Globals.catalog.IsOpen)
            {
                MessageBox.Show("Open a catalog first!");
                return;
            }

            HelpFilter filter = null;  //no fancy adv filtering yet

            UpdateStatus(false);
            Cursor.Current = Cursors.WaitCursor;
            resultsPanel.Clear();

            try
            {
                ITopicCollection helpTopics = Globals.catalogRead.GetSearchResults(Globals.catalog, _sQuery, filter, _searchOptions, _pageSize, _pageNumber, out _totalAvailableHits);
                resultsPanel.SetVirtualList(helpTopics);
                UpdateStatus(true);
            }
            catch
            {
                resultsPanel.Clear();
                _pageNumber         = 1;
                _totalAvailableHits = 0;
                MessageBox.Show("Exception calling ICatalogRead.GetSearchResults(..)");
                return;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 3
0
        public void Clear()
        {
            detailsRichTextBox.Clear();
            webBrowser1.Navigate("about:blank");

            searchResultLV.VirtualListSize = 0;  //Clear ListView
            _helpTopics = null;
            _helpTopic = null;
        }
Exemplo n.º 4
0
        public void Clear()
        {
            detailsRichTextBox.Clear();
            webBrowser1.Navigate("about:blank");

            searchResultLV.VirtualListSize = 0;  //Clear ListView
            _helpTopics = null;
            _helpTopic  = null;
        }
Exemplo n.º 5
0
        // Set Data for panel

        public void SetVirtualList(ITopicCollection helpTopics)
        {
            Clear();
            this._helpTopics = helpTopics;
            this.searchResultLV.VirtualListSize = helpTopics.Count;

            //Auto=select first linkNode & show destails
            if (searchResultLV.Items.Count > 0)
            {
                searchResultLV.Items[0].Selected = true;
                UpdateTopicView(0);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new instance of <see cref="ITopicCollection"/> from an existing one
        /// </summary>
        /// <param name="topicCollection">Existing collection, seeding this one</param>
        /// <param name="topicConsumer">Context where this topic will be consumed</param>
        public TopicBuilder(ITopicCollection topicCollection, TopicConsumer topicConsumer)
        {
            TopicCollection = topicCollection;
            Consumer        = topicConsumer;

            _state = Consumer == TopicConsumer.Publisher
                ? (IBuilderState) new PublisherState(this)
                : new SubscriberState(this);

            if (Consumer == TopicConsumer.Publisher)
            {
                var validator = ValidatorFactory.GetPublishedTopicValidator();
                TopicCollection.ToList()
                .ForEach(validator.Validate);
            }
        }
Exemplo n.º 7
0
        private void AddChildNodes(TreeNode treeNode)
        {
            Topic topic = treeNode.Tag as Topic;

            if (topic == null) //unlikely
            {
                return;
            }

            treeNode.Nodes.Clear();  //wipe out the fake node we added

            Cursor.Current = Cursors.WaitCursor;
            treeView1.BeginUpdate();
            try
            {
                //Get Child list
                ITopicCollection topics = _catalogRead.GetTableOfContents(_catalog, topic.Id, null, TocReturnDetail.TocChildren);
                for (int i = 0; i < topics.Count; i++)
                {
                    topics.MoveTo(i);
                    Topic    childTopic = (Topic)topics.Current;
                    TreeNode tn         = new TreeNode(childTopic.Title);
                    tn.Tag = childTopic;
                    treeNode.Nodes.Add(tn);
                }

                //Add virtual node.. add temporary child so the +\- button show. Add junk text for now and add correct text when the node expands
                foreach (TreeNode node in treeNode.Nodes)
                {
                    topic = node.Tag as Topic;
                    if (topic != null && topic.TableOfContentsHasChildren)
                    {
                        node.Nodes.Add(VIRTUAL_NODE);
                    }
                }
            }
            finally
            {
                treeView1.EndUpdate();
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 8
0
        private void keywordsListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            resultsListView.Items.Clear();
            _results.Clear();

            if (indexListView.SelectedIndices.Count <= 0)
            {
                return;
            }
            int index = indexListView.SelectedIndices[0];

            _helpKeywords.MoveTo(index);
            IKeyword keyword = (IKeyword)_helpKeywords.Current;

            if (keyword.Topics.Count > 0)
            {
                ITopicCollection topics = keyword.Topics;
                topics.MoveTo(0);

                for (int i = 0; i < topics.Count; i++)
                {
                    _results.Add((Topic)topics.Current);
                    topics.MoveNext();
                }

                //Load ListView with results
                for (int i = 0; i < topics.Count; i++)
                {
                    ListViewItem li = new ListViewItem((i + 1).ToString());
                    li.ToolTipText = MakeTopicToolTip(_results[i]); // just for dev info -- Hover over the first column to see this tip
                    li.SubItems.AddRange(new String[] { _results[i].Title, _results[i].DisplayVersion });
                    resultsListView.Items.Add(li);
                }

                //Select linkNode #1 -- and trigger display of topic in webBrowser1
                resultsListView.Items[0].Selected = true;
            }
        }
Exemplo n.º 9
0
        // TOC Command

        private void DoTOCCmd()
        {
            if (!Globals.catalog.IsOpen)
            {
                MessageBox.Show("Open a catalog first!");
                return;
            }

            String TopicId = TopicIdCbo.Text.Trim();

            if (String.IsNullOrEmpty(TopicId))
            {
                MessageBox.Show("Topic ID required. ");
                return;
            }

            HelpFilter filter = null;  //no fancy adv filtering yet

            resultsPanel.Clear();

            TocReturnDetail tocDetail = (TocReturnDetail)tocDetailsCbo.SelectedIndex;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                ITopicCollection helpTopics = Globals.catalogRead.GetTableOfContents(Globals.catalog, TopicId, filter, tocDetail);
                resultsPanel.SetVirtualList(helpTopics);
            }
            catch
            {
                resultsPanel.Clear();
                MessageBox.Show("Exception calling ICatalogRead.GetTableOfContents(..)");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 10
0
        private void InitToc()
        {
            if (_catalog == null || !_catalog.IsOpen)
            {
                treeView1.Nodes.Clear();
                _lastContentPath = null;
                return;
            }

            // No need to update if nothing has changed
            if (_catalog.ContentPath == _lastContentPath)
            {
                return;
            }
            _lastContentPath = _catalog.ContentPath;

            treeView1.Nodes.Clear();
            try
            {
                //Is there a -1 super toc node? Added it (RWC at time of writing not sure if we can show the -1 linkNode)

                TreeNode           tnHome       = null;
                TreeNodeCollection tnCollection = null;

                ITopic topic = _catalogRead.GetIndexedTopicDetails(_catalog, "-1", null);
                if (topic != null)
                {
                    String sTitle = topic.Title;       // -1 linkNode can be an empty title
                    if (String.IsNullOrEmpty(sTitle))
                    {
                        sTitle = "Help Viewer Home";
                    }

                    tnHome     = new TreeNode(sTitle);
                    tnHome.Tag = topic;   //Keep tabs on the Topic obj
                    treeView1.Nodes.Add(tnHome);
                }

                //Add next level list
                ITopicCollection topics = _catalogRead.GetTableOfContents(_catalog, "-1", null, TocReturnDetail.TocRootNodes);
                if (topics.Count > 0)
                {
                    if (tnHome == null)
                    {
                        tnCollection = treeView1.Nodes;
                    }
                    else
                    {
                        tnCollection = tnHome.Nodes;
                    }

                    treeView1.BeginUpdate();
                    for (int i = 0; i < topics.Count; i++)
                    {
                        topics.MoveTo(i);
                        //Topic
                        topic = (Topic)topics.Current;

                        TreeNode tn = new TreeNode(topic.Title);
                        tn.Tag = topic;   //Keep tabs on the Topic obj
                        tnCollection.Add(tn);
                    }
                    treeView1.EndUpdate();

                    if (tnHome != null)
                    {
                        tnHome.Expand();
                    }

                    //Add one more level of list
                    foreach (TreeNode node in tnCollection)
                    {
                        AddChildNodes(node);
                    }
                }

                //nice to expand level 0 list if only one node
                if (treeView1.Nodes.Count == 1)
                {
                    treeView1.Nodes[0].Expand();
                }

                //Hook up events
                treeView1.BeforeExpand   += new TreeViewCancelEventHandler(this.treeView1_BeforeExpand);
                treeView1.BeforeCollapse += new TreeViewCancelEventHandler(this.treeView1_BeforeCollapse);
            }
            catch
            {
                MessageBox.Show("Unknown exception building TOC");
            }
        }
Exemplo n.º 11
0
 /// <inheritdoc cref="Rule{T}.IsValid"/>
 protected override bool IsValid(ITopicCollection value)
 => value.Levels < value.MaxLevel;
Exemplo n.º 12
0
 /// <inheritdoc cref="Rule{T}.IsValid"/>
 protected override bool IsValid(ITopicCollection value)
 => value.IsAppendingAllowed;
Exemplo n.º 13
0
        // Set Data for panel
        public void SetVirtualList(ITopicCollection helpTopics)
        {
            Clear();
            this._helpTopics = helpTopics;
            this.searchResultLV.VirtualListSize = helpTopics.Count;

            //Auto=select first linkNode & show destails
            if (searchResultLV.Items.Count > 0)
            {
                searchResultLV.Items[0].Selected = true;
                UpdateTopicView(0);
            }
        }
Exemplo n.º 14
0
        private void DoSearch()
        {
            if (!_catalog.IsOpen)
            {
                MessageBox.Show("Open a _catalog first!");
                return;
            }

            HelpFilter filter = null;  //no fancy adv filtering yet
            UpdateStatus(false);
            searchListView.VirtualListSize = 0;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                _searchTopics = _catalogRead.GetSearchResults(_catalog, _sQuery, filter, SearchOptions.None, _pageSize, _pageNumber, out _totalAvailableHits);
                searchListView.VirtualListSize = _searchTopics.Count;
                UpdateStatus(true);
            }
            catch
            {
                searchListView.VirtualListSize = 0;
                _pageNumber = 1;
                _totalAvailableHits = 0;
                MessageBox.Show("Exception calling ICatalogRead.GetSearchResults(..)");
                return;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }