private void OnOpenInheritanceGraphBuilder()
        {
            var notification = new Notification();
            notification.Title = "Inheritance Graph Builder";

            InheritanceGraphBuilderRequest.Raise( notification, c => { } );
        }
        private void OnShowConfirmation()
        {
            var notification = new Notification();
            notification.Title = "Really?";

            ConfirmationRequest.Raise( notification, n => { } );
        }
        private void OnShowConfirmation()
        {
            var notification = new Notification();
            notification.Title = "Really?";

            // we create ViewModel with new here for simplicity. Of course we could also import it into e.g. private field
            // in order to let MEF resolve all dependencies
            notification.Content = new ComplexDialogModel( Model );

            ConfirmationRequest.Raise( notification, n => { } );
        }
Пример #4
0
        public void WhenANotificationIsRequested_ThenTheEventIsRaisedWithTheSuppliedContext()
        {
            var request = new InteractionRequest<Notification>();
            object suppliedContext = null;
            request.Raised += (o, e) => suppliedContext = e.Context;

            var context = new Notification();

            request.Raise(context, c => { });

            Assert.AreSame(context, suppliedContext);
        }
Пример #5
0
        public void WhenTheEventCallbackIsExecuted_ThenTheNotifyCallbackIsInvokedWithTheSuppliedContext()
        {
            var request = new InteractionRequest<Notification>();
            Action eventCallback = null;
            request.Raised += (o, e) => eventCallback = e.Callback;

            var context = new Notification();
            object suppliedContext = null;

            request.Raise(context, c => { suppliedContext = c; });

            eventCallback();

            Assert.AreSame(context, suppliedContext);
        }
 /// <summary>
 /// Constructs a new instance of <see cref="InteractionRequestedEventArgs"/>
 /// </summary>
 /// <param name="context"></param>
 /// <param name="callback"></param>
 public InteractionRequestedEventArgs(Notification context, Action callback)
 {
     this.Context = context;
     this.Callback = callback;
 }
		private void RaiseCompleteShipment()
		{
			var shipmentId = "";
			if (CurrentTab.IdTab == NavigationNames.PicklistHomeName)
			{
				var x = (PicklistHomeViewModel)CurrentTab.ViewModel;
				if (x.SelectedItem != null)
				{
					shipmentId=x.SelectedItem.Data.Picklist.Shipments[0].ShipmentId;
				}
			}
			var vm = _completeShipmentVmFactory.GetViewModelInstance(new KeyValuePair<string, object>("shipmentId", shipmentId));
			
			var confirmation = new ConditionalConfirmation {Title = "Complete shipment", Content = vm};

			CommonConfirmRequest.Raise(confirmation, x =>
			{
				if (x.Confirmed)
				{
					using (var orderRepository = _orderRepositoryFactory.GetRepositoryInstance())
					{
						var query = orderRepository.Shipments.Expand("OrderForm").Where(ship => ship.ShipmentId == vm.ShipmentId);
						var current = query.FirstOrDefault();
						if (current != null)
						{
							var res = true;
							try
							{
								current.ShipmentTrackingNumber = vm.TrackingNumber;
								current.Status = ShipmentStatus.Shipped.ToString();
								// Load complete item here

								var q = orderRepository.Orders
														.Expand("OrderForms/Shipments/ShipmentItems/LineItem")
														.Where(order => order.OrderGroupId == current.OrderForm.OrderGroupId);
								var originalItem = q.SingleOrDefault();

								if (originalItem != null)
								{
									var result = _orderService.ExecuteWorkflow(RecalculateWorkflowName, originalItem);
									OnUIThread(()=>originalItem.InjectFrom<CloneInjection>(result.OrderGroup));
								}

								orderRepository.UnitOfWork.Commit();
							}
							catch (Exception)
							{
								res = false;
							}

							if (res)
							{
								var notification = new Notification
									{
										Title = "Shipment completed",
										Content = string.Format("Shipment: {0}{1}{2}{3}Completed successfully",
																vm.ShipmentId,
																Environment.NewLine,
																string.IsNullOrEmpty(vm.TrackingNumber)
																	? string.Empty
																	: string.Format("TrackingNumber: {0}", vm.TrackingNumber),
																Environment.NewLine)
									};
								CommonNotifyRequest.Raise(notification);
							}
							else
							{
								current.ShipmentTrackingNumber = null;
								current.Status = ShipmentStatus.Packing.ToString();
								orderRepository.UnitOfWork.Commit();
								var notification = new Notification
									{
										Title = "Shipment not completed",
										Content = string.Format("Shipment: {0}\nNot completed",
																vm.ShipmentId)
									};
								CommonNotifyRequest.Raise(notification);
							}
						}
					}
				}
			});
			
		}