Esempio n. 1
0
		public override bool SaveFileDialog(SaveFileDialogParams saveParams, SaveFileDialogDelegate callback)
		{
			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
			SaveFileDialogParams SaveFileDialogDialogParams = saveParams;

			SaveFileDialog saveFileDialog1 = new SaveFileDialog();

			saveFileDialog1.InitialDirectory = SaveFileDialogDialogParams.InitialDirectory;
			saveFileDialog1.Filter = saveParams.Filter;
			saveFileDialog1.FilterIndex = saveParams.FilterIndex;
			saveFileDialog1.RestoreDirectory = true;
			saveFileDialog1.AddExtension = true;
			saveFileDialog1.FileName = saveParams.FileName;

			saveFileDialog1.Title = saveParams.Title;
			saveFileDialog1.ShowHelp = false;
			saveFileDialog1.OverwritePrompt = true;
			saveFileDialog1.CheckPathExists = true;
			saveFileDialog1.SupportMultiDottedExtensions = true;
			saveFileDialog1.ValidateNames = false;

			if (saveFileDialog1.ShowDialog() == DialogResult.OK)
			{
				SaveFileDialogDialogParams.FileName = saveFileDialog1.FileName;
			}

			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;

			UiThread.RunOnIdle(() =>
			{
				callback(saveParams);
			});

			return true;
		}
Esempio n. 2
0
        public override bool SaveFileDialog(SaveFileDialogParams saveParams, Action <SaveFileDialogParams> callback)
        {
            ShowFileDialog((fileText) =>
            {
                if (fileText.Length > 2)
                {
                    string[] files       = fileText.Split(';', ' ').Select(f => f.Trim('\"')).ToArray();
                    saveParams.FileName  = files[0];
                    saveParams.FileNames = files;
                }
                UiThread.RunOnIdle(() => callback?.Invoke(saveParams));
            });

            return(true);
        }
Esempio n. 3
0
        public override Stream SaveFileDialog(ref SaveFileDialogParams saveParams)
        {
            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
            SaveFileDialogParams SaveFileDialogDialogParams;
            Stream SaveFileDialogStreamToSaveTo = null;
            SaveFileDialogDialogParams = saveParams;

            Stream myStream = null;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = SaveFileDialogDialogParams.InitialDirectory;
            saveFileDialog1.Filter = saveParams.Filter;
            saveFileDialog1.FilterIndex = saveParams.FilterIndex;
            saveFileDialog1.RestoreDirectory = true;
            saveFileDialog1.AddExtension = true;
            saveFileDialog1.FileName = saveParams.FileName;

            saveFileDialog1.Title = saveParams.Title;
            saveFileDialog1.ShowHelp = false;
            saveFileDialog1.OverwritePrompt = true;
            saveFileDialog1.CheckPathExists = true;
            saveFileDialog1.SupportMultiDottedExtensions = true;
            saveFileDialog1.ValidateNames = false;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = saveFileDialog1.OpenFile()) != null)
                    {
                        SaveFileDialogDialogParams.FileName = saveFileDialog1.FileName;
                        SaveFileDialogStreamToSaveTo = myStream;
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show("Error: Could not create file for saving. Original error: " + ex.Message);
                }
            }

            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;
            return SaveFileDialogStreamToSaveTo;
        }
Esempio n. 4
0
		public static bool SaveFileDialog(SaveFileDialogParams saveParams, FileDialogCreator.SaveFileDialogDelegate callback)
		{
			return FileDialogCreatorPlugin.SaveFileDialog(saveParams, (SaveFileDialogParams outputSaveParams) =>
				{
					try
					{
						if (outputSaveParams.FileName != "")
						{
							string directory = Path.GetDirectoryName(outputSaveParams.FileName);
							if (directory != null && directory != "")
							{
								lastDirectoryUsed = directory;
							}
						}
					}
					catch (Exception)
					{
					}
					callback(outputSaveParams);
				}
			);
		}
Esempio n. 5
0
 public static bool SaveFileDialog(SaveFileDialogParams saveParams, FileDialogCreator.SaveFileDialogDelegate callback)
 {
     return(FileDialogCreatorPlugin.SaveFileDialog(saveParams, (SaveFileDialogParams outputSaveParams) =>
     {
         try
         {
             if (outputSaveParams.FileName != "")
             {
                 string directory = Path.GetDirectoryName(outputSaveParams.FileName);
                 if (directory != null && directory != "")
                 {
                     lastDirectoryUsed = directory;
                 }
             }
         }
         catch (Exception)
         {
         }
         callback(outputSaveParams);
     }
                                                   ));
 }
 public static bool SaveFileDialog(SaveFileDialogParams saveParams, Action <SaveFileDialogParams> callback)
 {
     return(FileDialogCreatorPlugin.SaveFileDialog(saveParams, (SaveFileDialogParams outputSaveParams) =>
     {
         try
         {
             if (outputSaveParams.FileName != "")
             {
                 string directory = Path.GetDirectoryName(outputSaveParams.FileName);
                 if (directory != null && directory != "")
                 {
                     lastDirectoryUsed = directory;
                 }
             }
         }
         catch (Exception e)
         {
             Debug.Print(e.Message);
             GuiWidget.BreakInDebugger();
         }
         callback(outputSaveParams);
     }
                                                   ));
 }
Esempio n. 7
0
 public static Stream SaveFileDialog(ref SaveFileDialogParams saveParams)
 {
     return FileDialogCreatorPlugin.SaveFileDialog(ref saveParams);
 }
Esempio n. 8
0
		public abstract bool SaveFileDialog(SaveFileDialogParams saveParams, SaveFileDialogDelegate callback);
		private void SaveStl(SaveFileDialogParams saveParams)
		{
			try
			{
				if (!string.IsNullOrEmpty(saveParams.FileName))
				{
					string filePathToSave = saveParams.FileName;
					if (filePathToSave != null && filePathToSave != "")
					{
						string extension = Path.GetExtension(filePathToSave);
						if (extension == "")
						{
							File.Delete(filePathToSave);
							filePathToSave += ".stl";
						}
						if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == Path.GetExtension(filePathToSave).ToUpper())
						{
							File.Copy(printItemWrapper.FileLocation, filePathToSave, true);
						}
						else
						{
							List<MeshGroup> meshGroups = MeshFileIo.Load(printItemWrapper.FileLocation);
							MeshFileIo.Save(meshGroups, filePathToSave);
						}
						ShowFileIfRequested(filePathToSave);
					}
				}
			}
			catch
			{
			}
		}
		private void exportSTL_Click(object sender, EventArgs mouseEvent)
		{
			UiThread.RunOnIdle(() =>
			{
				SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as STL|*.stl");
				saveParams.Title = "MatterControl: Export File";
				saveParams.ActionButtonLabel = "Export";
				saveParams.FileName = printItemWrapper.Name;

				Close();
				FileDialog.SaveFileDialog(saveParams, onExportStlFileSelected);
			});
		}
		private void onExportGcodeFileSelected(SaveFileDialogParams saveParams)
		{
			if (!string.IsNullOrEmpty(saveParams.FileName))
			{
				ExportGcodeCommandLineUtility(saveParams.FileName);
			}
		}
Esempio n. 12
0
		private void onExportLogFileSelected(SaveFileDialogParams saveParams)
		{
			if (saveParams.FileName != null)
			{
				string filePathToSave = saveParams.FileName;
				if (filePathToSave != null && filePathToSave != "")
				{
					try
					{
						textScrollWidget.WriteToFile(filePathToSave);
					}
					catch(UnauthorizedAccessException e)
					{
						PrinterOutputCache.Instance.PrinterLines.Add("");
						PrinterOutputCache.Instance.PrinterLines.Add(writeFaildeWaring);
						PrinterOutputCache.Instance.PrinterLines.Add(cantAccessPath.FormatWith(filePathToSave));
						PrinterOutputCache.Instance.PrinterLines.Add("");
					}
				}
			}
		}
		private void SaveAs()
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Slice Preset|*." + configFileExtension);
			saveParams.FileName = presetNameInput.Text;

			FileDialog.SaveFileDialog(saveParams, onSaveFileSelected);
		}
Esempio n. 14
0
		public void SaveAs()
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Slice Configuration".Localize() + "|*." + configFileExtension);
			saveParams.FileName = "default_settings.ini";
			FileDialog.SaveFileDialog(saveParams, onExportFileSelected);
		}
        //Opens Save file dialog and outputs current queue as a project
        public void SaveAs()
        {
			string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.zip", initialDirectory: documentsPath);

            System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams);
            if (streamToSaveTo != null)
            {
                streamToSaveTo.Close();
                ExportToProjectArchive(saveParams.FileName);
            }
        }
 public abstract bool SaveFileDialog(SaveFileDialogParams saveParams, Action <SaveFileDialogParams> callback);
		private void SaveStl(SaveFileDialogParams saveParams)
		{
			try
			{
				if (!string.IsNullOrEmpty(saveParams.FileName))
				{
					string filePathToSave = saveParams.FileName;
					if (filePathToSave != null && filePathToSave != "")
					{
						string extension = Path.GetExtension(filePathToSave);
						if (extension == "")
						{
							File.Delete(filePathToSave);
							filePathToSave += ".stl";
						}
						if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == Path.GetExtension(filePathToSave).ToUpper())
						{
							File.Copy(printItemWrapper.FileLocation, filePathToSave, true);
						}
						else
						{
							List<MeshGroup> meshGroups = MeshFileIo.Load(printItemWrapper.FileLocation);
							if (!MeshFileIo.Save(meshGroups, filePathToSave))
							{
								UiThread.RunOnIdle (() => {
									StyledMessageBox.ShowMessageBox(null, "AMF to STL conversion failed", "Couldn't save file".Localize());
								});
							}
						}
						ShowFileIfRequested(filePathToSave);
					}
				}
			}
			catch (Exception e)
			{
				UiThread.RunOnIdle (() => {
					StyledMessageBox.ShowMessageBox(null, e.Message, "Couldn't save file".Localize());
				});

			}
		}
Esempio n. 18
0
 public abstract Stream SaveFileDialog(ref SaveFileDialogParams saveParams);
Esempio n. 19
0
		private void onExportFileSelected(SaveFileDialogParams saveParams)
		{
			if (!string.IsNullOrEmpty(saveParams.FileName))
			{
				GenerateConfigFile(saveParams.FileName, false);
			}
		}
		private void onSaveFileSelected(SaveFileDialogParams saveParams)
		{
			if (saveParams.FileName != null)
			{
				GenerateConfigFile(saveParams.FileName);
			}
		}
        public void SaveAs()
        //Opens Save file dialog and outputs current queue as a project
        {
			string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.mcp", initialDirectory: documentsPath);

            System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams);
            if (streamToSaveTo != null)
            {
                streamToSaveTo.Close();
                ExportToJson(saveParams.FileName);
            }
        }
Esempio n. 22
0
		private void DoExportExportLog_Click()
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as Text|*.txt");
			saveParams.Title = "MatterControl: Terminal Log";
			saveParams.ActionButtonLabel = "Export";
			saveParams.FileName = "print_log.txt";

			FileDialog.SaveFileDialog(saveParams, onExportLogFileSelected);
		}
		private void onExportGcodeFileSelected(SaveFileDialogParams saveParams)
		{

			if (saveParams.FileName != null)
			{

                ExportGcodeCommandLineUtility(saveParams.FileName);
         
			}
		}
		private void ExportGCode_Click()
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", title: "Export GCode");
			saveParams.Title = "MatterControl: Export File";
			saveParams.ActionButtonLabel = "Export";
			saveParams.FileName = Path.GetFileNameWithoutExtension(printItemWrapper.Name);

			Close();
			FileDialog.SaveFileDialog(saveParams, onExportGcodeFileSelected);
		}
		private void ExportX3G_Click(object state)
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Export X3G|*.x3g", title: "Export X3G");
			saveParams.Title = "MatterControl: Export File";
			saveParams.ActionButtonLabel = "Export";

			FileDialog.SaveFileDialog(saveParams, onExportX3gFileSelected);
		}
		private void exportAMF_Click(object sender, EventArgs mouseEvent)
		{
			UiThread.RunOnIdle(() =>
			{
				SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as AMF|*.amf", initialDirectory: documentsPath);
				saveParams.Title = "MatterControl: Export File";
				saveParams.ActionButtonLabel = "Export";
				saveParams.FileName = printItemWrapper.Name;

				Close();
				FileDialog.SaveFileDialog(saveParams, onExportAmfFileSelected);
			});
		}
Esempio n. 27
0
		//Opens Save file dialog and outputs current queue as a project
		public void SaveAs()
		{
			SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.zip");

			FileDialog.SaveFileDialog(saveParams, onSaveFileSelected);
		}
		private async void onExportStlFileSelected(SaveFileDialogParams saveParams)
		{
			await Task.Run(() => SaveStl(saveParams));
		}
		public void CreateWindowContent()
		{
			this.RemoveAllChildren();
			TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
			FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
			topToBottom.AnchorAll();

			// Creates Header
			FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			//Creates Text and adds into header
			{
				TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14);
				elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				elementHeader.HAnchor = HAnchor.ParentLeftRight;
				elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;

				headerRow.AddChild(elementHeader);
				topToBottom.AddChild(headerRow);
			}

			// Creates container in the middle of window
			FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				middleRowContainer.HAnchor = HAnchor.ParentLeftRight;
				middleRowContainer.VAnchor = VAnchor.ParentBottomTop;
				middleRowContainer.Padding = new BorderDouble(5);
				middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			}

			if (!partIsGCode)
			{
				string exportStlText = LocalizedString.Get("Export as");
				string exportStlTextFull = string.Format("{0} STL", exportStlText);

				Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
				exportAsStlButton.HAnchor = HAnchor.ParentLeft;
				exportAsStlButton.Cursor = Cursors.Hand;
				exportAsStlButton.Click += new EventHandler(exportSTL_Click);
				middleRowContainer.AddChild(exportAsStlButton);
			}

			if (!partIsGCode)
			{
				string exportAmfText = LocalizedString.Get("Export as");
				string exportAmfTextFull = string.Format("{0} AMF", exportAmfText);

				Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull);
				exportAsAmfButton.HAnchor = HAnchor.ParentLeft;
				exportAsAmfButton.Cursor = Cursors.Hand;
				exportAsAmfButton.Click += new EventHandler(exportAMF_Click);
				middleRowContainer.AddChild(exportAsAmfButton);
			}

			bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;
			if (showExportGCodeButton)
			{
				string exportGCodeText = LocalizedString.Get("Export as");
				string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);
				Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);
				exportGCode.HAnchor = HAnchor.ParentLeft;
				exportGCode.Cursor = Cursors.Hand;
				exportGCode.Click += new EventHandler((object sender, EventArgs e) =>
				{
					UiThread.RunOnIdle(ExportGCode_Click);
				});
				middleRowContainer.AddChild(exportGCode);

                PluginFinder<ExportGcodePlugin> exportPluginFinder = new PluginFinder<ExportGcodePlugin>();
                
                foreach (ExportGcodePlugin plugin in exportPluginFinder.Plugins)
                {
                    //Create export button for each Plugin found

                    string exportButtonText = plugin.getButtonText().Localize();
                    Button exportButton = textImageButtonFactory.Generate(exportButtonText);
                    exportButton.HAnchor = HAnchor.ParentLeft;
                    exportButton.Cursor = Cursors.Hand;
                    exportButton.Click += new EventHandler((object sender, EventArgs e) =>
                    {
                        SaveFileDialogParams saveParams = new SaveFileDialogParams(plugin.getExtensionFilter(), title: plugin.getButtonText());
                        saveParams.Title = "MatterControl: Export File";
                        saveParams.ActionButtonLabel = "Export";                        
                        FileDialog.SaveFileDialog(saveParams, delegate(SaveFileDialogParams saveParam)
                        {

                            string extension = Path.GetExtension(saveParam.FileName);
                            if (extension == "")
                            {
                                saveParam.FileName += plugin.getFileExtension();
                            }

                            if (partIsGCode)
                            {
                                Close();
                                plugin.generate(printItemWrapper.FileLocation, saveParam.FileName);
                            }
                            else
                            {
                                Close();
                                SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
                                printItemWrapper.SlicingDone += new EventHandler((object slicingCompleteSender, EventArgs slicingEventArgs) =>
                                {
                                    PrintItemWrapper sliceItem = (PrintItemWrapper)slicingCompleteSender;
                                    if (File.Exists(sliceItem.GetGCodePathAndFileName()))
                                    {
                                        plugin.generate(sliceItem.GetGCodePathAndFileName(), saveParam.FileName);
                                    }
                                });//End SlicingDone Event handler
                            }
                        });//End SaveFileDialog delegate               

                    });//End Click Event handler
                    middleRowContainer.AddChild(exportButton);

                }

                //bool showExportX3GButton = ActivePrinterProfile.Instance.ActivePrinter.DriverType == "X3G";
                bool showExportX3GButton = false;
				if (showExportX3GButton)
				{
					string exportAsX3GText = "Export as X3G".Localize();
					Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText);
					exportAsX3G.HAnchor = HAnchor.ParentLeft;
					exportAsX3G.Cursor = Cursors.Hand;
					exportAsX3G.Click += new EventHandler((object sender, EventArgs e) =>
						{
							UiThread.RunOnIdle(ExportX3G_Click);
						});
					middleRowContainer.AddChild(exportAsX3G);
				}
			}

			middleRowContainer.AddChild(new VerticalSpacer());

			// If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked.
			if (showExportGCodeButton && ActivePrinterProfile.Instance.DoPrintLeveling)
			{
				applyLeveling = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10);
				applyLeveling.Checked = true;
				applyLeveling.HAnchor = HAnchor.ParentLeft;
				applyLeveling.Cursor = Cursors.Hand;
				//applyLeveling.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(applyLeveling);
			}

			// TODO: make this work on the mac and then delete this if
			if (OsInformation.OperatingSystem == OSType.Windows
				|| OsInformation.OperatingSystem == OSType.X11)
			{
				showInFolderAfterSave = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
				showInFolderAfterSave.HAnchor = HAnchor.ParentLeft;
				showInFolderAfterSave.Cursor = Cursors.Hand;
				//showInFolderAfterSave.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(showInFolderAfterSave);
			}

			if (!showExportGCodeButton)
			{
				string noGCodeMessageTextBeg = LocalizedString.Get("Note");
				string noGCodeMessageTextEnd = LocalizedString.Get("To enable GCode export, select a printer profile.");
				string noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
				TextWidget noGCodeMessage = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
				noGCodeMessage.HAnchor = HAnchor.ParentLeft;
				middleRowContainer.AddChild(noGCodeMessage);
			}

			//Creates button container on the bottom of window
			FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			{
				BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
				buttonRow.HAnchor = HAnchor.ParentLeftRight;
				buttonRow.Padding = new BorderDouble(0, 3);
			}

			Button cancelButton = textImageButtonFactory.Generate("Cancel");
			cancelButton.Name = "Export Item Window Cancel Button";
			cancelButton.Cursor = Cursors.Hand;
			cancelButton.Click += (sender, e) =>
			{
				CloseOnIdle();
			};

			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(cancelButton);
			topToBottom.AddChild(middleRowContainer);
			topToBottom.AddChild(buttonRow);

			this.AddChild(topToBottom);
		}
        void createPatrsSheetsButton_Click(object sender, MouseEventArgs mouseEvent)
        {
            List<PrintItem> parts = PrintQueueControl.Instance.CreateReadOnlyPartList();

            SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf");

            System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams);
            if (streamToSaveTo != null)
            {
				string partFileName = saveParams.FileName;

				if ( !partFileName.StartsWith ("" + Path.DirectorySeparatorChar) )
				{
					partFileName = Path.DirectorySeparatorChar + partFileName;
				}

				PartsSheet currentPartsInQueue = new PartsSheet(parts, partFileName);
                currentPartsInQueue.SaveSheets();
            }
        }
Esempio n. 31
0
 public abstract bool SaveFileDialog(SaveFileDialogParams saveParams, SaveFileDialogDelegate callback);
		private void onExportX3gFileSelected(SaveFileDialogParams saveParams)
		{
			if (saveParams.FileName != null)
			{
				x3gPathAndFilenameToSave = saveParams.FileName;
				string extension = Path.GetExtension(x3gPathAndFilenameToSave);
				if (extension == "")
				{
					File.Delete(gcodePathAndFilenameToSave);
					x3gPathAndFilenameToSave += ".x3g";
				}

				string saveExtension = Path.GetExtension(printItemWrapper.FileLocation).ToUpper();
				if (MeshFileIo.ValidFileExtensions().Contains(saveExtension))
				{
					Close();
					SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
					printItemWrapper.SlicingDone.RegisterEvent(x3gItemSlice_Complete, ref unregisterEvents);
				}
				else if (partIsGCode)
				{
					Close();
					generateX3GfromGcode(printItemWrapper.FileLocation, x3gPathAndFilenameToSave);
				}
			}
		}
		private void onSaveFileSelected(SaveFileDialogParams saveParams)
		{
			if (saveParams.FileName != null)
			{
				ExportToProjectArchive(saveParams.FileName);
			}
		}
Esempio n. 34
0
		private void onSaveFileSelected(SaveFileDialogParams saveParams)
		{
			if (!string.IsNullOrEmpty(saveParams.FileName))
			{
				ExportToProjectArchive(saveParams.FileName);
			}
		}
		private void onExportStlFileSelected(SaveFileDialogParams saveParams)
		{
			BackgroundWorker saveWorker = new BackgroundWorker();
			saveWorker.DoWork += stlSaveWorker_DoWork;
			saveWorker.RunWorkerAsync(saveParams);
		}