protected async Task <string> CreateReCapPhotoscene(AdskReCap.Format format, AdskReCap.MeshQuality quality) { if (!await ConnectWithReCapServer()) { return(""); } //- Create Photoscene LogInfo(string.Format("Create Photoscene {0} / {1}", format.ToFriendlyString(), quality.ToString()), LogIndent.PostIndent); Dictionary <string, string> options = new Dictionary <string, string> () { { "callback", "email://" + Properties.Settings.Default.x_oauth_user_name } }; if (!await _recap.CreatePhotoscene(/*AdskReCap.Format.OBJ*/ format, /*AdskReCap.MeshQuality.DRAFT*/ quality, options)) { LogError("CreatePhotoscene failed - Failed to create a new Photoscene", LogIndent.PostUnindent); MessageBox.Show("CreatePhotoscene failed - Failed to create a new Photoscene", "WpfReCap", MessageBoxButton.OK, MessageBoxImage.Error); return(""); } dynamic response = _recap.response(); LogInfo(string.Format("CreatePhotoscene succeeded - PhotoSceneID = {0}", response.Photoscene.photosceneid), LogIndent.PostUnindent); return(response.Photoscene.photosceneid); }
protected async Task <string> GetPhotosceneResult(string photosceneid, AdskReCap.Format format = AdskReCap.Format.OBJ, bool bForPreview = false) { if (photosceneid == "" || !await ConnectWithReCapServer()) { return(""); } // Get Photoscene result (mesh) LogInfo("Getting the Photoscene result (mesh)", LogIndent.PostIndent); if (!await _recap.GetPointCloudArchive(photosceneid, format)) { LogError("GetPointCloudArchive failed", LogIndent.PostUnindent); MessageBox.Show("GetPointCloudArchive failed", "WpfReCap", MessageBoxButton.OK, MessageBoxImage.Error); return(""); } dynamic response = _recap.response(); LogInfo(string.Format("GetPhotosceneResult succeeded - {0}", response.Photoscene.scenelink), LogIndent.PostUnindent); if (response.Photoscene.scenelink == "") { // That means there is a conversion happening and we need to wait if (bForPreview) { _forPreview.Add(photosceneid); } _requestedFormat.Add(photosceneid, format); JobProgress jobWnd = new JobProgress(photosceneid); jobWnd.Owner = this; jobWnd._callback = new ProcessPhotosceneCompletedDelegate(this.ConvertPhotosceneCompleted); jobWnd.Show(); return(""); // Return "" to not continue processing the command } return(response.Photoscene.scenelink); }
public void ConvertPhotosceneCompleted(string photosceneid, string status) { if (status == "DONE") { LogInfo(string.Format("Photoscene {0} conversion completed successfully", photosceneid)); // Was it for d/l or Preview? bool bRet = _forPreview.Remove(photosceneid); AdskReCap.Format format = _requestedFormat [photosceneid]; outputFormat.SelectedItem = format.ToString(); MenuItemAutomationPeer menuPeer = new MenuItemAutomationPeer(bRet ? menuPreview : menuDownloadResult); IInvokeProvider invokeProv = menuPeer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } else { LogError(string.Format("Photoscene {0} conversion failed", photosceneid)); MessageBox.Show(string.Format("Photoscene {0} conversion failed", photosceneid), "WpfReCap", MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void PhotoScenes_DownloadResult(object sender, RoutedEventArgs e) { if (e != null) { e.Handled = true; } if (PhotoScenes.SelectedItems.Count != 1) { return; } ReCapPhotosceneProject item = PhotoScenes.SelectedItem as ReCapPhotosceneProject; AdskReCap.Format format = (AdskReCap.Format)((string)outputFormat.SelectedItem).ToReCapFormatEnum(); string link = await GetPhotosceneResult(item.Name, format, e == null); if (link != "") { DownloadReCapResult(item.Name, link, e == null); } }