コード例 #1
0
        // wraps GenerateRaw in a message pump so that Visual Studio
        // will display the nice "waiting" modal window...
        private int GenerateWithPump(string wszInputFilePath,
                                     //string bstrInputFileContents,
                                     string wszDefaultNamespace,
                                     IntPtr[] rgbOutputFileContents,
                                     out uint pcbOutput,
                                     IVsGeneratorProgress pGenerateProgress)
        {
            uint pcbOutput2 = 0;
            var rc = 0;
            string errMsg = null;

            VisualStudioHelper.PumpAction("Generating models...", "Please wait while Umbraco.ModelsBuilder generates models.", () =>
            {
                rc = GenerateRaw(wszInputFilePath,
                //bstrInputFileContents,
                wszDefaultNamespace,
                rgbOutputFileContents,
                out pcbOutput2,
                //pGenerateProgress,
                out errMsg);
            });

            // get value back
            pcbOutput = pcbOutput2;

            // handle error here - cannot do it in PumpAction - ComObject exception
            if (errMsg != null)
                VisualStudioHelper.ReportError(pGenerateProgress, errMsg);

            return rc;
        }