コード例 #1
0
        async void DownloadSceneImages_Click(object sender, EventArgs e)
        {
            var folderPath = UIHelper.FolderSelect("Select folder");

            if (folderPath == null)
            {
                return;
            }

            var scene = _TreeViewScenes.SelectedNode.Tag
                        as ReCapPhotoscene;

            var propsResult = await _reCapClient.GetPhotoscenePropertiesAsync(
                scene.PhotosceneId);

            if (!propsResult.IsOk())
            {
                LogReCapError(propsResult.Error);
                return;
            }

            var files = propsResult.Photoscene.Files;

            if (files != null)
            {
                foreach (var file in files)
                {
                    var fileLinkResponse = await _reCapClient.GetFileLinkAsync(
                        file.FileId);

                    if (!fileLinkResponse.IsOk())
                    {
                        LogReCapError(fileLinkResponse.Error);
                        continue;
                    }

                    AdnFileDownloader fd = new AdnFileDownloader(
                        fileLinkResponse.Files[0].FileLink,
                        System.IO.Path.Combine(folderPath, file.Filename));

                    fd.OnDownloadFileCompleted +=
                        OnDownloadFileCompleted;

                    var res = await fd.DownloadAsync();
                }
            }
        }
        private async Task <ReCapPhotoscene> RetrieveSceneInfo(string photosceneId)
        {
            try
            {
                var scenePropsResponse = await _reCapClient.GetPhotoscenePropertiesAsync(
                    photosceneId);

                if (!scenePropsResponse.IsOk())
                {
                    OnLogReCapError(scenePropsResponse.Error);
                    return(null);
                }

                ReCapPhotoscene scene = scenePropsResponse.Photoscene;

                var sceneProgResponse = await _reCapClient.GetPhotosceneProgressAsync(
                    photosceneId);

                if (!sceneProgResponse.IsOk())
                {
                    OnLogReCapError(sceneProgResponse.Error);
                    return(null);
                }

                double progress    = sceneProgResponse.Photoscene.Progress;
                string progressMsg = sceneProgResponse.Photoscene.ProgressMsg;

                Uri link = null;

                if (progress == 100.0)
                {
                    var sceneLinkResponse = await _reCapClient.GetPhotosceneLinkAsync(
                        scene.PhotosceneId,
                        MeshFormatEnumExtensions.FromString(
                            scene.ConvertFormat));

                    if (!sceneLinkResponse.IsOk())
                    {
                        OnLogReCapError(sceneLinkResponse.Error);
                    }
                    else
                    {
                        link = sceneLinkResponse.Photoscene.SceneLink;
                    }
                }

                return(new ReCapPhotoscene(
                           scene.SceneName,
                           scene.PhotosceneId,
                           progressMsg,
                           progress,
                           link,
                           scene.FileSize,
                           scene.UserId,
                           scene.MeshQuality,
                           scene.ConvertFormat,
                           scene.ConvertStatus,
                           scene.ProcessingTime,
                           scene.Deleted,
                           scene.Files,
                           scene.Nb3dPoints,
                           scene.NbFaces,
                           scene.NbShots,
                           scene.NbStitchedShots,
                           scene.NbVertices));
            }
            catch
            {
                return(null);
            }
        }