void ExportQueueToZipOnIdle(object state) { List <PrintItem> partList = QueueData.Instance.CreateReadOnlyPartList(); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
private void loadFilesIntoLibraryBackgoundWorker_DoWork(IList <string> fileList) { foreach (string loadedFileName in fileList) { string extension = Path.GetExtension(loadedFileName).ToUpper(); if (MeshFileIo.ValidFileExtensions().Contains(extension) || extension == ".GCODE" || extension == ".ZIP") { if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { AddStlOrGcode(this, part.FileLocation, Path.GetExtension(part.FileLocation).ToUpper()); } } } else { AddStlOrGcode(this, loadedFileName, extension); } } } }
void exportQueueButton_Click(object sender, MouseEventArgs mouseEvent) { List <PrintItem> partList = PrintQueueControl.Instance.CreateReadOnlyPartList(); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (MeshFileIo.ValidFileExtensions().Contains(extension) || extension == ".GCODE") { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(droppedFileName), Path.GetFullPath(droppedFileName)))); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(droppedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } } base.OnDragDrop(fileDropEventArgs); }
void AddItemsToQueue(object state) { FileDialog.OpenFileDialog( new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams) { MultiSelect = true, ActionButtonLabel = "Add to Queue", Title = "MatterControl: Select A File" }, (openParams) => { if (openParams.FileNames != null) { foreach (string fileNameToLoad in openParams.FileNames) { if (Path.GetExtension(fileNameToLoad).ToUpper() == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(fileNameToLoad); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } else { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileNameToLoad), Path.GetFullPath(fileNameToLoad)))); } } } }); }
public static void DoAddFiles(List <string> files) { int preAddCount = QueueData.Instance.ItemCount; foreach (string fileToAdd in files) { string extension = Path.GetExtension(fileToAdd).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE") { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileToAdd), Path.GetFullPath(fileToAdd)))); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(fileToAdd); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } } if (QueueData.Instance.ItemCount != preAddCount) { QueueData.Instance.SelectedIndex = QueueData.Instance.ItemCount - 1; } }
public void AddFilesToLibrary(IList <string> files, ReportProgressRatio reportProgress = null) { foreach (string loadedFileName in files) { string extension = Path.GetExtension(loadedFileName).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { AddItem(new PrintItemWrapper(part, this.GetProviderLocator())); } } } else { AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), loadedFileName), this.GetProviderLocator())); } } } }
private void exportQueueButton_Click(object sender, EventArgs mouseEvent) { List <PrintItem> partList = QueueData.Instance.CreateReadOnlyPartList(false); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
public void NewProject(string name) { ProjectFileHandler.CreateProjectDirectories(name); ProjectInfo project = new ProjectInfo() { ProjectName = Path.GetFileNameWithoutExtension(name), MapCounter = 0 }; project.Save(); _project = project; }
void importQueueButton_Click(object sender, MouseEventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } }
void ImportQueueFromZipMenuOnIdle(object state) { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } }
void importQueueButton_Click(object sender, EventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); throw new NotImplementedException(); #if false List <PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } #endif }
void importQueueButton_Click(object sender, MouseEventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { PrintQueueControl.Instance.RemoveAllChildren(); foreach (PrintItem part in partFiles) { PrintQueueControl.Instance.AddChild(new PrintQueueItem(part.Name, part.FileLocation)); } PrintQueueControl.Instance.EnsureSelection(); PrintQueueControl.Instance.Invalidate(); PrintQueueControl.Instance.SaveDefaultQueue(); } }
void ImportQueueFromZipMenuOnIdle(object state) { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { PrintQueueControl.Instance.RemoveAllChildren(); foreach (PrintItem part in partFiles) { PrintQueueControl.Instance.AddChild(new PrintQueueItem(part.Name, part.FileLocation)); } PrintQueueControl.Instance.EnsureSelection(); PrintQueueControl.Instance.Invalidate(); PrintQueueControl.Instance.SaveDefaultQueue(); } }
private void AddItemsToQueue() { FileDialog.OpenFileDialog( new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams) { MultiSelect = true, ActionButtonLabel = "Add to Queue", Title = "MatterControl: Select A File" }, (openParams) => { if (openParams.FileNames != null) { int preAddCount = QueueData.Instance.ItemCount; foreach (string fileNameToLoad in openParams.FileNames) { string extension = Path.GetExtension(fileNameToLoad).ToUpper(); if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List <PrintItem> partFiles = project.ImportFromProjectArchive(fileNameToLoad); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } else if (extension != "" && ApplicationSettings.OpenDesignFileParams.Contains(extension.ToLower())) { // Only add files if they have an extension and if it's in the OpenDesignFileParams list QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileNameToLoad), Path.GetFullPath(fileNameToLoad)))); } } if (QueueData.Instance.ItemCount != preAddCount) { QueueData.Instance.SelectedIndex = QueueData.Instance.ItemCount - 1; } } }); }
void exportQueueButton_Click(object sender, MouseEventArgs mouseEvent) { List<PrintItem> partList = PrintQueueControl.Instance.CreateReadOnlyPartList(); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
private void loadFilesIntoLibraryBackgoundWorker_DoWork(IList<string> fileList) { foreach (string loadedFileName in fileList) { string extension = Path.GetExtension(loadedFileName).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { AddStlOrGcode(this, part.FileLocation, Path.GetExtension(part.FileLocation).ToUpper()); } } } else { AddStlOrGcode(this, loadedFileName, extension); } } } }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (extension == ".STL" || extension == ".GCODE") { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(droppedFileName), Path.GetFullPath(droppedFileName)))); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(droppedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } } base.OnDragDrop(fileDropEventArgs); }
void AddItemsToQueue(object state) { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode;*.zip", multiSelect: true, initialDirectory: documentsPath); openParams.ActionButtonLabel = "Add to Queue"; openParams.Title = "MatterControl: Select A File"; FileDialog.OpenFileDialog(ref openParams); if (openParams.FileNames != null) { foreach (string fileNameToLoad in openParams.FileNames) { if (Path.GetExtension(fileNameToLoad).ToUpper() == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(fileNameToLoad); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } else { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileNameToLoad), Path.GetFullPath(fileNameToLoad)))); } } } }
public void AddFilesToLibrary(IList<string> files, ReportProgressRatio reportProgress = null) { foreach (string loadedFileName in files) { string extension = Path.GetExtension(loadedFileName).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { AddItem(new PrintItemWrapper(part, this.GetProviderLocator())); } } } else { AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), loadedFileName), this.GetProviderLocator())); } } } }
private void exportQueueButton_Click(object sender, EventArgs mouseEvent) { List<PrintItem> partList = QueueData.Instance.CreateReadOnlyPartList(false); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
void ImportQueueFromZipMenuOnIdle(object state) { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { PrintQueueControl.Instance.RemoveAllChildren(); foreach (PrintItem part in partFiles) { PrintQueueControl.Instance.AddChild(new PrintQueueItem(part.Name, part.FileLocation)); } PrintQueueControl.Instance.EnsureSelection(); PrintQueueControl.Instance.Invalidate(); PrintQueueControl.Instance.SaveDefaultQueue(); } }
private void importQueueButton_Click(object sender, EventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); throw new NotImplementedException(); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { int preAddCount = QueueData.Instance.Count; foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (MeshFileIo.ValidFileExtensions().Contains(extension) || extension == ".GCODE") { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(droppedFileName), Path.GetFullPath(droppedFileName)))); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(droppedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } } if (QueueData.Instance.Count != preAddCount) { QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; } base.OnDragDrop(fileDropEventArgs); }
private void ExportQueueToZipOnIdle(object state) { List<PrintItem> partList = QueueData.Instance.CreateReadOnlyPartList(); ProjectFileHandler project = new ProjectFileHandler(partList); project.SaveAs(); }
void importQueueButton_Click(object sender, MouseEventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { PrintQueueControl.Instance.RemoveAllChildren(); foreach (PrintItem part in partFiles) { PrintQueueControl.Instance.AddChild(new PrintQueueItem(part.Name, part.FileLocation)); } PrintQueueControl.Instance.EnsureSelection(); PrintQueueControl.Instance.Invalidate(); PrintQueueControl.Instance.SaveDefaultQueue(); } }
void importQueueButton_Click(object sender, MouseEventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } }
void ImportQueueFromZipMenuOnIdle(object state) { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } }
private void AddItemsToQueue() { FileDialog.OpenFileDialog( new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams) { MultiSelect = true, ActionButtonLabel = "Add to Queue", Title = "MatterControl: Select A File" }, (openParams) => { if (openParams.FileNames != null) { int preAddCount = QueueData.Instance.Count; foreach (string fileNameToLoad in openParams.FileNames) { if (Path.GetExtension(fileNameToLoad).ToUpper() == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(fileNameToLoad); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } else { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileNameToLoad), Path.GetFullPath(fileNameToLoad)))); } } if (QueueData.Instance.Count != preAddCount) { QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; } } }); }
public static void DoAddFiles(List<string> files) { int preAddCount = QueueData.Instance.Count; foreach (string fileToAdd in files) { string extension = Path.GetExtension(fileToAdd).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE") { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(fileToAdd), Path.GetFullPath(fileToAdd)))); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(fileToAdd); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } } } if (QueueData.Instance.Count != preAddCount) { QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; } }
private void loadAndAddPartsToPlate(string[] filesToLoadIncludingZips) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; List<string> filesToLoad = new List<string>(); if (filesToLoadIncludingZips != null && filesToLoadIncludingZips.Length > 0) { for (int i = 0; i < filesToLoadIncludingZips.Length; i++) { string loadedFileName = filesToLoadIncludingZips[i]; string extension = Path.GetExtension(loadedFileName).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension))) { filesToLoad.Add(loadedFileName); } else if (extension == ".ZIP") { ProjectFileHandler project = new ProjectFileHandler(null); List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName); if (partFiles != null) { foreach (PrintItem part in partFiles) { filesToLoad.Add(part.FileLocation); } } } } string progressMessage = "Loading Parts...".Localize(); double ratioPerFile = 1.0 / filesToLoad.Count; double currentRatioDone = 0; for (int i = 0; i < filesToLoad.Count; i++) { string loadedFileName = filesToLoad[i]; List<MeshGroup> loadedMeshGroups = MeshFileIo.Load(Path.GetFullPath(loadedFileName), (double progress0To1, string processingState, out bool continueProcessing) => { continueProcessing = !this.WidgetHasBeenClosed; double ratioAvailable = (ratioPerFile * .5); double currentRatio = currentRatioDone + progress0To1 * ratioAvailable; ReportProgressChanged(currentRatio, progressMessage, out continueProcessing); }); if (WidgetHasBeenClosed) { return; } if (loadedMeshGroups != null) { double ratioPerSubMesh = ratioPerFile / loadedMeshGroups.Count; double subMeshRatioDone = 0; for (int subMeshIndex = 0; subMeshIndex < loadedMeshGroups.Count; subMeshIndex++) { MeshGroup meshGroup = loadedMeshGroups[subMeshIndex]; PlatingHelper.FindPositionForGroupAndAddToPlate(meshGroup, ScaleRotateTranslate.Identity(), asynchPlatingDatas, asynchMeshGroups, asynchMeshGroupTransforms); if (WidgetHasBeenClosed) { return; } PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, asynchMeshGroups.Count - 1, (double progress0To1, string processingState, out bool continueProcessing) => { continueProcessing = !this.WidgetHasBeenClosed; double ratioAvailable = (ratioPerFile * .5); // done outer loop + done this loop +first 1/2 (load)+ this part * ratioAvailable double currentRatio = currentRatioDone + subMeshRatioDone + ratioAvailable + progress0To1 * ratioPerSubMesh; ReportProgressChanged(currentRatio, progressMessage, out continueProcessing); }); subMeshRatioDone += ratioPerSubMesh; } } currentRatioDone += ratioPerFile; } } }
private string GetProjectPath(string name) { return(ProjectFileHandler.GetFormattedUserSpacePath($@"\\projects\\{name}\\{name}.hrms")); }
private void importQueueButton_Click(object sender, EventArgs mouseEvent) { ProjectFileHandler project = new ProjectFileHandler(null); throw new NotImplementedException(); #if false List<PrintItem> partFiles = project.OpenFromDialog(); if (partFiles != null) { foreach (PrintItem part in partFiles) { QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation))); } } #endif }