Exemple #1
0
        private void RegistryDumpToDebug()  // HV2 registry info --> Debug window
        {
            DebugForm.Clear();
            HV2RegInfo regInfo = new HV2RegInfo();

            Color textColor = Color.DarkCyan;

            DebugForm.rtf.WriteLine("RegistryView: " + regInfo.RegistryView.ToString(), textColor);
            DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0]");
            DebugForm.rtf.WriteLine("AppRoot: " + regInfo.AppRoot, textColor);
            DebugForm.rtf.WriteLine("DefaultHelpViewerCLSID = " + regInfo.DefaultHelpViewerCLSID, textColor);
            DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs]");
            DebugForm.rtf.WriteLine("ContentStore = " + regInfo.ContentStore, textColor);
            DebugForm.rtf.WriteLine("");

            List <CatalogItem> catalogList = CatalogList.GetCatalogs();

            catalogList.ForEach(delegate(CatalogItem catalog)
            {
                DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\" + catalog.CatalogID + "]");
                DebugForm.rtf.WriteLine("   LocationPath = " + catalog.LocationPath, textColor);
                catalog.Locales.ForEach(delegate(CatalogLocaleItem catlocale)
                {
                    DebugForm.rtf.WriteLine(@"   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\" + catalog.CatalogID + "\\" + catlocale.Locale + "]");
                    DebugForm.rtf.WriteLine("   CatalogName = " + catlocale.CatalogName, textColor);
                    DebugForm.rtf.WriteLine("   SeedFilePath = " + catlocale.SeedFilePath, textColor);
                });
            });
        }
Exemple #2
0
        private void AddMshxFileBtn_Click(object sender, EventArgs e)
        {
            DoCloseCatalog();  //close anything currently open
            EnableDisable();

            // Displays an OpenFileDialog for *.mshx
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter          = "MSHX Help Filess|*.mshx";
            openFileDialog1.Title           = "Select an MSHX file";
            openFileDialog1.CheckFileExists = true;
            openFileDialog1.CheckPathExists = true;
            openFileDialog1.DefaultExt      = ".mshx";
            //openFileDialog1.InitialDirectory
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                String filePath = openFileDialog1.FileName;

                //Add catalog file to list
                int origCount = _catalogList.Count;
                int i         = CatalogList.WildAddCollection(filePath, _catalogList, "");
                if (i >= 0)
                {
                    FillCatalogListBox(i);
                }
            }
        }
Exemple #3
0
        private void AddCatalogFolderBtn_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            if (_flatCalaogList.Count > 0)
            {
                folderBrowserDialog1.SelectedPath = ((FlatCatalogListItem)_flatCalaogList[0]).LocationPath;
            }
            folderBrowserDialog1.Description = "Add a catalog folder";

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                String folder = folderBrowserDialog1.SelectedPath;

                //Add catalog folder to list
                int origCount = _catalogList.Count;
                int i         = CatalogList.WildAddCollection(folder, _catalogList, "");

                if (i < 0)
                {
                    MessageBox.Show("Directory does not contain a \"ContentStore\" folder.\n" + folder);
                }
                else
                {
                    FillCatalogListBox(i);
                }
            }
        }
Exemple #4
0
 public override void Update()
 {
     base.Update();
     CatalogList.Update();
     LastButton.Update();
     NextButton.Update();
     PageScope.Update();
 }
Exemple #5
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     CatalogList.Draw(spriteBatch);
     LastButton.Draw(spriteBatch);
     PageScope.Draw(spriteBatch);
     NextButton.Draw(spriteBatch);
 }
Exemple #6
0
        private void CreateCatalogItems()
        {
            List <WorldObject> catalogObjects = parent.objectHandler.CatalogObjects;

            List <ListItem> itemList = new List <ListItem>();

            foreach (var catalogItem in catalogObjects)
            {
                itemList.Add(new CatalogListItem(CatalogList, catalogItem));
            }

            CatalogList.SetItemList(itemList);
        }
        private void CatalogPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (CatalogList.Items != null && CatalogList.SelectedIndex > 4)
            {
                if (CatalogList.Items.Count > CatalogList.SelectedIndex + 1 + 4)
                {
                    CatalogList.ScrollIntoView(CatalogList.Items[CatalogList.SelectedIndex + 4]);
                }
                else
                {
                    CatalogList.ScrollIntoView(CatalogList.SelectedItem);
                }

                this.ScroolButton.Tag     = "1";
                this.ScroolButton.Content = "到顶部";
            }
        }
Exemple #8
0
        public Page_Store()
        {
            InitializeComponent();
            self = this;


            // Init Catalog Cbo with catalog paths from the registry
            List <CatalogItem> _catalogList = CatalogList.GetCatalogs();   //Get list from the HV2 registry

            catalogPathCbo.Items.Clear();
            foreach (CatalogItem catalog in _catalogList)
            {
                catalogPathCbo.Items.Add(catalog.LocationPath);
            }
            if (catalogPathCbo.Items.Count > 0)  //Select something
            {
                catalogPathCbo.SelectedIndex = 0;
            }

            //Monitoring Catalog Locks
            monitorTimer.Interval = 1000;  //Poll for locks ever 1 sec
            monitorTimer.Tick    += new EventHandler(monitorTimer_Tick);

            //Init SuperTip and tips
            defaultMonitorTip = "Here we display the catalog write lock status on a timer.\nTry performing a catalog update (Help Manager) and watch the status change.\nUseful to apps like this which access catalog files directly.";
            monitorLocksTip   = new SuperTip(CatalogLocksTip, "Monitor Catalog Locks", defaultMonitorTip);
            new SuperTip(LoadButtonTip, "Load",
                         "Given a valid 'managed' catalog location, the Load button code rips",
                         "the various catalog XML files for all catalog configuration data.",
                         "* CatalogType.xml - Required to enable User Managed content.",
                         @"* ContentStore\installedBooks.xml - Lists all catalog books and packages.",
                         @"* ContentStore\<locale>\<packageName>.metadata - Package download related info.");
            new SuperTip(warningTip, "Bypassing the API Warning",
                         "Here we are sneaking around the Help Runtime API and accessing",
                         "help catalog files directly. While this is all very interesting",
                         "as we learn how Help Viewer 2.0 works, the Help API normally",
                         "serves most of our needs, and we don't want to block or upset",
                         "the normal operation of the help system.");
            CopyBtn.ToolTipText     = "Copy node & sub-node text\n(Ctrl+C)";
            ExplorerBtn.ToolTipText = "Show the associated XML file in Explorer\n(Ctrl+E)";

            EnableDisable();
        }
Exemple #9
0
        public Page_Catalogs()
        {
            InitializeComponent();
            self = this;

            //List of available Catalogs
            _catalogList = CatalogList.GetCatalogs();   //Get list from the HV2 registry

            //Add Windows 8 catalogs if found
            String winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);

            CatalogList.WildAddCollection(Path.Combine(winDir, "help\\windows\\"), _catalogList, "Windws 8 Help");
            CatalogList.WildAddCollection(Path.Combine(winDir, "help\\oem\\"), _catalogList, "Windws 8 OEM Help");

            FillCatalogListBox(0);
            RegistryDumpToDebug();

            //SuperTips
            new SuperTip(OpenCatalogBtnTip, "ICatalog.Open(catalogDirectory, localeList)",
                         "Open a catalog to view its contents with the various ICatalogRead. methods.",
                         "A valid catalog directory will contain the folders \"ContentStore\" & \"IndexStore\".",
                         "Always close your catalogs when done by calling ICatalog.Close()."
                         );

            new SuperTip(GetCatalogReadWriteLockBtnTip, "ICatalog.GetReadWriteLock(catalogDirectory)",
                         "Returns an ICatalogReadWriteLock object to set/get locking at the catalog level.");

            new SuperTip(AvailableCatalogsTip, "Available Catalogs",
                         "Microsoft HlpViewer.exe can open a catalog by a short ID if the catalog is registered (in registry).",
                         "We can also open a catalog by the directory path. And there are special standalone help files",
                         "(.MSHX) that contain both (.mshc) content and (.mshi) index information.");

            new SuperTip(AddBtnTip, "Add Catalog Folder or File",
                         "You can open an unregistered catalog by using its full directory path.",
                         "You can also open a .mshx file. These files contain both .mshc (content)",
                         " & .mshi (index) information like a .chm or .hlp file.");
        }
Exemple #10
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind Meta Types
            // Bind Meta classes
            // MetaDataContext.Current = CatalogContext.MetaDataContext;
            MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

            MetaClassList.Items.Clear();
            if (catalogEntry != null)
            {
                MetaClassCollection metaClasses = catalogEntry.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Name));
                }
                MetaClassList.DataBind();
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'search-index'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind Types
            EntryTypeList.Items.Clear();
            EntryTypeList.Items.Add(new ListItem(EntryType.Product, EntryType.Product));
            EntryTypeList.Items.Add(new ListItem(EntryType.Package, EntryType.Package));
            EntryTypeList.Items.Add(new ListItem(EntryType.Bundle, EntryType.Bundle));
            EntryTypeList.Items.Add(new ListItem(EntryType.DynamicPackage, EntryType.DynamicPackage));
            EntryTypeList.Items.Add(new ListItem(EntryType.Variation, EntryType.Variation));
            EntryTypeList.DataBind();

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();

            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;

                CommonHelper.LoadTextBox(settings, "NodeCode", NodeCode);
                CommonHelper.LoadTextBox(settings, "RecordsPerPage", NumberOfRecords);

                /*
                 * CommonHelper.LoadTextBox(settings, "FTSPhrase", FTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "MetaSQLClause", MetaSQLClause);
                 * CommonHelper.LoadTextBox(settings, "SQLClause", SQLClause);
                 * */

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                CommonHelper.SelectList(settings, "Catalogs", CatalogList);
                CommonHelper.SelectList(settings, "EntryClasses", MetaClassList);
                CommonHelper.SelectList(settings, "EntryTypes", EntryTypeList);

                // Orderby
                if ((prm["OrderBy"] != null) && (prm["OrderBy"] is string))
                {
                    string orderBy = prm["OrderBy"].ToString();
                    bool   isDesc  = orderBy.Contains("DESC");

                    string listOrderBy = orderBy.Replace(" DESC", "");
                    listOrderBy = listOrderBy.Replace(" ASC", "");

                    CommonHelper.SelectListItem(OrderByList, listOrderBy);

                    if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
                    {
                        if (OrderByList.SelectedValue == "custom")
                        {
                            OrderBy.Text = orderBy;
                        }
                        else
                        {
                            OrderDesc.Checked = isDesc;
                        }
                    }
                }


                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }
Exemple #11
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'entry'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogList.Items.Add(new ListItem("(use default)", ""));
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();


            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;
                if ((prm["NodeCode"] != null) && (prm["NodeCode"] is string))
                {
                    NodeCode.Text = prm["NodeCode"].ToString();
                }

                if ((prm["EntryCode"] != null) && (prm["EntryCode"] is string))
                {
                    EntryCode.Text = prm["EntryCode"].ToString();
                }

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                if ((prm["CatalogName"] != null) && (prm["CatalogName"] is string))
                {
                    CommonHelper.SelectListItem(CatalogList, prm["CatalogName"].ToString());
                }

                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }
Exemple #12
0
 public async void ServiceClicked()
 {
     var service = CatalogList.Find(c => c.ServiceName == SelectedServiceName);
     await Application.Current.MainPage.Navigation.PushModalAsync(new Views.OrderView(service), true);
 }
Exemple #13
0
    public void PopulateCatalogs()
    {
        catalogList = new CatalogList();
        swItemsShelf.SizeAllocated    += itemShelf.SizeAllocate;
        catalogList.Selection.Changed += OnCatalogActivated;

        swCatalogs.Add (catalogList);

        int i=0;
        int sel = 0;
        string active = Conf.Get("active_catalog", "books");
        foreach (Catalog catalog in database.Catalogs()) {
            catalogList.AddCatalog (catalog);
            if (catalog.Name.Equals(active)) {
                sel = i;
            }
            i++;
        }
        catalogList.SetSelectedCatalog(sel);
    }