public void ExecutePresentationCommand(string command, string param) { float value = 0; if (param != null && param != "") value = float.Parse(param); switch (command) { case ServiceCommands.CLOSE_IMAGE: CloseCurrentImage(); WarnImagePresentationListeners(); break; case ServiceCommands.CLOSE_PRESENTATION: ClosePresentation(); break; case ServiceCommands.NEXT_SLIDE: NextSlide(); break; case ServiceCommands.PREVIOUS_SLIDE: PreviousSlide(); break; case ServiceCommands.IMAGE_MOVE_X: case ServiceCommands.IMAGE_MOVE_Y: case ServiceCommands.IMAGE_ROTATE: case ServiceCommands.IMAGE_ZOOM: ImageAction action = new ImageAction(command); action.Param = param; ImageCommand(action); break; } }
public Result ImageCommand(ImageAction action) { switch (action.Command) { case ServiceCommands.IMAGE_MOVE_X: case ServiceCommands.IMAGE_MOVE_Y: case ServiceCommands.IMAGE_ROTATE: case ServiceCommands.IMAGE_SET_VISIBLE_PART: case ServiceCommands.IMAGE_ZOOM: if (ImageForm.Executor != null) ImageForm.Executor.BeginInvoke(action.Command, action.Param, null, null); break; case ServiceCommands.CLOSE_IMAGE: CloseCurrentImage(); break; default: WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest; return new Result("wrong command argument option"); } Log("Image Command: " + action.Command); //WarnImagePresentationListeners(); return new Result("Command Executed"); }
public void ImageCommandTest() { Service target = CommonTest.CreateAMockedService(); var imageControlMock = new Mock<IImageService>(); var kinectControlMock = new Mock<IKinectService>(); var fileManagerMock = new Mock<IServiceFileManager>(); Service.ImageForm = imageControlMock.Object; Service.KinectWindow = kinectControlMock.Object; Service.fileManager = fileManagerMock.Object; ImageAction action = new ImageAction(ServiceCommands.IMAGE_ZOOM); target.ImageCommand(action); }