コード例 #1
0
        /// <summary>
        /// This handler is called when user clicks "Add Connect to QuickBooks" menu item.
        /// </summary>
        /// <param name="commandBarControl">The command bar control.</param>
        /// <param name="handled">if set to <c>true</c> [handled].</param>
        /// <param name="cancelDefault">if set to <c>true</c> [cancel default].</param>
        private void ConnecttoQuickBooksMenuItemHandler_Click(object commandBarControl, ref bool handled, ref bool cancelDefault)
        {
            if (this.visualStudio.Debugger.CurrentMode == dbgDebugMode.dbgRunMode)
            {
                MessageBox.Show(IntuitAnywhereResources.msg001, IntuitAnywhereResources.msgdialogtitle);
                return;
            }

            // Get the currenlly active project

            // Project selProject = m_VSStudio.SelectedItems.Item(1).Project;
            Array   activeProjectsArray = (Array)this.visualStudio.ActiveSolutionProjects;
            Project selProject          = null;

            if (activeProjectsArray != null)
            {
                if (activeProjectsArray.Length > 0)
                {
                    selProject = (Project)activeProjectsArray.GetValue(0);
                }
            }

            if (this.visualStudio.ActiveDocument == null)
            {
                MessageBox.Show(IntuitAnywhereResources.msg002, IntuitAnywhereResources.msgdialogtitle);
                return;
            }

            if (selProject == null)
            {
                if (this.visualStudio.ActiveDocument.ProjectItem.ContainingProject != null)
                {
                    selProject = this.visualStudio.ActiveDocument.ProjectItem.ContainingProject;
                }
                else
                {
                    MessageBox.Show(IntuitAnywhereResources.msg003, IntuitAnywhereResources.msgdialogtitle);
                    return;
                }
            }

            // Get the project type
            VSProjectType projectType = Common.GetProjectType(selProject);

            if (projectType == VSProjectType.Mvc)
            {
                MvcHandler.AddIntuitAnywhereSourceToMVCProject(selProject, "ConnecttoQuickBooks", "OauthResponse", this.codeFilesContentPath, this.visualStudio.ActiveDocument);
            }

            if (projectType == VSProjectType.AspNet)
            {
                AspHandler.AddSourceToAspnetProject(selProject, "ConnecttoQuickBooks", this.codeFilesContentPath, this.visualStudio.ActiveDocument);
            }

            if (projectType == VSProjectType.Other)
            {
                MessageBox.Show(IntuitAnywhereResources.msg004, IntuitAnywhereResources.msgdialogtitle);
            }
        }
コード例 #2
0
        /// <summary>
        /// This handler is called when user clicks "Add Direct Connect to Intuit" menu item.
        /// </summary>
        /// <param name="commandBarControl">The command bar control.</param>
        /// <param name="handled">if set to <c>true</c> [handled].</param>
        /// <param name="cancelDefault">if set to <c>true</c> [cancel default].</param>
        private void DirectConnectToIntuitMenuItemHandler_Click(object commandBarControl, ref bool handled, ref bool cancelDefault)
        {
            if (this.visualStudio.Debugger.CurrentMode == dbgDebugMode.dbgRunMode)
            {
                MessageBox.Show(IntuitAnywhereResources.msg001, IntuitAnywhereResources.msgdialogtitle);
                return;
            }

            // Get the currenlly active project
            Array   activeProjectsArray = (Array)this.visualStudio.ActiveSolutionProjects;
            Project selProject          = null;

            if (activeProjectsArray != null)
            {
                if (activeProjectsArray.Length > 0)
                {
                    selProject = (Project)activeProjectsArray.GetValue(0);
                }
            }

            if (this.visualStudio.ActiveDocument == null)
            {
                MessageBox.Show(IntuitAnywhereResources.msg002, IntuitAnywhereResources.msgdialogtitle);
                return;
            }

            if (selProject == null)
            {
                if (this.visualStudio.ActiveDocument.ProjectItem.ContainingProject != null)
                {
                    selProject = this.visualStudio.ActiveDocument.ProjectItem.ContainingProject;
                }
                else
                {
                    MessageBox.Show(IntuitAnywhereResources.msg003, IntuitAnywhereResources.msgdialogtitle);
                    return;
                }
            }

            // Get the project type
            VSProjectType projectType = Common.GetProjectType(selProject);

            if (projectType == VSProjectType.AspNet)
            {
                AspHandler.AddDirectConnectToIntuitFunctionality("DirectConnectToIntuit", this.codeFilesContentPath, this.visualStudio.ActiveDocument);
            }

            if (projectType == VSProjectType.Mvc)
            {
                MvcHandler.AddDirectConnectToIntuitFunctionality("DirectConnectToIntuit", this.codeFilesContentPath, this.visualStudio.ActiveDocument);
            }

            if (projectType == VSProjectType.Other)
            {
                MessageBox.Show(IntuitAnywhereResources.msg004, IntuitAnywhereResources.msgdialogtitle);
            }
        }
コード例 #3
0
        /// <summary>
        /// This handler is called when user clicks "Add Data Services SDK V3" menu item.
        /// </summary>
        /// <param name="commandBarControl">The command bar control.</param>
        /// <param name="handled">if set to <c>true</c> [handled].</param>
        /// <param name="cancelDefault">if set to <c>true</c> [cancel default].</param>
        private void DataServicesSDKV3MenuItemHandler_Click(object commandBarControl, ref bool handled, ref bool cancelDefault)
        {
            if (this.visualStudio.Debugger.CurrentMode == dbgDebugMode.dbgRunMode)
            {
                MessageBox.Show(IntuitAnywhereResources.msg001, IntuitAnywhereResources.msgdialogtitle);
                return;
            }

            // Get the currenlly active project
            Array   activeProjectsArray = (Array)this.visualStudio.ActiveSolutionProjects;
            Project selProject          = null;

            if (activeProjectsArray != null)
            {
                if (activeProjectsArray.Length > 0)
                {
                    selProject = (Project)activeProjectsArray.GetValue(0);
                }
            }

            if (selProject == null)
            {
                if (this.visualStudio.SelectedItems != null && this.visualStudio.SelectedItems.Count == 1 && this.visualStudio.SelectedItems.Item(1) != null)
                {
                    if (this.visualStudio.SelectedItems.Item(1).Project == null)
                    {
                        MessageBox.Show(IntuitAnywhereResources.msg006, IntuitAnywhereResources.msgdialogtitle);
                        return;
                    }
                }

                if (this.visualStudio.ActiveDocument.ProjectItem.ContainingProject != null)
                {
                    selProject = this.visualStudio.ActiveDocument.ProjectItem.ContainingProject;
                }
                else
                {
                    MessageBox.Show(IntuitAnywhereResources.msg003, IntuitAnywhereResources.msgdialogtitle);
                    return;
                }
            }

            // Get the project type
            VSProjectType projectType = Common.GetProjectType(selProject);

            if (projectType == VSProjectType.AspNet || projectType == VSProjectType.Mvc)
            {
                //run the Nuget command
                string repositoryPath = "http://go.microsoft.com/fwlink/?LinkID=206669"; //// Can be modified to https://nuget.org/api/v2
                string packageId      = "IPPDotNetDevKitV3";
                Common.InstallNuGetPackageForProject(packageId, selProject, repositoryPath);

                if (projectType == VSProjectType.AspNet)
                {
                    AspHandler.AddQuickBookCustomerFilesForAsp(selProject, this.codeFilesContentPath);
                }
                else
                {
                    MvcHandler.AddQuickBookCustomerFilesForMvc(selProject, this.codeFilesContentPath);
                }
            }
            else
            {
                MessageBox.Show(IntuitAnywhereResources.msg004, IntuitAnywhereResources.msgdialogtitle);
            }
        }