Пример #1
0
 // Use this for initialization
 void Start()
 {
     //Display.displays[0].Activate(1024, 768, 70);
     //Display.displays[1].Activate(1280, 1024, 70);
     image.GetComponent <Image>().sprite = GetPhotos.getSprite();
     anotherImage.gameObject.SetActive(false);
 }
Пример #2
0
    public void StartMeasurement()
    {
        float waittime;

        try
        {
            waittime = float.Parse(input.text);
        }catch
        {
            return;
        }
        Invoke("StopMeasurement", waittime);
        anotherImage.gameObject.SetActive(true);
        anotherImage.GetComponent <Image>().sprite = GetPhotos.getSprite();

        fi = new FileInfo(path);

        if (File.Exists(path))
        {
            // 削除
            fi.Delete();
        }

        sw = fi.AppendText();
        sw.WriteLine("unity/unity_Data/Resources/photos/" + GetPhotos.getName() + ".jpg");
        sw.Flush();
        sw.Close();
        recordFlag = true;
    }
Пример #3
0
        private void HandleMessage(MessageRecievedEventArgs message)
        {
            switch (message.Status)
            {
            case MessageTypeEnum.P_SEND:
            case MessageTypeEnum.P_SENDALL:
                GetPhotos?.Invoke(this, message);
                break;

            case MessageTypeEnum.P_DELETE:
                PhotoPackage photo = PhotoPackage.Deserialize(message.Message);
                OnDeletePhoto(this, photo);
                break;

            case MessageTypeEnum.SETTINGS:
                Settings settings = Settings.Deserialize(message.Message);
                SetSettings?.Invoke(this, settings);
                break;

            case MessageTypeEnum.REMOVE_HANDLER:
                OnHandelRemove?.Invoke(this, message.Message);
                break;

            case MessageTypeEnum.L_FAIL:
            case MessageTypeEnum.L_INFO:
            case MessageTypeEnum.L_WARNING:
                OnLogMessage?.Invoke(this, message);
                break;

            default:
                break;
            }
        }
Пример #4
0
        public async Task <IEnumerable <PhotoViewModel> > Handle(GetPhotos request, CancellationToken cancellationToken)
        {
            try
            {
                var photosTask = this.photosApi.GetPhotos(cancellationToken);
                var albumsTask = this.albumsApi.GetAlbums(cancellationToken);

                await Task.WhenAll(photosTask, albumsTask);

                var photos = await photosTask;
                var albums = await albumsTask;

                var photoViewModels = photos.Join(albums,
                                                  p => p.AlbumId,
                                                  a => a.Id,
                                                  (p, a) => new PhotoViewModel()
                {
                    PhotoTitle   = p.Title,
                    AlbumName    = a.Title,
                    ThumbnailUrl = p.ThumbnailUrl,
                    Url          = p.Url
                });

                return(photoViewModels);
            }
            catch (ApiException ex)
            {
                throw new RunpathAlbumWebException("Error communicating with API", ex);
            }
        }
        public async Task Photo_ReturnsAOkObjectResult_WithAPhoto()
        {
            // Arrange
            var request     = TestFactory.CreateHttpRequest();
            var mockService = new Mock <IJsonPlaceholderService>();

            mockService.Setup(serv => serv.GetPhotoById(1)).Returns(Task.FromResult(TestFactory.GetTestPhotos(1)));
            var getPhotos = new GetPhotos(mockService.Object, new NullLoggerFactory());

            // Act
            var response = await getPhotos.Run(request, 1);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var model    = Assert.IsAssignableFrom <Photo>(okResult.Value);
        }