public ICommand GetCommand(IInputModel model) { var partName = _inputModelsAndValues.Where(row => row.Value.InputModelType == model.GetType()).Select(row => row.Key). FirstOrDefault(); GuardPartNameRegistered(partName); var command = Activator.CreateInstance(_inputModelsAndValues[partName].CommandType) as ICommand; if (command == null) { throw new CannotCreateCommandException(); } command = Mapper.Map(model, command, model.GetType(), command.GetType()) as ICommand; if (command == null) { throw new CannotMapCommandException(); } command.Created = DateTime.Now; command.Identifier = Guid.NewGuid(); return command; }
//コンストラクタ public DragDropDecoratorController(IInputModel inputModel, KinectRegion kinectRegion) { _inputModel = inputModel as ManipulatableModel; _kinectRegion = kinectRegion; _dragDropDecorator = inputModel.Element as DragDropDecorator; _inputModel.ManipulationUpdated += inputModel_ManipulationUpdated; }
public IResponseModel FillModel(IInputModel model) { var result = money2WordConvertor.Money2Word(model?.Amount); if (result.HasError) { responseModel.ErrorMessage = result.Word; return(responseModel); } else { responseModel.Amount = result.Word; } var nameValidationResult = nameValidator.Validate(model?.Name); if (nameValidationResult.HasError) { responseModel.ErrorMessage = nameValidationResult.NameResult; } else { responseModel.Name = nameValidationResult.NameResult; } return(responseModel); }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { // Only one controller is instantiated for one Control var model = new ManipulatableModel(inputModel.GestureRecognizer.GestureSettings, this); return(new DragAndDropController(this, model, kinectRegion)); }
//コンストラクタ public DragDropDecoratorController(IInputModel _inputModel, KinectRegion _kinectRegion) { inputModel = _inputModel as ManipulatableModel; kinectRegion = _kinectRegion; dragDropDecorator = _inputModel.Element as DragDropDecorator; inputModel.ManipulationUpdated += inputModel_ManipulationUpdated; }
public KinectV2CustomButtonController(IInputModel inputModel, KinectRegion kinectRegion, EventHandler HandPointerEnter, EventHandler HandPointerLeave) { _inputModel = inputModel as PressableModel; _handPointerEnter = HandPointerEnter; _handPointerLeave = HandPointerLeave; _kinectRegion = kinectRegion; _interactiveElement = _inputModel.Element as KinectV2CustomButton; kinectCoreWindow.PointerMoved += kinectCoreWindow_PointerMoved; }
public DragDropElementController(IInputModel inputModel, KinectRegion kinectRegion) { _inputModel = inputModel as ManipulatableModel; _kinectRegion = kinectRegion; _dragDropElement = _inputModel.Element as DragDropElement; _inputModel.ManipulationStarted += OnManipulationStarted; _inputModel.ManipulationUpdated += OnManipulationUpdated; _inputModel.ManipulationCompleted += OnManipulationCompleted; }
public void SetInputModel(IInputModel model) { if (model is ControllerInputModel) { controller = true; } else { controller = false; } }
// Window1.xaml.btnNewAction.IsEnabled = true; public BasicHandOperationController(IInputModel inputModel, KinectRegion kinectRegion) { this.inputModel = inputModel as ManipulatableModel; this.kinectRegion = kinectRegion; this.myThumb = this.inputModel.Element as MyThumb; this.kinectRegion.GotTouchCapture += testGrab; this.inputModel.ManipulationStarted += InputModel_ManipulationStarted; this.inputModel.ManipulationUpdated += InputModel_ManipulationUpdated; this.inputModel.ManipulationCompleted += InputModel_ManipulationCompleted; }
public IKinectController CreateController( IInputModel inputModel, KinectRegion kinectRegion) { inputModel.GestureRecognizer.GestureSettings = KinectGestureSettings.ManipulationScale | KinectGestureSettings.ManipulationTranslateX | KinectGestureSettings.ManipulationTranslateY; inputModel.GestureRecognizer.ManipulationUpdated += OnManipulationUpdated; return(new ManipulatableController(inputModel)); }
public void Validate(IInputModel <User, long> input) { var i = input as UserInputModel; if (i == null) { throw new NotImplementedException($"Validation is not implemented."); } if (String.IsNullOrWhiteSpace(i.Username)) { throw new InvalidInputException("Username cannot be empty."); } }
public void SetInputModel(IInputModel model) { input = model; usingController = model is ControllerInputModel; if (usingController) { print("Using Controller"); } else { print("Using keyboard & mouse"); } }
public IKinectController CreateController( IInputModel inputModel, KinectRegion kinectRegion) { inputModel.GestureRecognizer.ManipulationStarted += (s, e) => { this.isGripping = true; }; inputModel.GestureRecognizer.ManipulationCompleted += (s, e) => { this.isGripping = false; }; return(new ManipulatableController(inputModel)); }
public DragDropElementController(IInputModel inputModel, KinectRegion kinectRegion) { this._inputModel = inputModel as ManipulatableModel; this._kinectRegion = kinectRegion; var manipulatableModel = this._inputModel; if (manipulatableModel != null) { _dragDropElement = manipulatableModel.Element as DragDropElement; manipulatableModel.ManipulationStarted += InputModel_ManipulationStarted; manipulatableModel.ManipulationUpdated += InputModel_ManipulationUpdated; manipulatableModel.ManipulationCompleted += InputModel_ManipulationCompleted; } }
public static void EnsureIsValid(this IInputModel command) { var errorMesages = command.GetErrorMessages(); if (errorMesages != null && errorMesages.Count() > 0) { string messageToException = ""; foreach (var item in errorMesages) { messageToException += item + "\n"; } throw new ModelValidationException(messageToException); } }
public void Validate(IInputModel <UserRole, long> input) { var i = input as UserRoleInputModel; if (i == null) { throw new NotImplementedException($"Validation is not implemented."); } if (i.UserId <= 0) { throw new InvalidInputException("UserId is invalid."); } if (i.RoleId <= 0) { throw new InvalidInputException("RoleId is invalid."); } }
public InputModelFormatter(IInputModel inputModel) { _modelName = inputModel.GetType().Name; _commandName = inputModel.CommandType.Name; _properties = inputModel .GetType() .GetProperties() .Where(pi => pi.CanWrite) .Select(pi => { var v = pi.GetValue(inputModel, null); return new Property { Name = pi.Name, Type = pi.PropertyType.Name, Value = (v == null) ? string.Empty : pi.GetValue(inputModel, null).ToString(), Choices = pi.PropertyType.IsEnum ? Enum.GetNames(pi.PropertyType) : null, MultiChoice = pi.PropertyType.GetCustomAttributes(typeof(FlagsAttribute), false).Length > 0 }; }) .ToList(); }
public void SetInputModel(IInputModel model) { throw new System.NotImplementedException(); }
public static MvcForm BeginFormForInputModel( this HtmlHelper helper, IInputModel inputModel, bool overrideRedirect = false, string alternateRedirectUrl = "", string formId = null) { if (inputModel == null) { throw new ArgumentNullException("inputModel"); } if (string.IsNullOrEmpty(formId)) { formId = Guid.NewGuid().ToString(); } // jt: we can deduce the AgentSystemName & PartName w/out requiring them to be explicitly set on the inputmodel /* var compositeApp = DependencyResolver.Current.GetService<ICompositeApp>(); var command = compositeApp.GetCommandMetadataForInputModel(inputModel.GetType()); var agentSystemName = command.Type.Assembly.GetAgentMetadata().SystemName; var partName = command.Name; */ var tagBuilder = new TagBuilder("form"); tagBuilder.Attributes.Add("method", "post"); tagBuilder.Attributes.Add("action", PublishCommandRoute); tagBuilder.Attributes.Add("id", formId); tagBuilder.Attributes.Add("encType", "multipart/form-data"); helper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag)); helper.ViewContext.Writer.Write(Environment.NewLine); tagBuilder = new TagBuilder("input"); tagBuilder.Attributes.Add("type", "hidden"); tagBuilder.Attributes.Add("name", "agentSystemName"); tagBuilder.Attributes.Add("value", inputModel.AgentSystemName); tagBuilder.Attributes.Add("id", "inputmodel-agentsystemname"); helper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.SelfClosing)); helper.ViewContext.Writer.Write(Environment.NewLine); tagBuilder = new TagBuilder("input"); tagBuilder.Attributes.Add("type", "hidden"); tagBuilder.Attributes.Add("name", "partName"); tagBuilder.Attributes.Add("value", inputModel.PartName); tagBuilder.Attributes.Add("id", "inputmodel-partname"); helper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.SelfClosing)); helper.ViewContext.Writer.Write(Environment.NewLine); if (string.IsNullOrEmpty(alternateRedirectUrl) || !overrideRedirect) { alternateRedirectUrl = helper.ViewContext.RequestContext.HttpContext.Request.RawUrl; } tagBuilder = new TagBuilder("input"); tagBuilder.Attributes.Add("type", "hidden"); tagBuilder.Attributes.Add("name", "redirectUrl"); tagBuilder.Attributes.Add("value", alternateRedirectUrl); tagBuilder.Attributes.Add("id", "inputmodel-redirectUrl"); helper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.SelfClosing)); helper.ViewContext.Writer.Write(Environment.NewLine); return new MvcForm(helper.ViewContext); }
public ManipulatableController(IInputModel model) { this.model = model; }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return(new KinectV2CustomButtonController(inputModel, kinectRegion, HandPointerEnter, HandPointerLeave)); }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { // Only one controller is instantiated for one Control var model = new ManipulatableModel(inputModel.GestureRecognizer.GestureSettings, this); return new DragAndDropController(this, model, kinectRegion); }
public void Validate(IInputModel <Role, long> input) { throw new NotImplementedException($"Validation is not implemented (ATOW creation of roles was not implemented)."); }
public ActionResult ViewCommand(IInputModel inputModel, ITypeMetadata typeMetadata, string format) { var partCollection = typeMetadata.GetContainingPartCollection(); ViewBag.Title = typeMetadata.Type.Name; ViewBag.Navigation = new FooterLinkModel { AgentSytemName = partCollection.AgentSystemName, PartDescriptiveName = partCollection.DescriptiveName, PartType = typeMetadata.Type.Name }; ActionResult result = View("ViewCommand", inputModel); return result; }
public Response PublishCommand(IInputModel inputModel) { if (inputModel == null) { throw new InvalidOperationException("Input Model was not posted"); } var command = _compositeApp.GetCommandForInputModel(inputModel); var publicationId = _publisher.PublishMessage(command); var redirectUrl = Context.Request.Form["redirectUrl"].Value; return !string.IsNullOrEmpty(redirectUrl) ? new RedirectResponse(redirectUrl) : GetPublicationRecord(publicationId); }
public ContentResult Inspect(IInputModel inputModel) { var command = _transformer.GetCommand(inputModel); return Publish(command); }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return new PressableController(this, new PressableModel(inputModel.GestureRecognizer.GestureSettings, this), kinectRegion); }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return(new PressableController(this, new PressableModel(inputModel.GestureRecognizer.GestureSettings, this), kinectRegion)); }
public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return new DragDropDecoratorController( inputModel, kinectRegion ); }
public ActionResult Inspect(IInputModel inputModel, string commandName, string format) { ActionResult result = View(inputModel); return result; }
//konstruktor public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return(new DragDropElementController(inputModel, kinectRegion)); }
IKinectController IKinectControl.CreateController(IInputModel inputModel, KinectRegion kinectRegion) { return(new BasicHandOperationController(inputModel, kinectRegion)); }