Esempio n. 1
0
        internal static void StartHelpViewer(String pageID, Boolean runAsAdmin)  // run HlpViewer.exe and show the topic
        {
            String catalog = "";
            String locale  = "";

            if (Globals.selectedCatalog != null)
            {
                //We can open with just a CatalogID if it came from the registry
                if (selectedCatalog.FromRegistry)
                {
                    catalog = Globals.selectedCatalog.CatalogID;  // The viewer will look up the registry to find the path
                }
                else
                {
                    MessageBox.Show("Currently only registered collections can be opened in VS 11 HlpViewer.exe");

                    //if (File.Exists(selectedCatalog.LocationPath))  //an .mshx file?
                    //catalog = selectedCatalog.LocationPath;
                    //else if (Directory.Exists(selectedCatalog.LocationPath))  // a location dir
                    //catalog = selectedCatalog.LocationPath;
                }

                if (String.IsNullOrEmpty(catalog))
                {
                    MessageBox.Show("Catalog name not registered or invalid location:\n" + "Name: " + selectedCatalog.CatalogID + ", Location: " + selectedCatalog.LocationPath);
                    return;
                }

                catalog = "\"" + catalog + "\""; //wrap in quotes in case of spaces

                locale = selectedCatalog.Locale;
            }

            if (String.IsNullOrEmpty(catalog))            //default to something
            {
                catalog = HlpViewer.VS11CatalogName;
            }

            if (String.IsNullOrEmpty(locale))
            {
                locale = "en-US";
            }

            if (String.IsNullOrEmpty(pageID))
            {
                pageID = "-1";  //root node
            }
            HlpViewer.StartReturn sRet = HlpViewer.Start(catalog, locale, pageID, runAsAdmin);
            if (sRet != HlpViewer.StartReturn.ok)
            {
                MessageBox.Show("Error running HlpViewer.exe: " + sRet.ToString() + "\n" + HlpViewer.path);
            }
        }
Esempio n. 2
0
        private void RunVSHlpViewerElevatedBtn_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)  //fill catalog drop down list
        {
            int i = (int)e.ClickedItem.Tag;

            _catList = FlatCatalogList.GetAll();
            if (i >= 0 && i < _catList.Count)
            {
                HlpViewer.StartReturn sRet = HlpViewer.RunAsAdmin("/catalogName", _catList[i].CatalogID, "/locale", _catList[i].Locale);
                if (sRet != HlpViewer.StartReturn.ok)
                {
                    MessageBox.Show("Error running HlpViewer.exe: " + sRet.ToString() + "\n" + HlpViewer.path);
                }
            }
        }
Esempio n. 3
0
 private void RunVSHlpViewerElevatedBtn_ButtonClick(object sender, EventArgs e)
 {
     _catList = FlatCatalogList.GetAll();
     if (_catList.Count > 0)
     {
         HlpViewer.StartReturn sRet = HlpViewer.RunAsAdmin("/catalogName", _catList[0].CatalogID, "/locale", _catList[0].Locale);
         if (sRet != HlpViewer.StartReturn.ok)
         {
             MessageBox.Show("Error running HlpViewer.exe: " + sRet.ToString() + "\n" + HlpViewer.path);
         }
     }
     else
     {
         MessageBox.Show("No VS 11 registered catalogs found.");
     }
 }