private void onClick_export() { if (StageManager.GetStageList().Contains(StageManager.Stage_Enum.Gcode_Render) && GcodeRenderManager.GetInstance().GetInfo().isRendered&& StageManager.GetCurStage() != StageManager.Stage_Enum.Gcode_Send) { if (GcodeRenderManager.GetInstance().IsInBounds()) { string path = ModelManager.GetInstance().GetInfo().modelPath; string defaultName = System.IO.Path.GetFileNameWithoutExtension(path); string exportPath = FileDialogManager.GetInstance().ShowFileSaveDialog_Gcode(defaultName); if (string.IsNullOrEmpty(exportPath) || exportPath.Trim().Length == 0) { Debug.LogWarning("Gcode export is empty"); } else { string originPath = GcodeCreateManager.GetInstance().curGcodeBean.gcodePath; startSubThreadToExportGcode(originPath, exportPath); } } else { AlertMananger.GetInstance().ShowAlertMsg("Unable to print. The model goes beyond the work area."); } } }
public static FileDialogManager GetInstance() { if (_INSTANCE == null) { _INSTANCE = new FileDialogManager(); } return(_INSTANCE); }
private void MergeWithSuperSolutions() { string defaultPath = GetDefaultZipPath(); var path = FileDialogManager.SelectPath(defaultPath); path = StringFormatter.GetPathWithLastSlash(path); SetDialog("Merging..."); ThreadManager.Instance.ScheduleTask(() => { var isError = false; var errorMessage = string.Empty; var mappingsWithBackpus = new Dictionary <string, string>(); try { UpdateDialogMessage($"Publishing all customizations..."); CurrentSolutionManager.PublishAll(); List <Solution> affectedSuperSolutions = GetAffectedSuperSolutions(); UpdateDialogMessage($"Cloning affected solutions... ({affectedSuperSolutions.Count})"); mappingsWithBackpus = CloneAffectedSolutions(affectedSuperSolutions); CleanAndMergeSourceSolutions(affectedSuperSolutions, mappingsWithBackpus); RemovedClonedBackupSolutions(affectedSuperSolutions, mappingsWithBackpus); UpdateDialogMessage($"Exporting affected solutions..."); ExportAffectedSuperSolutions(affectedSuperSolutions, path); } catch (Exception ex) { isError = true; errorMessage = ex.Message; } System.Windows.Application.Current.Dispatcher.Invoke(() => { if (isError) { MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { _window.Close(); } UnsetDialog(); }); }, string.Empty, _mergeTaskId); }
/***************** button listener *****************/ private void onClick_open() { string defaultDir = ""; //open Snapmaker3DExampleDir int launchTimes_curVersion = PlayerPrefsManager.GetInstance().GetLaunchTimes_CurVersion(); if (++_clickTimes_openBtn == 1 && launchTimes_curVersion <= 1) { Debug.Log("times_curVersionLaunched :" + launchTimes_curVersion + "\n"); } string modelPath = FileDialogManager.GetInstance().ShowFileSelectDialog_STL_OBJ(defaultDir); if (string.IsNullOrEmpty(modelPath) || modelPath.Length == 0) { Debug.LogWarning("Model path is empty"); } else { GcodeRenderManager.GetInstance().Destroy(); ModelManager.GetInstance().StartSubThread_parseModel(modelPath); } }
private void DownloadSolution() { MessageBox.Show("Select forlder for donwload the solution from de Blobstorage"); string defaultPath = GetDefaultZipPath(); var path = FileDialogManager.SelectPath(defaultPath); path = StringFormatter.GetPathWithLastSlash(path); path = string.Format("{0}{1}", path, SelectedBlob); SetDialog("Downloading..."); ThreadManager.Instance.ScheduleTask(() => { var isError = false; var errorMessage = string.Empty; try { BlobService.Download(SelectedBlob.Name, path); } catch (Exception ex) { isError = true; errorMessage = ex.Message; } System.Windows.Application.Current.Dispatcher.Invoke(() => { if (isError) { MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { this.OutputPath = path; _window.Close(); } UnsetDialog(); }); }, string.Empty, _downloadTaskId); }