当前位置: 首页>>代码示例>>C#>>正文


C# ICommandTarget类代码示例

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


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

示例1: TargetInfo

 public TargetInfo(ICommandTarget cmd, Vector3 fstOffset, float standoffDistance) {
     Target = cmd;
     //Destination = cmd.Position + fstOffset;
     _fstOffset = fstOffset;
     CloseEnoughDistance = cmd.Radius + standoffDistance;
     CloseEnoughDistanceSqrd = CloseEnoughDistance * CloseEnoughDistance;
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:7,代码来源:Helm.cs

示例2: ShowContextMenu

        //コンテキストメニュー表示
        public void ShowContextMenu(IPoderosaMenuGroup[] menus, ICommandTarget target, Point point_screen, ContextMenuFlags flags) {
            //まずソート
            ICollection sorted = PositionDesignationSorter.SortItems(menus);
            ContextMenuStrip cm = new ContextMenuStrip();
            MenuUtil.BuildContextMenu(cm, new ConvertingEnumerable<IPoderosaMenuGroup>(sorted), target);
            if (cm.Items.Count == 0) {
                cm.Dispose();
                return;
            }

            //キーボード操作をトリガにメニューを出すときは、選択があったほうが何かと操作しやすい。
            if ((flags & ContextMenuFlags.SelectFirstItem) != ContextMenuFlags.None)
                cm.Items[0].Select();

            // ContextMenuStrip is not disposed automatically and
            // its instance sits in memory till application end.
            // To release a document object related with some menu items,
            // we need to dispose ContextMenuStrip explicitly soon after it disappeared.
            cm.VisibleChanged += new EventHandler(ContextMenuStripVisibleChanged);

            try {
                cm.Show(this, this.PointToClient(point_screen));
            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:28,代码来源:PoderosaForm.cs

示例3: SetCommandTarget

 public static void SetCommandTarget(ITextView textView, ICommandTarget target) {
     var proxy = ServiceManager.GetService<CommandTargetProxy>(textView);
     if (proxy != null) {
         proxy._commandTarget = target;
         ServiceManager.RemoveService<CommandTargetProxy>(textView);
     }
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:7,代码来源:CommandTargetProxy.cs

示例4: BuildMenuContentsForGroup

        private static int BuildMenuContentsForGroup(int index, ICommandTarget target, ToolStripItemCollection children, IPoderosaMenuGroup grp) {
            int count = 0;
            foreach (IPoderosaMenu m in grp.ChildMenus) {
                ToolStripMenuItem mi = new ToolStripMenuItem();
                children.Insert(index++, mi); //途中挿入のことも
                mi.DropDownOpening += new EventHandler(OnPopupMenu);
                mi.Enabled = m.IsEnabled(target);
                mi.Checked = mi.Enabled ? m.IsChecked(target) : false;
                mi.Text = m.Text; //Enabledを先に
                mi.Tag = new MenuItemTag(grp, m, target);

                IPoderosaMenuFolder folder;
                IPoderosaMenuItem leaf;
                if ((folder = m as IPoderosaMenuFolder) != null) {
                    BuildMenuContents(mi, folder);
                }
                else if ((leaf = m as IPoderosaMenuItem) != null) {
                    mi.Click += new EventHandler(OnClickMenu);
                    IGeneralCommand gc = leaf.AssociatedCommand as IGeneralCommand;
                    if (gc != null)
                        mi.ShortcutKeyDisplayString = WinFormsUtil.FormatShortcut(CommandManagerPlugin.Instance.CurrentKeyBinds.GetKey(gc));
                }

                count++;
            }

            return count;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:28,代码来源:MenuUtil.cs

示例5: RPlotHistoryVisualComponent

        public RPlotHistoryVisualComponent(IRPlotManager plotManager, ICommandTarget controller, IVisualComponentContainer<IRPlotHistoryVisualComponent> container, ICoreShell coreShell) {
            if (plotManager == null) {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (container == null) {
                throw new ArgumentNullException(nameof(container));
            }

            if (coreShell == null) {
                throw new ArgumentNullException(nameof(coreShell));
            }

            _plotManager = plotManager;
            _viewModel = new RPlotHistoryViewModel(plotManager, coreShell);
            _shell = coreShell;

            var control = new RPlotHistoryControl {
                DataContext = _viewModel
            };

            _disposableBag = DisposableBag.Create<RPlotDeviceVisualComponent>()
                .Add(() => control.ContextMenuRequested -= Control_ContextMenuRequested);

            control.ContextMenuRequested += Control_ContextMenuRequested;

            Control = control;
            Controller = controller;
            Container = container;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:30,代码来源:RPlotHistoryVisualComponent.cs

示例6: DataLoadBenchmark

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="target">target object</param>
 /// <param name="data">data to send to the terminal</param>
 /// <param name="repeat">repeat count to send data</param>
 public DataLoadBenchmark(ICommandTarget target, byte[] data, int repeat)
     : base(target) {
     _data = data;
     _repeat = repeat;
     _socket = new MockSocket();
     _connection = new MockTerminalConnection("xterm", _socket);
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:13,代码来源:DataLoadBenchmark.cs

示例7: AsTerminalControl

 public static TerminalControl AsTerminalControl(ICommandTarget target) {
     IPoderosaView view = AsViewOrLastActivatedView(target);
     if (view == null)
         return null;
     else
         return (TerminalControl)view.GetAdapter(typeof(TerminalControl));
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:7,代码来源:TerminalCommands.cs

示例8: AsViewOrLastActivatedView

 //ちょっと恣意的だが、ビュー直接またはLastActivatedViewで
 public static IPoderosaView AsViewOrLastActivatedView(ICommandTarget target) {
     IPoderosaView view = (IPoderosaView)target.GetAdapter(typeof(IPoderosaView));
     if (view != null)
         return view; //成功
     else
         return AsLastActivatedView(target);
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:8,代码来源:TerminalCommands.cs

示例9: AsCharacterDocumentViewer

 public static CharacterDocumentViewer AsCharacterDocumentViewer(ICommandTarget target) {
     IPoderosaView view = AsViewOrLastActivatedView(target);
     if (view == null)
         return null;
     else
         return (CharacterDocumentViewer)view.GetAdapter(typeof(CharacterDocumentViewer));
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:7,代码来源:TerminalCommands.cs

示例10: CommandTargetCommand

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="commandTarget">Command target</param>
		/// <param name="group">Command group, eg. <see cref="CommandConstants.StandardGroup"/></param>
		/// <param name="cmdId">Command ID</param>
		public CommandTargetCommand(ICommandTarget commandTarget, Guid group, int cmdId) {
			if (commandTarget == null)
				throw new ArgumentNullException(nameof(commandTarget));
			this.commandTarget = commandTarget;
			this.group = group;
			this.cmdId = cmdId;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:CommandTargetCommand.cs

示例11: InternalExecute

        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) {
            if (!CanExecute(target))
                return CommandResult.Ignored;
            TerminalTransmission output = GetSession().TerminalTransmission;

            string data = Clipboard.GetDataObject().GetData("Text") as string;

            if (data == null)
                return CommandResult.Ignored;

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;
            if (options.AlertOnPasteNewLineChar) {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine)) {
                    IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView));
                    IPoderosaForm form = view.ParentForm;
                    if (form != null) {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes) {
                            return CommandResult.Ignored;
                        }
                    }
                }
            }

            //TODO 長文のときにダイアログを出して中途キャンセル可能に
            StringReader reader = new StringReader(data);
            output.SendTextStream(reader, data[data.Length - 1] == '\n');
            return CommandResult.Succeeded;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:31,代码来源:CopyPaste.cs

示例12: InternalExecute

        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            IPoderosaView view;
            ITerminalSession session;
            if (!GetViewAndSession(target, out view, out session))
                return CommandResult.Ignored;

            string data = GetClipboardText();
            if (data == null)
                return CommandResult.Ignored;

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;
            if (options.AlertOnPasteNewLineChar) {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine)) {
                    IPoderosaForm form = view.ParentForm;
                    if (form != null) {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes) {
                            return CommandResult.Ignored;
                        }
                    }
                }
            }

            StringReader reader = new StringReader(data);
            TerminalTransmission output = session.TerminalTransmission;
            output.SendTextStream(reader, data.Length > 0 && data[data.Length - 1] == '\n');
            return CommandResult.Succeeded;
        }
开发者ID:poderosaproject,项目名称:poderosa,代码行数:31,代码来源:CopyPaste.cs

示例13: InternalExecute

 public override CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
 {
     IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);
     MacroList dlg = new MacroList();
     dlg.ShowDialog(window.AsForm());
     return CommandResult.Succeeded;
 }
开发者ID:FNKGino,项目名称:poderosa,代码行数:7,代码来源:MacroPlugin.cs

示例14: InternalExecute

        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) {
            IPoderosaDocument doc = (IPoderosaDocument)args[0].GetAdapter(typeof(IPoderosaDocument));
            if (doc == null)
                return CommandResult.Failed;

            SessionManagerPlugin.Instance.ActivateDocument(doc, ActivateReason.InternalAction);
            return CommandResult.Succeeded;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:8,代码来源:DocActivationCommands.cs

示例15: GetForm

 /// <summary>
 /// Gets System.Windows.Forms.Form of the target.
 /// </summary>
 /// <param name="target">Target object which has been passed to the IPoderosaCommand's method.</param>
 /// <returns>Form object if it is available. Otherwise null.</returns>
 protected Form GetForm(ICommandTarget target)
 {
     IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow));
     if (window != null)
         return window.AsForm();
     else
         return null;
 }
开发者ID:poderosaproject,项目名称:poderosa,代码行数:13,代码来源:SFTPToolbar.cs


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