protected override void CallBack(object sender, EventArgs e)
        {
            var messageBoxResult = MessageBoxDisplay.Show(new MessageBoxDisplay.MessageBoxArgs
            {
                Message = Resources.WarnOnCodeCleanUp,
                Caption = Resources.WarningCaptionCleanup,
                Button  = MessageBoxButtons.OKCancel,
                Icon    = MessageBoxIcon.Warning
            });

            if (messageBoxResult != DialogResult.OK)
            {
                return;
            }

            var dialogResult = CleanupOptionForm.Instance.ShowDialog();

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }

            ActionsOnCSharp.CSharpActionDelegate.TargetAction desiredAction = ActionsOnCSharp.ActionsCSharpOnFile.DoCleanup;

            if (CleanupOptionForm.Instance.SelectedTypes != null)
            {
                ActionsOnCSharp.ActionCSharpOnAnyWhere.Invoke(desiredAction, CleanupOptionForm.Instance.SelectedTypes);
                GeeksProductivityToolsPackage.Instance.SaveSolutionChanges();
            }
        }
示例#2
0
        protected override void Callback(object sender, EventArgs e)
        {
            var messageBoxResult = MessageBoxDisplay.Show(new MessageBoxDisplay.MessageBoxArgs
            {
                Message = Resources.WarnOnCodeCleanUp,
                Caption = Resources.WarningCaptionCleanup,
                Button  = MessageBoxButtons.OKCancel,
                Icon    = MessageBoxIcon.Warning
            });

            if (messageBoxResult != DialogResult.OK)
            {
                return;
            }

            CSharpAction.TargetAction desiredAction = ActionsCSharpOnFile.DoCleanup;
            var commandGuid = (sender as OleMenuCommand).CommandID.Guid;

            if (commandGuid == GuidList.GuidCleanupCmdSet)
            {
                ActionCSharpOnAnywhere.Invoke(desiredAction,
                                              new VSIX.TidyCSharp.Cleanup.CommandsHandlers.CleanupOptions
                {
                    //ActionTypes = new[] { CleanerType }
                }
                                              );

                TidyCSharpPackage.Instance.SaveSolutionChanges();
            }
            else
            {
                return;
            }
        }