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


C# Messenger.Send方法代码示例

本文整理汇总了C#中Messenger.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Messenger.Send方法的具体用法?C# Messenger.Send怎么用?C# Messenger.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messenger的用法示例。


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

示例1: MainWindowViewModel

 public MainWindowViewModel(Messenger messenger)
 {
     Workspaces = new ObservableCollection<IWorkspace>();
     Workspaces.CollectionChanged += Workspaces_CollectionChanged;
     SearchCustomerCommand = new RelayCommand(SearchCustomer);
     CreateCustomerCommand = new RelayCommand(() => messenger.Send(new OpenDialogWindowMessage(new CustomerViewModel(new Customer()), r => MessageBox.Show(r.ToString()))));
 }
开发者ID:smartinz,项目名称:randomhacking,代码行数:7,代码来源:MainWindowViewModel.cs

示例2: Messager_Unsubscription_Test

		public void Messager_Unsubscription_Test(int countSend)
		{
			var subscriber1 = new FakeSubscriber();
			var subscriber2 = new FakeSubscriber();
			var message = new FakeOneMessage { Text = "Test message" };
			var messenger = new Messenger();
			byte firstSubscriberNumber = 0;
			byte secondSubscriberNumber = 0;

			messenger.Subscribe<FakeOneMessage>(subscriber1, (s, m) =>
				{
					firstSubscriberNumber++;
					messenger.Unsubscribe<FakeOneMessage>(subscriber1);
				});
			messenger.Subscribe<FakeOneMessage>(subscriber2, (s, m) =>
				{
					secondSubscriberNumber++;
				});
			
			for (int i = 0; i < countSend; i++)
			{
				messenger.Send(message);
			}

			Assert.AreEqual(1, firstSubscriberNumber);
			Assert.AreEqual(countSend, secondSubscriberNumber);
		}
开发者ID:wcoder,项目名称:XForms.Utils,代码行数:27,代码来源:MessagerTests.cs

示例3: HandleMessage

            public override void HandleMessage(Message msg)
            {
                Message msg1 = Message.Obtain();
                Bundle bundle = new Bundle();
                bundle.PutString("arg1", "index.html");
                bundle.PutString("arg2", "http://www.vogella.com/index.html");
                msg1.Data = bundle;
                Messenger replyto = new Messenger(msg.ReplyTo.Binder);
                replyto.Send(msg1);

                 	         // Log.Error(this.Class.DeclaringClass.Class.Name, "Handlign message, ComputeService");
            }
开发者ID:mmfraser,项目名称:dissertation,代码行数:12,代码来源:ComputeService.cs

示例4: SutSubscribesToAddCmdApplicationConfigurationEvent

 public void SutSubscribesToAddCmdApplicationConfigurationEvent(
     Name aName,
     IChannel<SaveCmdApplicationConfigurationCommand> channel,
     CmdApplicationConfigurationViewModel vm,
     [Frozen]Mock<ICmdApplicationConfigurationViewModelFactory> mockFactory,
     Messenger messenger,
     IFixture fixture)
 {
     fixture.Inject<IMessenger>(messenger);
     var sut = fixture.Create<CmdApplicationConfigurationListViewModel>();
     SetUpFactoryToReturnANewInstance(vm, mockFactory);
     var expected = sut.ApplicationConfigurations.Count + 1;
     messenger.Send(new AddCmdApplicationConfigurationEvent());
     Assert.Equal(expected, sut.ApplicationConfigurations.Count);
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:15,代码来源:CmdApplicationConfigurationListViewModelTests.cs

示例5: CurrentProjectIsChangedOnMessage

        public void CurrentProjectIsChangedOnMessage()
        {
            // Arrange
            var messenger = new Messenger();

            var projectListMock = new Mock<IProjectListViewModel>();
            projectListMock.SetupGet( x => x.CurrentProject ).Verifiable();

            var searcher = new EntrySearcher( projectListMock.Object, messenger );

            // Act
            messenger.Send( new CurrentProjectChangedMessage( null ) );

            // Assert
            projectListMock.VerifyGet( x => x.CurrentProject, Times.Exactly( 2 ) );
        }
开发者ID:TheSylence,项目名称:GSD,代码行数:16,代码来源:EntrySearcherTests.cs

示例6: Messager_IncorrectSubscription_Test

		public void Messager_IncorrectSubscription_Test()
		{
			var subscriber = new FakeSubscriber();
			var message = new FakeTwoMessage();
			var messenger = new Messenger();
			FakeOneMessage receivedMessage = null;

			messenger.Subscribe<FakeOneMessage>(subscriber, (s, m) =>
				{
					receivedMessage = m;
				});
			
			messenger.Send(message);

			Assert.AreNotSame(message, receivedMessage);
		}
开发者ID:wcoder,项目名称:XForms.Utils,代码行数:16,代码来源:MessagerTests.cs

示例7: Messager_CorrectSubscription_Test

		public void Messager_CorrectSubscription_Test()
		{
			var subscriber = new FakeSubscriber();
			var message = new FakeOneMessage { Text = "Test message" };
			var messenger = new Messenger();
			FakeOneMessage receivedMessage = null;

			messenger.Subscribe<FakeOneMessage>(subscriber, (s, m) =>
				{
					receivedMessage = m;
				});
			
			messenger.Send(message);

			Assert.AreSame(message, receivedMessage);
			Assert.AreEqual(message.Text, receivedMessage.Text);
		}
开发者ID:wcoder,项目名称:XForms.Utils,代码行数:17,代码来源:MessagerTests.cs

示例8: TestInstanceCreation

        public void TestInstanceCreation()
        {
            const string TestContent = "abcd";

            Reset();
            var messenger = new Messenger();

            messenger.Register<TestMessage>(this, m => StringContent = m.Content);

            Assert.AreEqual(null, StringContent);

            messenger.Send(new TestMessage
            {
                Content = TestContent
            });

            Assert.AreEqual(TestContent, StringContent);
        }
开发者ID:name2name2,项目名称:mvvmlight,代码行数:18,代码来源:MessengerCreationDeletionTest.cs

示例9: TestMultipleMessengerInstances

        public void TestMultipleMessengerInstances()
        {
            var messenger1 = new Messenger();
            var messenger2 = new Messenger();

            var recipient11 = new TestRecipient1();
            var recipient12 = new TestRecipient1();
            var recipient21 = new TestRecipient2();
            var recipient22 = new TestRecipient2();

            messenger1.Register<string>(recipient11, recipient11.ReceiveMessage);
            messenger2.Register<string>(recipient12, recipient12.ReceiveMessage);
            messenger1.Register<string>(recipient21, recipient21.ReceiveMessage);
            messenger2.Register<string>(recipient22, recipient22.ReceiveMessage);

            const string TestContent1 = "abcd";
            const string TestContent2 = "efgh";

            Assert.AreEqual(null, recipient11.ReceivedContentString);
            Assert.AreEqual(null, recipient12.ReceivedContentString);
            Assert.AreEqual(null, recipient21.ReceivedContentString);
            Assert.AreEqual(null, recipient22.ReceivedContentString);

            messenger1.Send(TestContent1);

            Assert.AreEqual(TestContent1, recipient11.ReceivedContentString);
            Assert.AreEqual(null, recipient12.ReceivedContentString);
            Assert.AreEqual(TestContent1, recipient21.ReceivedContentString);
            Assert.AreEqual(null, recipient22.ReceivedContentString);

            messenger2.Send(TestContent2);

            Assert.AreEqual(TestContent1, recipient11.ReceivedContentString);
            Assert.AreEqual(TestContent2, recipient12.ReceivedContentString);
            Assert.AreEqual(TestContent1, recipient21.ReceivedContentString);
            Assert.AreEqual(TestContent2, recipient22.ReceivedContentString);
        }
开发者ID:NulledLabs,项目名称:mvvmlight,代码行数:37,代码来源:MessengerMultipleInstancesTest.cs

示例10: LoginQuery

 void LoginQuery(Messenger messenger, string key, LoginQuery query)
 {
     messenger.Send("Database", query);
 }
开发者ID:Lobo-Prix,项目名称:TeraTale,代码行数:4,代码来源:LoginHandler.cs

示例11: LoginAnswer

 void LoginAnswer(Messenger messenger, string key, LoginAnswer query)
 {
     messenger.Send("Proxy", query);
 }
开发者ID:Lobo-Prix,项目名称:TeraTale,代码行数:4,代码来源:LoginHandler.cs


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