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

C# Command类代码示例

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

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



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

示例1: MarcoTest

        public void MarcoTest()
        {
            var a = 1;
            var b = 2;
            var actual = 0;
            var expected = 5;

            var cmdA = new Command((parameters) =>
            {
                a++;
            });

            var cmdB = new Command((parameters) =>
            {
                b++;
            });

            var cmdC = new Command((parameters) =>
            {
                actual = a + b;
            });

            /// Another way to execute dynamic command: 
            /// var maco=new Macro();
            /// macro.Add(() => { a++; }, () => { b++; }, () => { actual = a + b; });

            var macro = new Macro(cmdA, cmdB, cmdC);
            macro.Call();

            Assert.AreEqual(expected, actual);
        }
开发者ID:hispafox,项目名称:DNA.Patterns,代码行数:31,代码来源:CommandPatternTest.cs


示例2: SendCommand

 public void SendCommand( Command command, short commandData )
 {
     byte[] data = new byte[2];
     data[0] = (byte) (commandData & 0xFF);
     data[0] = (byte) (commandData >> 8 );
     SendCommand( command, data );
 }
开发者ID:nico-izo,项目名称:KOIB,代码行数:7,代码来源:Xsocks.cs


示例3: LeadListHeaderView

        public LeadListHeaderView(Command newLeadTappedCommand)
        {
            _NewLeadTappedCommand = newLeadTappedCommand;

            #region title label
            Label headerTitleLabel = new Label()
            {
                Text = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(),
                TextColor = Palette._003,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center
            };
            #endregion

            #region new lead image "button"
            var newLeadImage = new Image
            {
                Source = new FileImageSource { File = Device.OnPlatform("add_ios_gray", "add_android_gray", null) },
                Aspect = Aspect.AspectFit, 
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            //Going to use FAB
            newLeadImage.IsVisible = false;
            newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = _NewLeadTappedCommand,
                    NumberOfTapsRequired = 1
                });
            #endregion

            #region absolutLayout
            AbsoluteLayout absolutLayout = new AbsoluteLayout();

            absolutLayout.Children.Add(
                headerTitleLabel, 
                new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize), 
                AbsoluteLayoutFlags.PositionProportional);

            absolutLayout.Children.Add(
                newLeadImage, 
                new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5), 
                AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional);
            #endregion

            #region setup contentView
            ContentView contentView = new ContentView()
            {
                Padding = new Thickness(10, 0), // give the content some padding on the left and right
                HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view
            };
            #endregion

            #region compose the view hierarchy
            contentView.Content = absolutLayout;
            #endregion

            Content = contentView;
        }
开发者ID:XnainA,项目名称:app-crm,代码行数:60,代码来源:LeadListHeaderView.cs


示例4: LoginPageViewModel

		public LoginPageViewModel (IMyNavigationService navigationService)
		{
			this.navigationService = navigationService;

			LoggedIn = App.LoggedIn;

			GoToSignupPage = new Command (() => {
				this.navigationService.NavigateTo(ViewModelLocator.SignupPageKey);
			});

			Login = new Command ( async () => {
//				var database = new ECOdatabase();
				var database = new AzureDatabase ();

//				database1.GetUsers();

				int rowcount = await database.ValidateUser (Username, Password);
				if (rowcount == 0) {
					App.LoggedIn = false;
				} else {
					App.LoggedIn = true;
					//Navigate to homepage without back key
					this.navigationService.NavigateToModal (ViewModelLocator.HomePageKey);
				}

			});

		}
开发者ID:joagwa,项目名称:EasyTechy,代码行数:28,代码来源:LoginPageViewModel.cs


示例5: DXToolStripMenuItem

        public DXToolStripMenuItem(String name, Command cmd)
            : base()
        {
            ci = new CommandInterface(name, cmd, this);

            this.Click += new EventHandler(cmd.executeEvent);
        }
开发者ID:BackupTheBerlios,项目名称:opendx2,代码行数:7,代码来源:DXToolStripMenuItem.cs


示例6: ExtendedMessage

 /// <summary>
 /// Creates new X10 extended message.
 /// </summary>
 /// <param name="house">Valid range is A-P.</param>
 /// <param name="unit">Valid units are 01-16.</param>
 /// <param name="command">Only commands ExtendedCode and ExtendedData are valid for extended messages.</param>
 /// <param name="extendedCommand">Byte 0-255. Make sure that either extended command or data is above 0.</param>
 /// <param name="extendedData">Byte 0-255. Make sure that either extended command or data is above 0.</param>
 public ExtendedMessage(House house, Unit unit, Command command, byte extendedCommand, byte extendedData)
     : base(house, unit, command)
 {
     Validate(extendedCommand, extendedData);
     ExtendedCommand = extendedCommand;
     ExtendedData = extendedData;
 }
开发者ID:gerzo,项目名称:x10,代码行数:15,代码来源:ExtendedMessage.cs


示例7: FishboneNodeActionPlansVM

        public FishboneNodeActionPlansVM(FishboneNodeVM defection, AccessType access)
            : base(access)
        {
            UnitOfWork = new SoheilEdmContext();
            CurrentFishboneNode = defection;
            FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork);
            FishboneNodeDataService.ActionPlanAdded += OnActionPlanAdded;
            FishboneNodeDataService.ActionPlanRemoved += OnActionPlanRemoved;
            ActionPlanDataService = new ActionPlanDataService(UnitOfWork);

            var selectedVms = new ObservableCollection<ActionPlanFishboneVM>();
            foreach (var productFishboneNode in FishboneNodeDataService.GetActionPlans(defection.Id))
            {
                selectedVms.Add(new ActionPlanFishboneVM(productFishboneNode, Access, RelationDirection.Reverse));
            }
            SelectedItems = new ListCollectionView(selectedVms);

            var allVms = new ObservableCollection<ActionPlanVM>();
            foreach (var actionPlan in ActionPlanDataService.GetActives())
            {
                allVms.Add(new ActionPlanVM(actionPlan, Access, ActionPlanDataService));
            }
            AllItems = new ListCollectionView(allVms);

            IncludeCommand = new Command(Include, CanInclude);
            ExcludeCommand = new Command(Exclude, CanExclude);
        }
开发者ID:T1Easyware,项目名称:Soheil,代码行数:27,代码来源:FishBoneNodeActionPlansVM.cs


示例8: EmployeeMainPropertiesViewModel

        public EmployeeMainPropertiesViewModel(Employee employee)
        {
            _departmentRepository = new DepartmentRepository();
            _employee = employee;

            ChangeDepartmentCommand = new Command(ChangeDepartment);
        }
开发者ID:mdcruz,项目名称:NorthwindAutomation,代码行数:7,代码来源:EmployeeMainPropertiesViewModel.cs


示例9: AsyncRequest

 public override FutureResponse AsyncRequest(Command command)
 {
     lock(transmissionLock)
     {
         return base.AsyncRequest(command);
     }
 }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:7,代码来源:MutexTransport.cs


示例10: OnReceiveCommand

        private bool OnReceiveCommand(SocketState cs, Command c)
        {
            if(!requesting || this.IsDisposed || c.CommandType != Command.Type.Screenshot || cs.Connection.RemoteEndPoint.ToString() != this.cs.Connection.RemoteEndPoint.ToString())
            {
                return false;
            }

            CommandState cmdState = CommandHandler.HandleCommand(c, cs);
            try
            {
                pbScreenshot.Invoke((MethodInvoker)delegate
                {
                    tmrScreenshot.Enabled = requesting;
                    tmrScreenshotTimeout.Enabled = false;
                    pbScreenshot.Image = byteArrayToImage((byte[])cmdState.ReturnValue);
                }, null);
            }
            catch (Exception)
            {
                //sh.OnReceiveDataCallback = original;
                return false;
            }

            return true;
        }
开发者ID:AlbinoDrought,项目名称:TheForlorn,代码行数:25,代码来源:WatchForm.cs


示例11: RunCommand

 private void RunCommand(Command command)
 {
     _content = EnsureContent(_content);
     _negativeWords = EnsureNegativeWords(_negativeWords);
     _inputOutput.Clear();
     _contentProcessor.Run(command, _content, _negativeWords);
 }
开发者ID:skirmamack,项目名称:Euromoney.RecruitmentTest,代码行数:7,代码来源:ContentProcessorLauncher.cs


示例12: GenreItem

        public GenreItem(Library.GalleryItem title, IModelItem owner, List<TitleFilter> filter)
            : base(owner)
        {
            this.Description = title.Name;
            this.DefaultImage=title.MenuCoverArt;
            this.Metadata = string.Format("{0} titles", title.ForcedCount);
            this.Invoked += delegate(object sender, EventArgs args)
            {
                //am I being silly here copying this?
                List<TitleFilter> newFilter = new List<TitleFilter>();
                foreach (TitleFilter filt in filter)
                {
                    newFilter.Add(filt);
                }
                newFilter.Add(new TitleFilter(title.Category.FilterType, title.Name));
                OMLProperties properties = new OMLProperties();
                properties.Add("Application", OMLApplication.Current);
                properties.Add("I18n", I18n.Instance);
                Command CommandContextPopOverlay = new Command();
                properties.Add("CommandContextPopOverlay", CommandContextPopOverlay);

                Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(newFilter, title.Description);

                properties.Add("Page", gallery);
                OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties);
            };
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:27,代码来源:GenreItem.cs


示例13: MainWindowViewModel

 /// <summary>
 /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
 /// </summary>
 public MainWindowViewModel()
     : base()
 {
     HomeViewCommand = new Command(OnHomeViewCommandExecute, OnHomeViewCommandCanExecute);
     AddReport = new Command(OnAddReportExecute, OnAddReportCanExecute);
     CurrentViewModel = new HomeViewModel();
 }
开发者ID:da991319,项目名称:GenericFileTransferCatel,代码行数:10,代码来源:MainWindowViewModel.cs


示例14: PerformClickShouldExecuteCommand

        public void PerformClickShouldExecuteCommand()
        {
            var clicked = false;
            var command = new Command<string>(
                p =>
                {
                    Assert.Null( p );
                    clicked = true;
                } );
            var target = new ClickableItem<string>( "test", command );

            target.PerformClick();
            Assert.True( clicked );

            clicked = false;
            command = new Command<string>(
                p =>
                {
                    Assert.Equal( "test2", p );
                    clicked = true;
                } );
            target = new ClickableItem<string>( "test", command );
            target.PerformClick( "test2" );
            Assert.True( clicked );
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:25,代码来源:ClickableItemTTest.cs


示例15: ExitInnerBlock

 public override void ExitInnerBlock( Command command, Thread thread, Scope scope )
 {
     if ( new TLBit( command.ParamExpression.Evaluate( scope ) ).Value )
         thread.EnterBlock( command.InnerBlock );
     else
         thread.Advance();
 }
开发者ID:Metapyziks,项目名称:ThreadedLanguageExp,代码行数:7,代码来源:CmdWhl.cs


示例16: Oneway

 public override void Oneway(Command command)
 {
     lock(transmissionLock)
     {
         this.next.Oneway(command);
     }
 }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:7,代码来源:MutexTransport.cs


示例17: CommandFinished

 public override void CommandFinished(Command command)
 {
     if (Cube.IsSelected)
     {
         UpdateMoveOptionsSelectors();
     }
 }
开发者ID:rodrigod89,项目名称:project-decubed-online,代码行数:7,代码来源:CubeControllerInput.cs


示例18: Request

 public override Response Request(Command command, TimeSpan timeout)
 {
     lock(transmissionLock)
     {
         return base.Request(command, timeout);
     }
 }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:7,代码来源:MutexTransport.cs


示例19: MainWindowViewModel

 /// <summary>
 /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
 /// </summary>
 public MainWindowViewModel()
     : base()
 {
     CurrentDummy = new Dummy(444);
     Reset = new Command(OnResetExecute);
     Create = new Command(OnCreateExecute);
 }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:10,代码来源:NamedViewModelToModelCrashTest.cs


示例20: ExtenderSettings

        public ExtenderSettings()
        {
            this.commands = new ArrayListDataSet(this);

            //save command
            Command saveCmd = new Command();
            saveCmd.Description = "Save";
            saveCmd.Invoked += new EventHandler(saveCmd_Invoked);
            this.commands.Add(saveCmd);

            //cancel command
            Command cancelCmd = new Command();
            cancelCmd.Description = "Cancel";
            cancelCmd.Invoked += new EventHandler(cancelCmd_Invoked);
            this.commands.Add(cancelCmd);

            this.goToImpersonation = new Command();
            this.goToImpersonation.Description = "Impersonation";
            this.goToImpersonation.Invoked += new EventHandler(goToImpersonation_Invoked);

            this.goToTranscode = new Command();
            this.goToTranscode.Description = "Transcoding";
            this.goToTranscode.Invoked += new EventHandler(goToTranscode_Invoked);

            this.transcodingDelays = new Choice(this);

            this.SetupTranscodingOptions();
            this.SetupImpersonation();
            this.SetupTranscodingDelays();
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:30,代码来源:ExtenderSettings.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CommandAction类代码示例发布时间:2022-05-24
下一篇:
C# CommInterface类代码示例发布时间: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