/// <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();
            if (_dte == null)
            {
                return;
            }

            var solution = _dte.Solution;
            var project  = (EnvDTE.Project)((object[])_dte.ActiveSolutionProjects)[0];
            var active   = project.ConfigurationManager.ActiveConfiguration;
            var fullPath = project.FullName;

            if (File.Exists(fullPath))
            {
                try
                {
                    var stateMachine = new UserSecretStateMachine(fullPath, "UserSecretsId", this._dte, this.package);
                    // state still has next.
                    while (stateMachine.MoveNext())
                    {
                        _dte.PrintMessageLine($"current state: {stateMachine.Current}");
                        stateMachine.Command?.Execute();
                    }

                    // final command
                    _dte.PrintMessageLine($"current state: {stateMachine.Current}");
                    stateMachine.Command?.Execute();
                }
                catch (Exception ex)
                {
                    Debug.Print($"{ex.GetType().FullName}, {ex.Message}, {ex.StackTrace}");
                }
            }
        }
Exemple #2
0
        public void Execute()
        {
            subCommand?.Execute();

            ThreadHelper.ThrowIfNotOnUIThread();
            dte.PrintMessageLine($"Open UserSecret file. {path}");
            dte.ExecuteCommand("File.OpenFile", path);
        }
Exemple #3
0
        public void Execute()
        {
            var message = $"Detected {sdk} which include UserSecrets in Sdk.";

            dte.PrintMessageLine(message);
        }
Exemple #4
0
        public void Execute()
        {
            var message = $"Please install required pacakge {package}";

            dte.PrintMessageLine(message);
        }