Exemplo n.º 1
0
        private static void ShowHelpLocal(string strTopic, string strSection)
        {
            Debug.Assert(m_strLocalHelpFile != null);

            // Unblock CHM file for proper display of help contents
            WinUtil.RemoveZoneIdentifier(m_strLocalHelpFile);

            string strCmd = "\"ms-its:" + m_strLocalHelpFile;

            if (strTopic != null)
            {
                strCmd += @"::/help/" + strTopic + ".html";
            }

            if (strSection != null)
            {
                Debug.Assert(strTopic != null);                 // Topic must be present for section
                strCmd += @"#" + strSection;
            }

            strCmd += "\"";

            try { Process.Start(WinUtil.LocateSystemApp("hh.exe"), strCmd); }
            catch (Exception exStart)
            {
                MessageService.ShowWarning(@"hh.exe " + strCmd, exStart);
            }
        }
Exemplo n.º 2
0
        private static void SaveCompilerResults(PlgxPluginInfo plgx,
                                                StringBuilder sb)
        {
            string strFile = Path.GetTempFileName();

            File.WriteAllText(strFile, sb.ToString(), StrUtil.Utf8);

            string strMsg = plgx.BaseFileName + MessageService.NewParagraph +
                            "Compilation failed. Compiler results have been saved to:" +
                            MessageService.NewLine;

            VistaTaskDialog dlg = new VistaTaskDialog();

            dlg.Content          = strMsg + VistaTaskDialog.CreateLink("F", strFile);
            dlg.DefaultButtonID  = (int)DialogResult.Cancel;
            dlg.EnableHyperlinks = true;
            dlg.SetIcon(VtdIcon.Warning);
            dlg.WindowTitle = PwDefs.ShortProductName;

            dlg.AddButton((int)DialogResult.Cancel, KPRes.Ok, null);
            dlg.LinkClicked += delegate(object sender, LinkClickedEventArgs e)
            {
                if ((e != null) && (e.LinkText == "F") && !NativeLib.IsUnix())
                {
                    NativeLib.StartProcess(WinUtil.LocateSystemApp("Notepad.exe"),
                                           "\"" + SprEncoding.EncodeForCommandLine(strFile) + "\"");
                }
            };

            if (!dlg.ShowDialog())
            {
                MessageService.ShowWarning(strMsg + strFile);
            }
        }
Exemplo n.º 3
0
        private static void ShowHelpLocal(string strTopic, string strSection)
        {
            string strFile = AppHelp.LocalHelpFile;

            if (string.IsNullOrEmpty(strFile))
            {
                Debug.Assert(false); return;
            }

            // Unblock CHM file for proper display of help contents
            WinUtil.RemoveZoneIdentifier(strFile);

            string strCmd = "\"ms-its:" + strFile;

            if (!string.IsNullOrEmpty(strTopic))
            {
                strCmd += "::/help/" + strTopic + ".html";

                if (!string.IsNullOrEmpty(strSection))
                {
                    strCmd += "#" + strSection;
                }
            }
            strCmd += "\"";

            if (ShowHelpLocalKcv(strCmd))
            {
                return;
            }

            string strDisp = strCmd;

            try
            {
                if (NativeLib.IsUnix())
                {
                    Process p = Process.Start(NativeLib.EncodePath(strCmd.Trim('\"')));
                    if (p != null)
                    {
                        p.Dispose();
                    }
                }
                else                 // Windows
                {
                    strDisp = "HH.exe " + strDisp;

                    Process p = Process.Start(NativeLib.EncodePath(
                                                  WinUtil.LocateSystemApp("hh.exe")), strCmd);
                    if (p != null)
                    {
                        p.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowWarning(strDisp, ex);
            }
        }