コード例 #1
0
ファイル: MainPageViewModel.cs プロジェクト: RadicalFx/Jason
        public MainPageViewModel( IWorkerServiceClientFactory factory )
        {
            this.factory = factory;

            this.ExecuteEcho = DelegateCommand.Create()
                .OnExecute( o =>
                {
                    var context = TaskScheduler.FromCurrentSynchronizationContext();
                    using( var client = this.factory.CreateAsyncClient() )
                    {
                        client.WorkOnAsync( new Job( new EchoJobTask() { Message = this.Message } ) )
                            .ContinueWith( e =>
                            {
                                var r = e.Result.GetTaskResult<EchoJobTaskResult>().EchoedMessage;
                                this.EchoResult = r;
                            }, context );
                    }

                    using( var client = this.factory.CreateAsyncClient() )
                    {
                        client.ExecuteAsync( new SampleCommand() )
                            .ContinueWith( e =>
                            {
                                var r = e.Result as EmptyCommandExecutionResult;
                            }, context );
                    }
                } );
        }
コード例 #2
0
 public MainViewModel(IWorkerServiceClientFactory clientFactory, IViewContextFactory <IPizzerieViewContext> pizzerieViewContextFactory)
 {
     this.clientFactory = clientFactory;
     this.pizzerieViewContextFactory = pizzerieViewContextFactory;
     this.Pizzerie = new ObservableCollection <PizzeriaView>();
     this.Orders   = new ObservableCollection <OrderView>();
 }
コード例 #3
0
        public MainPageViewModel(IWorkerServiceClientFactory factory)
        {
            this.factory = factory;

            this.ExecuteEcho = DelegateCommand.Create()
                               .OnExecute(o =>
            {
                var context = TaskScheduler.FromCurrentSynchronizationContext();
                using (var client = this.factory.CreateAsyncClient())
                {
                    client.WorkOnAsync(new Job(new EchoJobTask()
                    {
                        Message = this.Message
                    }))
                    .ContinueWith(e =>
                    {
                        var r           = e.Result.GetTaskResult <EchoJobTaskResult>().EchoedMessage;
                        this.EchoResult = r;
                    }, context);
                }

                using (var client = this.factory.CreateAsyncClient())
                {
                    client.ExecuteAsync(new SampleCommand())
                    .ContinueWith(e =>
                    {
                        var r = e.Result as EmptyCommandExecutionResult;
                    }, context);
                }
            });
        }
コード例 #4
0
        public DefaultJasonClientConfiguration( String pathToScanForAssemblies, IWorkerServiceClientFactory clientFactory, String assemblySelectPattern = "*" )
        {
            this.CommandsSelector = t => false;

            this.path = pathToScanForAssemblies;
            this.clientFactory = clientFactory;
            this.AssemblySelector = name => name.IsLike( "jason.*", assemblySelectPattern );
        }
コード例 #5
0
        public DefaultJasonClientConfiguration(String pathToScanForAssemblies, IWorkerServiceClientFactory clientFactory, String assemblySelectPattern = "*")
        {
            this.CommandsSelector = t => false;

            this.path             = pathToScanForAssemblies;
            this.clientFactory    = clientFactory;
            this.AssemblySelector = name => name.IsLike("jason.*", assemblySelectPattern);
        }
コード例 #6
0
		public MainViewModel( IWorkerServiceClientFactory clientFactory, IViewContextFactory<IPeopleViewContext> peopleViewContextFactory )
		{
			this.clientFactory = clientFactory;
			this.peopleViewContextFactory = peopleViewContextFactory;
			this.People = new ObservableCollection<PersonView>();

			this.GetPropertyMetadata( () => this.SelectedPerson )
				.AddCascadeChangeNotifications( () => this.CanTouchSelectedPerson );
		}
コード例 #7
0
		public MainViewModel( IWorkerServiceClientFactory clientFactory, Func<IStatelessSession> sessionFactory )
		{
			this.clientFactory = clientFactory;
			this.sessionFactory = sessionFactory;
			this.People = new ObservableCollection<PersonView>();

			this.GetPropertyMetadata( () => this.SelectedPerson )
				.AddCascadeChangeNotifications( () => this.CanTouchSelectedPerson );
		}
コード例 #8
0
        public MainViewModel(IWorkerServiceClientFactory clientFactory, IViewContextFactory <IPeopleViewContext> peopleViewContextFactory)
        {
            this.clientFactory            = clientFactory;
            this.peopleViewContextFactory = peopleViewContextFactory;
            this.People = new ObservableCollection <PersonView>();

            this.GetPropertyMetadata(() => this.SelectedPerson)
            .AddCascadeChangeNotifications(() => this.CanTouchSelectedPerson);
        }
コード例 #9
0
        public MainViewModel(IWorkerServiceClientFactory clientFactory, Func <IStatelessSession> sessionFactory)
        {
            this.clientFactory  = clientFactory;
            this.sessionFactory = sessionFactory;
            this.People         = new ObservableCollection <PersonView>();

            this.GetPropertyMetadata(() => this.SelectedPerson)
            .AddCascadeChangeNotifications(() => this.CanTouchSelectedPerson);
        }
コード例 #10
0
 public OrderCompletedHandler(IWorkerServiceClientFactory clientFactory)
 {
     this.clientFactory = clientFactory;
 }
コード例 #11
0
 public WinRTJasonClientConfiguration(IWorkerServiceClientFactory clientFactory)
 {
     this.clientFactory      = clientFactory;
     this.CommandsSelector   = t => false;
     this.AssembliesProvider = () => this.GetCompositionAssemblies();
 }