コード例 #1
0
ファイル: CodeMaidPackage.cs プロジェクト: mshingote/codemaid
 /// <summary>
 /// Register the package commands (which must exist in the .vsct file).
 /// </summary>
 private void RegisterCommands()
 {
     // Initialize the individual commands, which internally register for command events.
     AboutCommand.Initialize(this);
     BuildProgressToolWindowCommand.Initialize(this);
     CleanupActiveCodeCommand.Initialize(this);
     CleanupAllCodeCommand.Initialize(this);
     CleanupOpenCodeCommand.Initialize(this);
     CleanupSelectedCodeCommand.Initialize(this);
     CloseAllReadOnlyCommand.Initialize(this);
     CollapseAllSolutionExplorerCommand.Initialize(this);
     CollapseSelectedSolutionExplorerCommand.Initialize(this);
     CommentFormatCommand.Initialize(this);
     FindInSolutionExplorerCommand.Initialize(this);
     JoinLinesCommand.Initialize(this);
     OptionsCommand.Initialize(this);
     ReadOnlyToggleCommand.Initialize(this);
     RemoveRegionCommand.Initialize(this);
     ReorganizeActiveCodeCommand.Initialize(this);
     SettingCleanupOnSaveCommand.Initialize(this);
     SortLinesCommand.Initialize(this);
     SpadeContextDeleteCommand.Initialize(this);
     SpadeContextFindReferencesCommand.Initialize(this);
     SpadeContextInsertRegionCommand.Initialize(this);
     SpadeContextRemoveRegionCommand.Initialize(this);
     SpadeOptionsCommand.Initialize(this);
     SpadeRefreshCommand.Initialize(this);
     SpadeSearchCommand.Initialize(this);
     SpadeSortOrderAlphaCommand.Initialize(this);
     SpadeSortOrderFileCommand.Initialize(this);
     SpadeSortOrderTypeCommand.Initialize(this);
     SpadeToolWindowCommand.Initialize(this);
     SwitchFileCommand.Initialize(this);
 }
コード例 #2
0
ファイル: MainMenu.cs プロジェクト: igoreksiz/VBE_Modules
 private void OnAboutClick(CommandBarButton Ctrl, ref bool CancelDefault)
 {
     using (var command = new AboutCommand())
     {
         command.Execute();
     }
 }
コード例 #3
0
        public GameViewModel()
        {
            window       = new Window();
            L1           = new Label();
            aboutCommand = new AboutCommand(new StudentAbout());
            userData     = new List <string>();

            dirInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "/Images/art");
            info    = dirInfo.GetFiles("*.*", SearchOption.AllDirectories);
            image   = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/art/" + info.ElementAt(0), UriKind.Absolute));
            Index   = 0;

            Label = new Label();

            _time  = TimeSpan.FromSeconds(30);
            _timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            {
                Label.Content = _time.ToString("c");
                if (_time == TimeSpan.Zero)
                {
                    _timer.Stop();
                    tbx4.Text = "Loss";
                    OnPropertyChanged("tbx4");
                    OnPropertyChanged("tbx4");
                }

                _time = _time.Add(TimeSpan.FromSeconds(-1));
            }, Application.Current.Dispatcher);

            _timer.Start();

            user           = new User();
            Label7         = new Label();
            userData       = LoadUserData(); categories = LoadCategories(); createUser();
            label7.Content = user.Name;
            tbx            = new TextBlock();
            tbx.Text       = userData.ElementAt(2);
            Tbx1           = new TextBlock();
            tbx1.Text      = Nivel.ToString();

            Tbx2      = new TextBlock();
            tbx2.Text = "";
            word      = categories.ElementAt(0);
            for (int i = 0; i < word.Length; i++)
            {
                if (word.ElementAt(i) == ' ')
                {
                    tbx2.Text += "  ";
                }
                else
                {
                    tbx2.Text += " _ ";
                }
            }
            result = tbx2.Text;

            Tbx4      = new TextBlock();
            tbx4.Text = "";
        }
コード例 #4
0
        public BaseViewModel(MainWindow window)
        {
            mainWindow = window;

            BaseCommand   = new BaseCommand(this);
            AboutCommand  = new AboutCommand(this);
            RemoveCommand = new RemoveCommand(this);
        }
コード例 #5
0
        public NotesViewModel()
        {
            EditCommand   = new EditCommand(this);
            DeleteCommand = new DeleteCommand(this);
            AddCommand    = new AddCommand(this);
            SaveCommand   = new SaveCommand(this);
            ExitCommand   = new ExitCommand();
            AboutCommand  = new AboutCommand();

            this.Notes = new ObservableCollection <NoteModel>();
            LoadNotes();
        }
コード例 #6
0
        public async Task TestExecuteSuccess()
        {
            var message = new Message(0, "about", new ConsoleMessageChannel());

            var command = new AboutCommand(ConfigureServices());

            command.SetCancellationToken(CancellationToken.None);
            var response = await command.Execute(message);

            response.Status.Should().Be(CommandStatus.Success);
            response.Content.Should().Contain("About CyborgianStates");
            response.Content.Should().Contain("Developed by Drehtisch");
            response.Content.Should().Contain($"Github{Environment.NewLine}[CyborgianStates]");
            response.Content.Should().Contain($"Support{Environment.NewLine}via [OpenCollective]");
        }
コード例 #7
0
        public static void Run(string baseDirectory = null, ICommandParser commandParser = null, EmbedBuilder aboutEmbed = null)
        {
            SetupBotVarDefaults();

            Resources.Setup(baseDirectory);
            if (commandParser == null)
            {
                MessageHandler.CommandParser = new BuiltInCommandParser();
            }
            else
            {
                MessageHandler.CommandParser = commandParser;
            }
            AboutCommand.SetEmbed(aboutEmbed);
            runAsync().GetAwaiter().GetResult();
        }
コード例 #8
0
ファイル: CodeMaidPackage.cs プロジェクト: waodng/VSIX
        /// <summary 包的命令>
        /// 包的命令
        /// Register the package commands (which must exist in the .vsct file).
        /// </summary>
        private void RegisterCommands()
        {
            // Initialize the individual commands, which internally register for command events.
            AboutCommand.Initialize(this);
            BuildProgressToolWindowCommand.Initialize(this);
            CleanupActiveCodeCommand.Initialize(this);   //清理当前活动文档
            CleanupAllCodeCommand.Initialize(this);      //清理所有的代码
            CleanupOpenCodeCommand.Initialize(this);     //清理打开的代码
            CleanupSelectedCodeCommand.Initialize(this); //清理已选的代码
            CloseAllReadOnlyCommand.Initialize(this);
            CollapseAllSolutionExplorerCommand.Initialize(this);
            CollapseSelectedSolutionExplorerCommand.Initialize(this);
            CommentFormatCommand.Initialize(this);
            FindInSolutionExplorerCommand.Initialize(this);
            JoinLinesCommand.Initialize(this);
            OptionsCommand.Initialize(this);
            ReadOnlyToggleCommand.Initialize(this);
            RemoveRegionCommand.Initialize(this);
            ReorganizeActiveCodeCommand.Initialize(this);
            SettingCleanupOnSaveCommand.Initialize(this);
            SortLinesCommand.Initialize(this);
            SpadeContextDeleteCommand.Initialize(this);
            SpadeContextFindReferencesCommand.Initialize(this);
            SpadeContextInsertRegionCommand.Initialize(this);
            SpadeContextRemoveRegionCommand.Initialize(this);
            SpadeOptionsCommand.Initialize(this);
            SpadeRefreshCommand.Initialize(this);
            SpadeSearchCommand.Initialize(this);
            SpadeSortOrderAlphaCommand.Initialize(this);
            SpadeSortOrderFileCommand.Initialize(this);
            SpadeSortOrderTypeCommand.Initialize(this);
            SpadeToolWindowCommand.Initialize(this);
            SwitchFileCommand.Initialize(this);

            //新增关于嵌入文件和移出文件命令
            NestInFileCommand.Initialize(this);                //嵌入文件按钮注册
            NestOutFileCommand.Initialize(this);               //移出嵌入文件按钮注册
            RefactoringCodeCommand.Initialize(this);           //重构代码
            FilesDifferentCommand.Initialize(this);            //文件比较
            //浏览器刷新页面
            Options = (Options)GetDialogPage(typeof(Options)); //选项配置
            //数据库文档导出
            DataBaseWordExportWindowCommand.Initialize(this);
        }
コード例 #9
0
        protected async override System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            if (await GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
            {
                ThreadHelper.Generic.BeginInvoke(DispatcherPriority.ContextIdle, () =>
                {
                    if (commandService != null)
                    {
                        var extentionPath = Path.GetDirectoryName(this.GetType().Assembly.Location);
                        var dllPath       = Path.Combine(extentionPath, Constants.CLIFolderName, Constants.CLIName);
                        var configPath    = Path.Combine(extentionPath, Constants.CLIFolderName, Constants.ConfigFileName);

                        CliDownloader.SetUp(dllPath);

                        var fileInfo = new FileInfo(configPath);

                        if (!fileInfo.Exists)
                        {
                            var args    = string.Format("{0} config", Constants.CLIName);
                            var process = new Process();
                            process.StartInfo.WorkingDirectory       = fileInfo.DirectoryName;
                            process.StartInfo.RedirectStandardOutput = true;
                            process.StartInfo.UseShellExecute        = false;
                            process.StartInfo.CreateNoWindow         = true;
                            process.StartInfo.FileName  = Constants.DotNetCoreProcessName;
                            process.StartInfo.Arguments = args;
                            process.Start();
                            process.WaitForExit();
                        }

                        this.configParser        = new ConfigParser(configPath);
                        var dynamicCommandRootId = new CommandID(PackageGuids.guidPackageCommandSet, PackageIds.DynamicCommandId);
                        var dynamicCommand       = new DynamicCommand(dynamicCommandRootId, IsValidDynamicItem, OnInvokedDynamicItem, OnBeforeQueryStatusDynamicItem);
                        commandService.AddCommand(dynamicCommand);

                        var aboutCommandRootId = new CommandID(PackageGuids.guidPackageCommandSet, PackageIds.AboutCommandId);
                        var aboutCommand       = new AboutCommand(OnInvokeAboutCommand, aboutCommandRootId, dllPath);
                        commandService.AddCommand(aboutCommand);
                    }
                });
            }
        }
コード例 #10
0
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            await base.InitializeAsync(cancellationToken, progress);

            // Attach to solution events
            solution = GetService(typeof(SVsSolution)) as IVsSolution;
            var re = solution.AdviseSolutionEvents(new SolutionEventListener(), out solutionEventsCookie);

            FindAllReferencesCommand.Initialize(this);
            FindRefsWindowCommand.Initialize(this);
            GoToDefinitionCommand.Initialize(this);
            GoToVisitorCommand.Initialize(this);
            NextSymCommand.Initialize(this);
            OptionsCommand.Initialize(this);
            ReformatCommand.Initialize(this);
            RenameCommand.Initialize(this);
            AboutCommand.Initialize(this);
        }
コード例 #11
0
        public Data()
        {
            //File
            NewProjectCommand  = new NewProjectCommand();
            OpenProjectCommand = new OpenProjectCommand();
            ExitCommand        = new ExitCommand();
            SaveCommand        = new SaveCommand();
            SaveAsCommand      = new SaveAsCommand();

            //Edit
            CopyCommand   = new CopyCommand();
            CutCommand    = new CutCommand();
            DeleteCommand = new DeleteCommand();
            PasteCommand  = new PasteCommand();
            RedoCommand   = new RedoCommand();
            UndoCommand   = new UndoCommand();

            //View
            StatusbarToggleCommand = new StatusbarToggleCommand();
            ToolboxToggleCommand   = new ToolboxToggleCommand();
            ZoomInCommand          = new ZoomInCommand();
            ZoomOutCommand         = new ZoomOutCommand();

            //Insert
            NewClassCommand      = new NewClassCommand();
            NewDependencyCommand = new NewDependencyCommand();
            NewTextBoxCommand    = new NewTextBoxCommand();

            //Help
            HelpCommand  = new HelpCommand();
            AboutCommand = new AboutCommand();

            //StatusBar
            resetStatusBar();
            StatusBarVisability = "Visible";
            ToolBoxVisability   = "Visible";
        }
コード例 #12
0
 public HelpCommand(FeaturesCommand featuresCommand, ChangelogCommand changelogCommand, AboutCommand aboutCommand, ThanksToCommand thanksToCommand, BugReportingCommand bugReportingCommand) : base(MenuStrings.helpToolStripMenuItem1_Text)
 {
     ChildrenCommands = new List <IToolbarCommand>
     {
         featuresCommand,
         changelogCommand,
         null,
         aboutCommand,
         null,
         thanksToCommand,
         bugReportingCommand
     };
 }
コード例 #13
0
 public AboutCommandMenuItem(AboutCommand command) : base(command)
 {
 }