• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CommandId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CommandId的典型用法代码示例。如果您正苦于以下问题:C# CommandId类的具体用法?C# CommandId怎么用?C# CommandId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommandId类属于命名空间,在下文中一共展示了CommandId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (TextView != null)
            {
                string content = TextView.Selection.SelectedSpans[0].GetText();
                string extension = Path.GetExtension(_dte.ActiveDocument.FullName).ToLowerInvariant();
                string result = MinifyFileMenu.MinifyString(extension, content);

                if (!string.IsNullOrEmpty(result))
                {
                    if (result != content)
                    {
                        using (EditorExtensionsPackage.UndoContext(("Minify")))
                            TextView.TextBuffer.Replace(TextView.Selection.SelectedSpans[0].Span, result);
                    }
                    else
                    {
                        _dte.StatusBar.Text = "The selection was already minified";
                    }
                }
                else
                {
                    _dte.StatusBar.Text = "Could not minify the selection. Unsupported file type.";
                }
            }

            return true;
        }
开发者ID:vikramgoudr,项目名称:WebEssentials2013,代码行数:28,代码来源:MinifySelectionCommandTarget.cs


示例2: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            SnapshotPoint? point = TextView.Caret.Position.Point.GetPoint(TextView.TextBuffer, PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                TextExtent wordExtent = _navigator.GetExtentOfWord(point.Value - 1);
                string wordText = TextView.TextSnapshot.GetText(wordExtent.Span);

                Find2 find = (Find2)EditorExtensionsPackage.DTE.Find;
                string types = find.FilesOfType;
                bool matchCase = find.MatchCase;
                bool matchWord = find.MatchWholeWord;

                find.WaitForFindToComplete = false;
                find.Action = EnvDTE.vsFindAction.vsFindActionFindAll;
                find.Backwards = false;
                find.MatchInHiddenText = true;
                find.MatchWholeWord = true;
                find.MatchCase = true;
                find.PatternSyntax = EnvDTE.vsFindPatternSyntax.vsFindPatternSyntaxLiteral;
                find.ResultsLocation = EnvDTE.vsFindResultsLocation.vsFindResults1;
                find.SearchSubfolders = true;
                find.FilesOfType = "*.js";
                find.Target = EnvDTE.vsFindTarget.vsFindTargetSolution;
                find.FindWhat = wordText;
                find.Execute();

                find.FilesOfType = types;
                find.MatchCase = matchCase;
                find.MatchWholeWord = matchWord;
            }

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:35,代码来源:JavaScriptFindReferencesCommandTarget.cs


示例3: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            HtmlEditorDocument document = HtmlEditorDocument.FromTextView(_view);
            var tree = document.HtmlEditorTree;

            int start = _view.Selection.Start.Position.Position;
            int end = _view.Selection.End.Position.Position;

            ElementNode tag = null;
            AttributeNode attr = null;

            tree.GetPositionElement(start + 1, out tag, out attr);

            if (tag == null)
                return false;

            if (tag.EndTag != null && tag.StartTag.Start == start && tag.EndTag.End == end)
            {
                Select(tag.InnerRange.Start, tag.InnerRange.Length);
            }
            else if (tag.Parent != null && tag.Children.Count > 0 && (tag.Start != start || tag.Parent.Children.Last().End != end))
            {
                Select(tag.Children.First().Start, tag.Children.Last().End - tag.Children.First().Start);
            }
            else if (tag.Parent != null && tag.Parent.Children.First().Start == start && tag.Parent.Children.Last().End == end)
            {
                SelectCaretNode(tree, tag.Parent);
            }
            else if (tag.Children.Count > 0)
            {
                SelectCaretNode(tree, tag);
            }

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:35,代码来源:ContractSelectionTarget.cs


示例4: AddCommand

 /// <summary>
 /// Adds the command with the specified id and callback.
 /// </summary>
 /// <param name="cmdId">The command unique identifier.</param>
 /// <param name="cmdCallback">The command callback.</param>
 private void AddCommand(CommandId cmdId, Action cmdCallback)
 {
     var cmd = new CommandID(Guids.PublishCmdSet, (int)cmdId);
     var menuCmd = new OleMenuCommand((s, e) => cmdCallback(), cmd);
     menuCmd.BeforeQueryStatus += BeforeQueryStatus;
     mcs.AddCommand(menuCmd);
 }
开发者ID:ivan-korshun,项目名称:VS-PublishExtensions2013,代码行数:12,代码来源:PublishMenu.cs


示例5: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            BrowserSelector selector = new BrowserSelector();
            selector.ShowDialog();

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:7,代码来源:CssSelectBrowsers.cs


示例6: TryConvertToCommandKeyBindings

        private static bool TryConvertToCommandKeyBindings(string text, out List<CommandKeyBinding> bindingsList)
        {
            bindingsList = null;
            var list = new List<CommandKeyBinding>();
            var items = ConvertToList(text);
            if (items.Count % 4 != 0)
            {
                return false;
            }

            for (int i = 0; i < items.Count; i += 4)
            {
                Guid group;
                uint id;
                KeyBinding keyBinding;
                if (!Guid.TryParse(items[i], out group) ||
                    !UInt32.TryParse(items[i + 1], out id) ||
                    !KeyBinding.TryParse(items[i + 3], out keyBinding))
                {
                    return false;
                }

                var commandId = new CommandId(group, id);
                list.Add(new CommandKeyBinding(commandId, items[i + 2], keyBinding));
            }

            bindingsList = list;
            return true;
        }
开发者ID:Yzzl,项目名称:VsVim,代码行数:29,代码来源:SettingSerializer.cs


示例7: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("LESS");
            if (point == null)
                return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            var doc = CssEditorDocument.FromTextBuffer(buffer);
            ParseItem item = doc.StyleSheet.ItemBeforePosition(point.Value);
            ParseItem rule = FindParent(item);

            string text = item.Text;
            string name = Microsoft.VisualBasic.Interaction.InputBox("Name of the variable", "Web Essentials");

            if (string.IsNullOrEmpty(name))
                return false;

            using (EditorExtensionsPackage.UndoContext(("Extract to variable")))
            {
                buffer.Insert(rule.Start, "@" + name + ": " + text + ";" + Environment.NewLine + Environment.NewLine);

                Span span = TextView.Selection.SelectedSpans[0].Span;
                TextView.TextBuffer.Replace(span, "@" + name);
            }

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:27,代码来源:LessExtractVariableCommandTarget.cs


示例8: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            IDataObject data = Clipboard.GetDataObject();
            ProjectItem item = ProjectHelpers.GetActiveFile();

            if (!data.GetDataPresent(DataFormats.Bitmap) || string.IsNullOrEmpty(item.ContainingProject.FullName))
                return false;

            string fileName = null;

            using (var dialog = new SaveFileDialog())
            {
                dialog.FileName = "file.png";
                dialog.DefaultExt = ".png";
                dialog.Filter = "Images|*.png;*.gif;*.jpg;*.bmp;";
                dialog.InitialDirectory = ProjectHelpers.GetRootFolder();

                if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    return true;

                fileName = dialog.FileName;
            }

            SaveClipboardImageToFile(data, fileName);
            UpdateTextBuffer(fileName);

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                ProjectHelpers.AddFileToActiveProject(fileName);

            }), DispatcherPriority.ApplicationIdle, null);

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:34,代码来源:PasteImageCommandTarget.cs


示例9: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("CSS");
            if (point == null)
                return false;
            ITextSnapshot snapshot = point.Value.Snapshot;
            var doc = CssEditorDocument.FromTextBuffer(snapshot.TextBuffer);

            StringBuilder sb = new StringBuilder(snapshot.GetText());
            int scrollPosition = TextView.TextViewLines.FirstVisibleLine.Extent.Start.Position;

            using (EditorExtensionsPackage.UndoContext("Remove Duplicate Properties"))
            {
                int count;
                string result = RemoveDuplicateProperties(sb, doc, out count);
                Span span = new Span(0, snapshot.Length);
                snapshot.TextBuffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
                TextView.ViewScroller.ScrollViewportVerticallyByLines(ScrollDirection.Down, TextView.TextSnapshot.GetLineNumberFromPosition(scrollPosition));
                EditorExtensionsPackage.DTE.StatusBar.Text = count + " duplicate properties removed";
            }

            return true;
        }
开发者ID:vikramgoudr,项目名称:WebEssentials2013,代码行数:28,代码来源:CssRemoveDuplicatesCommandTarget.cs


示例10: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("css");
            if (point == null) return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            CssEditorDocument doc = CssEditorDocument.FromTextBuffer(buffer);
            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);

            StringBuilder sb = new StringBuilder(buffer.CurrentSnapshot.GetText());

            using (EditorExtensionsPackage.UndoContext("Add Missing Standard Property"))
            {
                string result = AddMissingStandardDeclaration(sb, doc, rootSchema);
                Span span = new Span(0, buffer.CurrentSnapshot.Length);
                buffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
            }

            return true;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:25,代码来源:CssAddMissingStandardCommandTarget.cs


示例11: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (_broker.IsCompletionActive(TextView))
                return false;

            int position = TextView.Caret.Position.BufferPosition.Position;

            if (position == 0 || position == TextView.TextBuffer.CurrentSnapshot.Length || TextView.Selection.SelectedSpans[0].Length > 0)
                return false;

            char before = TextView.TextBuffer.CurrentSnapshot.GetText(position - 1, 1)[0];
            char after = TextView.TextBuffer.CurrentSnapshot.GetText(position, 1)[0];

            if (before == '{' && after == '}')
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                {
                    using (EditorExtensionsPackage.UndoContext("Smart Indent"))
                    {
                        // HACK: A better way is needed. 
                        // We do this to get around the native TS formatter
                        SendKeys.Send("{TAB}{ENTER}{UP}");
                    }
                }), DispatcherPriority.Normal, null);
            }

            return false;
        }
开发者ID:Nangal,项目名称:WebEssentials2013,代码行数:28,代码来源:TypeScriptSmartIndentCommandTarget.cs


示例12: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("css");
            if (point == null) return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            CssEditorDocument doc = CssEditorDocument.FromTextBuffer(buffer);
            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);

            StringBuilder sb = new StringBuilder(buffer.CurrentSnapshot.GetText());
            int scrollPosition = TextView.TextViewLines.FirstVisibleLine.Extent.Start.Position;

            using (EditorExtensionsPackage.UndoContext("Add Missing Vendor Specifics"))
            {
                int count;
                string result = AddMissingVendorDeclarations(sb, doc, rootSchema, out count);
                Span span = new Span(0, buffer.CurrentSnapshot.Length);
                buffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
                TextView.ViewScroller.ScrollViewportVerticallyByLines(ScrollDirection.Down, TextView.TextSnapshot.GetLineNumberFromPosition(scrollPosition));
                EditorExtensionsPackage.DTE.StatusBar.Text = count + " missing vendor specific properties added";
            }

            return true;
        }
开发者ID:vikramgoudr,项目名称:WebEssentials2013,代码行数:29,代码来源:CssAddVendorStandardCommandTarget.cs


示例13: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("LESS");
            if (point == null)
                return false;

            var buffer = point.Value.Snapshot.TextBuffer;
            var doc = CssEditorDocument.FromTextBuffer(buffer);
            ParseItem item = doc.StyleSheet.ItemBeforePosition(point.Value);

            ParseItem rule = LessExtractVariableCommandTarget.FindParent(item);
            int mixinStart = rule.Start;
            string name = Microsoft.VisualBasic.Interaction.InputBox("Name of the Mixin", "Web Essentials");

            if (!string.IsNullOrEmpty(name))
            {
                using (EditorExtensionsPackage.UndoContext(("Extract to mixin")))
                {
                    string text = TextView.Selection.SelectedSpans[0].GetText();
                    buffer.Insert(rule.Start, "." + name + "() {" + Environment.NewLine + text + Environment.NewLine + "}" + Environment.NewLine + Environment.NewLine);

                    var selection = TextView.Selection.SelectedSpans[0];
                    TextView.TextBuffer.Replace(selection.Span, "." + name + "();");

                    TextView.Selection.Select(new SnapshotSpan(TextView.TextBuffer.CurrentSnapshot, mixinStart, 1), false);
                    EditorExtensionsPackage.ExecuteCommand("Edit.FormatSelection");
                    TextView.Selection.Clear();
                }

                return true;
            }

            return false;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:34,代码来源:LessExtractMixinCommandTarget.cs


示例14: EventDescriptor

 public EventDescriptor(CommandId commandId, EntityId id, IEvent eventData, int entityVersion)
 {
     CommandId = commandId;
     EventData = eventData;
     Version = entityVersion;
     EntityId = id;
 }
开发者ID:dgmachado,项目名称:EventSourcingAndCQRSLib,代码行数:7,代码来源:EventDescriptor.cs


示例15: Execute

        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (_broker.IsCompletionActive(TextView) || !IsValidTextBuffer() || !WESettings.GetBoolean(WESettings.Keys.EnableEnterFormat))
                return false;

            int position = TextView.Caret.Position.BufferPosition.Position;
            SnapshotPoint point = new SnapshotPoint(TextView.TextBuffer.CurrentSnapshot, position);
            IWpfTextViewLine line = TextView.GetTextViewLineContainingBufferPosition(point);

            ElementNode element = null;
            AttributeNode attr = null;

            _tree.GetPositionElement(position, out element, out attr);

            if (element == null ||
                _tree.IsDirty ||
                element.Parent == null ||
                element.StartTag.Contains(position) ||
                line.End.Position == position || // caret at end of line (TODO: add ignore whitespace logic)
                TextView.TextBuffer.CurrentSnapshot.GetText(element.InnerRange.Start, element.InnerRange.Length).Trim().Length == 0)
                return false;

            UpdateTextBuffer(element);

            return false;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:26,代码来源:EnterFormatCommandTarget.cs


示例16: ExpectRaise

 private void ExpectRaise(CommandId commandId)
 {
     object p1 = null;
     object p2 = null;
     _commands
         .Setup(x => x.Raise(commandId.Group.ToString(), (int)commandId.Id, ref p1, ref p2))
         .Verifiable();
 }
开发者ID:honeyhoneywell,项目名称:VsVim,代码行数:8,代码来源:FallbackKeyProcessorTest.cs


示例17: Add

 public int Add(CommandId commandIdentifier, bool separatorBefore, bool separatorAfter)
 {
     MenuDefinitionEntryCommand mde = new MenuDefinitionEntryCommand();
     mde.CommandIdentifier = commandIdentifier.ToString();
     mde.SeparatorBefore = separatorBefore;
     mde.SeparatorAfter = separatorAfter;
     return Add(mde);
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:8,代码来源:MenuDefinitionEntryCollection.cs


示例18: ExpectNotRaise

 private void ExpectNotRaise(CommandId commandId, Action isCalled)
 {
     object p1 = null;
     object p2 = null;
     _commands
         .Setup(x => x.Raise(commandId.Group.ToString(), (int)commandId.Id, ref p1, ref p2))
         .Callback(isCalled);
 }
开发者ID:ccsblueboy,项目名称:VsVim,代码行数:8,代码来源:FallbackKeyProcessorTest.cs


示例19: AddRemovedBinding

 private CommandId AddRemovedBinding(string keyStroke, string name = "comment")
 {
     var keyBinding = KeyBinding.Parse(keyStroke);
     var commandId = new CommandId(Guid.NewGuid(), 0);
     _removedBindingList.Add(new CommandKeyBinding(commandId, name, keyBinding));
     _vimApplicationSettings
         .Raise(x => x.SettingsChanged += null, new ApplicationSettingsEventArgs());
     return commandId;
 }
开发者ID:honeyhoneywell,项目名称:VsVim,代码行数:9,代码来源:FallbackKeyProcessorTest.cs


示例20: CommandDescriptor

 public CommandDescriptor(CommandId commandId, AggregateRootId aggregateRootId, TimeSpan created, string aggregateRootType, string commandType, string commandData)
 {
     CommandId = commandId;
     AggregateRootId = aggregateRootId;
     Created = created;
     AggregateRootType = aggregateRootType;
     CommandType = commandType;
     CommandData = commandData;
 }
开发者ID:dgmachado,项目名称:EventSourcingAndCQRSLib,代码行数:9,代码来源:CommandDescriptor.cs



注:本文中的CommandId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CommandInfo类代码示例发布时间:2022-05-24
下一篇:
C# CommandFunction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap