コード例 #1
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var explorer       = new SolutionExplorer(this.package);
            var reportFilePath = explorer.GetSelectedFilePath();

            if (Path.GetExtension(reportFilePath) == ".frx")
            {
                var designerIntsallPath = GetDesingerInstallPath();
                if (string.IsNullOrEmpty(designerIntsallPath))
                {
                    return;
                }

                ProcessStartInfo startInfo = new ProcessStartInfo();
                //startInfo.CreateNoWindow = false;
                //startInfo.UseShellExecute = false;
                startInfo.FileName    = designerIntsallPath;
                startInfo.WindowStyle = ProcessWindowStyle.Maximized;
                startInfo.Arguments   = reportFilePath;

                try
                {
                    Process.Start(startInfo);
                }
                catch (Exception ex)
                {
                    string title = "Open FastReport Designer Error";

                    // Show a message box to prove we were here
                    VsShellUtilities.ShowMessageBox(
                        this.package,
                        ex.Message,
                        title,
                        OLEMSGICON.OLEMSGICON_INFO,
                        OLEMSGBUTTON.OLEMSGBUTTON_OK,
                        OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                }
            }
            else
            {
                VsShellUtilities.ShowMessageBox(
                    this.package,
                    "Please select a FastReport(.frx) file",
                    "Wrong file",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }
コード例 #2
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var explorer   = new SolutionExplorer(this.package);
            var dsFilePath = explorer.GetSelectedFilePath();

            if (Path.GetExtension(dsFilePath) == ".xsd")
            {
                var dialog = new GenerateDictionatyDialog(dsFilePath);
                dialog.ShowModal();
            }
            else
            {
                VsShellUtilities.ShowMessageBox(
                    this.package,
                    "Please select a DataSet(.xsd) file",
                    "Wrong file",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }
コード例 #3
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var explorer       = new SolutionExplorer(this.package);
            var reportFilePath = explorer.GetSelectedFilePath();

            if (Path.GetExtension(reportFilePath) == ".frx")
            {
                var dataSets = explorer.GetSolutionDataSets();
                var dialog   = new DataSetSelectorDialog(dataSets, reportFilePath);
                dialog.ShowModal();
            }
            else
            {
                VsShellUtilities.ShowMessageBox(
                    this.package,
                    "Please select a FastReport(.frx) file",
                    "Wrong file",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }