コード例 #1
0
		public override bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback)
		{
			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
			openParams.FileName = "";
			openParams.FileNames = null;

			OpenFileDialog openFileDialog1 = new OpenFileDialog();

			openFileDialog1.InitialDirectory = openParams.InitialDirectory;
			openFileDialog1.Filter = openParams.Filter;
			openFileDialog1.Multiselect = openParams.MultiSelect;
			openFileDialog1.Title = openParams.Title;

			openFileDialog1.FilterIndex = openParams.FilterIndex;
			openFileDialog1.RestoreDirectory = true;

			if (openFileDialog1.ShowDialog() == DialogResult.OK)
			{
				openParams.FileNames = openFileDialog1.FileNames;
				openParams.FileName = openFileDialog1.FileName;
			}

			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;

			UiThread.RunOnIdle((state) =>
			{
				OpenFileDialogParams openParamsIn = state as OpenFileDialogParams;
				if (openParamsIn != null)
				{
					callback(openParamsIn);
				}
			}, openParams);
			return true;
		}
コード例 #2
0
        public override bool OpenFileDialog(OpenFileDialogParams openParams, Action <OpenFileDialogParams> callback)
        {
            ShowFileDialog((fileText) =>
            {
                if (fileText.Length > 2)
                {
                    string[] files       = fileText.Split(';', ' ').Select(f => f.Trim('\"')).ToArray();
                    openParams.FileName  = files[0];
                    openParams.FileNames = files;
                }
                UiThread.RunOnIdle(() => callback?.Invoke(openParams));
            });

            return(true);
        }
コード例 #3
0
ファイル: FileDialog.cs プロジェクト: asmboom/PixelFarm
 public static bool OpenFileDialog(OpenFileDialogParams openParams, FileDialogCreator.OpenFileDialogDelegate callback)
 {
     return(FileDialogCreatorPlugin.OpenFileDialog(openParams, (OpenFileDialogParams outputOpenParams) =>
     {
         try
         {
             if (outputOpenParams.FileName != "")
             {
                 string directory = Path.GetDirectoryName(outputOpenParams.FileName);
                 if (directory != null && directory != "")
                 {
                     lastDirectoryUsed = directory;
                 }
             }
         }
         catch (Exception)
         {
         }
         callback(outputOpenParams);
     }
                                                   ));
 }
コード例 #4
0
ファイル: FileDialog.cs プロジェクト: CNCBrasil/agg-sharp
		public static bool OpenFileDialog(OpenFileDialogParams openParams, FileDialogCreator.OpenFileDialogDelegate callback)
		{
			return FileDialogCreatorPlugin.OpenFileDialog(openParams, (OpenFileDialogParams outputOpenParams) =>
				{
					try
					{
						if (outputOpenParams.FileName != "")
						{
							string directory = Path.GetDirectoryName(outputOpenParams.FileName);
							if (directory != null && directory != "")
							{
								lastDirectoryUsed = directory;
							}
						}
					}
					catch (Exception)
					{
					}
					callback(outputOpenParams);
				}
			);
		}
コード例 #5
0
ファイル: FileDialogPlugin.cs プロジェクト: jeske/agg-sharp
        public override Stream OpenFileDialog(ref OpenFileDialogParams openParams)
        {
            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
            openParams.FileName = "";
            openParams.FileNames = null;
            Stream myStream = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = openParams.InitialDirectory;
            openFileDialog1.Filter = openParams.Filter;
            openFileDialog1.Multiselect = openParams.MultiSelect;
            openFileDialog1.Title = openParams.Title;

            openFileDialog1.FilterIndex = openParams.FilterIndex;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    openParams.FileNames = openFileDialog1.FileNames;
                    if ((myStream = openFileDialog1.OpenFile()) != null && !openParams.MultiSelect)
                    {
                        openParams.FileName = openFileDialog1.FileName;
                        WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;
                        return myStream;
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }
            }

            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;
            return null;
        }
コード例 #6
0
ファイル: FileDialog.cs プロジェクト: glocklueng/agg-sharp
		public static bool OpenFileDialog(OpenFileDialogParams openParams, FileDialogCreator.OpenFileDialogDelegate callback)
		{
			return FileDialogCreatorPlugin.OpenFileDialog(openParams, (OpenFileDialogParams outputOpenParams) =>
				{
					try
					{
						if (outputOpenParams.FileName != "")
						{
							string directory = Path.GetDirectoryName(outputOpenParams.FileName);
							if (directory != null && directory != "")
							{
								lastDirectoryUsed = directory;
							}
						}
					}
					catch (Exception e)
					{
						Debug.Print(e.Message);
						GuiWidget.BreakInDebugger();
					}
					callback(outputOpenParams);
				}
			);
		}
コード例 #7
0
 public static bool OpenFileDialog(OpenFileDialogParams openParams, Action <OpenFileDialogParams> callback)
 {
     return(FileDialogCreatorPlugin.OpenFileDialog(openParams, (OpenFileDialogParams outputOpenParams) =>
     {
         try
         {
             if (outputOpenParams.FileName != "")
             {
                 string directory = Path.GetDirectoryName(outputOpenParams.FileName);
                 if (directory != null && directory != "")
                 {
                     lastDirectoryUsed = directory;
                 }
             }
         }
         catch (Exception e)
         {
             Debug.Print(e.Message);
             GuiWidget.BreakInDebugger();
         }
         callback(outputOpenParams);
     }
                                                   ));
 }
コード例 #8
0
        void loadFile_ClickOnIdle(object state)
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true);
            FileDialog.OpenFileDialog(ref openParams);
            if (openParams.FileNames != null)
            {
                foreach (string loadedFileName in openParams.FileNames)
                {
                    PrintItem printItem = new PrintItem();
                    printItem.Name = Path.GetFileNameWithoutExtension(loadedFileName);
                    printItem.FileLocation = Path.GetFullPath(loadedFileName);
                    printItem.PrintItemCollectionID = LibraryData.Instance.LibraryCollection.Id;
                    printItem.Commit();

                    LibraryData.Instance.AddItem(new PrintItemWrapper(printItem));
                }
            }
        }
コード例 #9
0
ファイル: FileDialog.cs プロジェクト: CNCBrasil/agg-sharp
		public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);
コード例 #10
0
        void LoadFileOnIdle(object state)
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true);
			openParams.ActionButtonLabel = "Add to Queue";
			openParams.Title = "MatterControl: Select A File";

            FileDialog.OpenFileDialog(ref openParams);
            if (openParams.FileNames != null)
            {
                foreach (string loadedFileName in openParams.FileNames)
                {
					PrintQueueItem queueItem = new PrintQueueItem(System.IO.Path.GetFileNameWithoutExtension(loadedFileName), System.IO.Path.GetFullPath(loadedFileName));
					PrintQueueControl.Instance.AddChild(queueItem);
                }
                if (PrintQueueControl.Instance.Count > 0)
                {
                    PrintQueueControl.Instance.SelectedIndex = PrintQueueControl.Instance.Count - 1;
                }
                //PrintQueueControl.Instance.EnsureSelection();
                PrintQueueControl.Instance.Invalidate();
            }
            PrintQueueControl.Instance.SaveDefaultQueue();
        }
コード例 #11
0
		private void importToLibraryloadFile_ClickOnIdle()
		{
			OpenFileDialogParams openParams = new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams, multiSelect: true);
			FileDialog.OpenFileDialog(openParams, onLibraryLoadFileSelected);
		}
コード例 #12
0
        void openFileButton_ButtonClick(object sender, MouseEventArgs mouseEvent)
        {
            UiThread.RunOnIdle((state) =>
                {
                    OpenFileDialogParams openParams = new OpenFileDialogParams("gcode files|*.gcode");
                    Stream streamToLoadFrom = FileDialog.OpenFileDialog(ref openParams);

                    if (openParams.FileName != null && openParams.FileName != "")
                    {
                        gCodeViewWidget.Load(openParams.FileName);
                        currentLayerIndex.Value = 0;
                        currentLayerIndex.MaxValue = gCodeViewWidget.LoadedGCode.NumChangesInZ;
                    }

                    Invalidate();
                });
        }
コード例 #13
0
		private void importPresets_Click(object sender, EventArgs mouseEvent)
		{
			OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Preset|*.slice;*.ini");
			openParams.ActionButtonLabel = "Load Slice Preset";
			openParams.Title = "MatterControl: Select A File";

			FileDialog.OpenFileDialog(openParams, onLoadPreset);
		}
コード例 #14
0
		private void onProjectArchiveLoad(OpenFileDialogParams openParams)
		{
			List<PrintItem> partFiles;
			if (openParams.FileNames != null)
			{
				string loadedFileName = openParams.FileName;
				partFiles = ImportFromProjectArchive(loadedFileName);
				if (partFiles != null)
				{
					foreach (PrintItem part in partFiles)
					{
						QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation)));
					}
				}
			}
		}
コード例 #15
0
ファイル: FileDialog.cs プロジェクト: jeske/agg-sharp
 public static Stream OpenFileDialog(ref OpenFileDialogParams openParams)
 {
     return FileDialogCreatorPlugin.OpenFileDialog(ref openParams);
 }
コード例 #16
0
        void createDiscreteMeshesBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // remove the original mesh and replace it with these new meshes
            PullMeshDataFromAsynchLists();

            UnlockEditControls();

            autoArrangeButton.Visible = true;
            viewControls3D.partSelectButton.ClickButton(null);

            Invalidate();

            if (OpenAddDialogWhenDone)
            {
                OpenAddDialogWhenDone = false;
                OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true);

                FileDialog.OpenFileDialog(ref openParams);
                LoadAndAddPartsToPlate(openParams.FileNames);
            }

            if (pendingPartsToLoad.Count > 0)
            {
                LoadAndAddPartsToPlate(pendingPartsToLoad.ToArray());
            }
        }
コード例 #17
0
		private void onManifestFileLoad(OpenFileDialogParams openParams)
		{
			if (openParams.FileName != null)
			{
				string loadedFileName = openParams.FileName;
				List<PrintItem> printItems = ImportFromJson(loadedFileName);
			}
		}
コード例 #18
0
		public void OpenFromDialog()
		{
			OpenFileDialogParams openParams = new OpenFileDialogParams("Select a Project file|*.mcp");
			FileDialog.OpenFileDialog(openParams, onManifestFileLoad);
		}
コード例 #19
0
		private void onPresetLoad(OpenFileDialogParams openParams)
		{
			if (openParams.FileNames != null)
			{
				SliceSettingsCollection settingsCollection;
				try
				{
					if (File.Exists(openParams.FileName))
					{
						// TODO: Review bindings to int printerID
						int printerID;
						int.TryParse(ActiveSliceSettings.Instance.Id, out printerID);

						//Create collection to hold preset settings
						settingsCollection = new SliceSettingsCollection();
						settingsCollection.Tag = windowController.filterTag;
						settingsCollection.PrinterId = printerID;
						settingsCollection.Name = System.IO.Path.GetFileNameWithoutExtension(openParams.FileName);
						settingsCollection.Commit();

						string[] lines = System.IO.File.ReadAllLines(openParams.FileName);
						foreach (string line in lines)
						{
							//Ignore commented lines
							if (!line.StartsWith("#"))
							{
								string[] settingLine = line.Split('=');
								string keyName = settingLine[0].Trim();
								string settingDefaultValue = settingLine[1].Trim();

								//To do - validate imported settings as valid (KP)
								SliceSetting sliceSetting = new SliceSetting();
								sliceSetting.Name = keyName;
								sliceSetting.Value = settingDefaultValue;
								sliceSetting.SettingsCollectionId = settingsCollection.Id;
								sliceSetting.Commit();
							}
						}
						windowController.ChangeToSlicePresetList();
					}
				}
				catch (Exception)
				{
					// Error loading configuration
				}
			}
		}
コード例 #20
0
		private void importPresetDo()
		{
			OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Preset|*.slice;*.ini");
			openParams.ActionButtonLabel = "Load Slice Preset";
			openParams.Title = "MatterControl: Select A File";

			FileDialog.OpenFileDialog(openParams, onPresetLoad);
		}
コード例 #21
0
        public List<PrintItem> OpenFromDialog()
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("Select a Project file|*.mcp");

            System.IO.Stream streamToLoadFrom = FileDialog.OpenFileDialog(ref openParams);
            if (streamToLoadFrom != null)
            {
                string loadedFileName = openParams.FileName;
                return ImportFromJson(loadedFileName);
            }
            else
            {
                return null;
            }
        }
コード例 #22
0
ファイル: FileDialog.cs プロジェクト: asmboom/PixelFarm
 public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);
コード例 #23
0
ファイル: FileDialog.cs プロジェクト: jeske/agg-sharp
 public abstract Stream OpenFileDialog(ref OpenFileDialogParams openParams);
コード例 #24
0
        bool importFile_Click()
        {
            UiThread.RunOnIdle((state) =>
            {  
                OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true);
                openParams.ActionButtonLabel = "Add to Queue";
                openParams.Title = "MatterControl: Select A File";

                FileDialog.OpenFileDialog(ref openParams);
                if (openParams.FileNames != null)
                {
                    foreach (string loadedFileName in openParams.FileNames)
                    {
                        QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
                    }
                }
            });
            return true;
        }
コード例 #25
0
 public abstract bool OpenFileDialog(OpenFileDialogParams openParams, Action <OpenFileDialogParams> callback);
コード例 #26
0
		private void onLoadPreset(OpenFileDialogParams openParams)
		{
			if (openParams.FileNames != null)
			{
				Dictionary<string, DataStorage.SliceSetting> settingsDictionary = new Dictionary<string, DataStorage.SliceSetting>();
				try
				{
					if (File.Exists(openParams.FileName))
					{
						string[] lines = System.IO.File.ReadAllLines(openParams.FileName);
						foreach (string line in lines)
						{
							//Ignore commented lines
							if (!line.StartsWith("#"))
							{
								string[] settingLine = line.Split('=');
								string keyName = settingLine[0].Trim();
								string settingDefaultValue = settingLine[1].Trim();

								DataStorage.SliceSetting sliceSetting = new DataStorage.SliceSetting();
								sliceSetting.Name = keyName;
								sliceSetting.Value = settingDefaultValue;
								sliceSetting.SettingsCollectionId = windowController.ActivePresetLayer.settingsCollectionData.Id;

								settingsDictionary.Add(keyName, sliceSetting);
							}
						}
						windowController.ActivePresetLayer.settingsDictionary = settingsDictionary;
						LoadSettingsRows();
					}
				}
				catch (Exception)
				{
					// Error loading configuration
				}
			}
		}
コード例 #27
0
		public void LoadSettingsFromIni()
		{
			OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Configuration|*.slice;*.ini");
			openParams.ActionButtonLabel = "Load Configuration";
			openParams.Title = "MatterControl: Select A File";

			FileDialog.OpenFileDialog(openParams, onSettingsFileSelected);
		}
コード例 #28
0
		private static void onLibraryLoadFileSelected(OpenFileDialogParams openParams)
		{
			if (openParams.FileNames != null)
			{
				currentPrintLibraryWidget.libraryDataView.CurrentLibraryProvider.AddFilesToLibrary(openParams.FileNames, null);
			}
		}
コード例 #29
0
        public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate)
        {
            this.windowType = windowType;
            autoRotateEnabled = (autoRotate == AutoRotate.Enabled);
            MeshExtraData = new List<PlatingMeshData>();
            MeshExtraData.Add(new PlatingMeshData());

            this.printItemWrapper = printItemWrapper;

            FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
            mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;

            FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
            centerPartPreviewAndControls.AnchorAll();

            GuiWidget viewArea = new GuiWidget();
            viewArea.AnchorAll();
            {
                meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape, "Press 'Add' to select an item.".Localize());
                
                // this is to add an image to the bed
                string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "bedimage.png");
                if (autoRotateEnabled && File.Exists(imagePathAndFile))
                {
                    ImageBuffer wattermarkImage = new ImageBuffer();
                    ImageIO.LoadImageData(imagePathAndFile, wattermarkImage);

                    ImageBuffer bedImage = meshViewerWidget.BedImage;
                    Graphics2D bedGraphics = bedImage.NewGraphics2D();
                    bedGraphics.Render(wattermarkImage, 
                        new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height)/2));
                }

                meshViewerWidget.AnchorAll();
            }
            viewArea.AddChild(meshViewerWidget);

            centerPartPreviewAndControls.AddChild(viewArea);
            mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);

            FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
            buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
            buttonBottomPanel.Padding = new BorderDouble(3, 3);
            buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            buttonRightPanel = CreateRightButtonPanel(viewerVolume.y);

            CreateOptionsContent();

            // add in the plater tools
            {
                FlowLayoutWidget editToolBar = new FlowLayoutWidget();

                string progressFindPartsLabel = LocalizedString.Get("Finding Parts");
                string progressFindPartsLabelFull = "{0}:".FormatWith(progressFindPartsLabel);

                processingProgressControl = new ProgressControl(progressFindPartsLabelFull, ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor);
                processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
                editToolBar.AddChild(processingProgressControl);
                editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
                processingProgressControl.Visible = false;

                // If the window is embeded (in the center pannel) and there is no item loaded then don't show the add button
                enterEditButtonsContainer = new FlowLayoutWidget();
                {
                    Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png");
                    addButton.Margin = new BorderDouble(right: 10);
                    enterEditButtonsContainer.AddChild(addButton);
                    addButton.Click += (sender, e) =>
                    {
                        UiThread.RunOnIdle((state) =>
                        {
                            EnterEditAndSplitIntoMeshes();
                            OpenAddDialogWhenDone = true;
                        });
                    };

                    Button enterEdittingButton = textImageButtonFactory.Generate(LocalizedString.Get("Edit"));
                    enterEdittingButton.Click += (sender, e) =>
                    {
                        EnterEditAndSplitIntoMeshes();
                    };

                    enterEditButtonsContainer.AddChild(enterEdittingButton);
                }
                editToolBar.AddChild(enterEditButtonsContainer);

                doEdittingButtonsContainer = new FlowLayoutWidget();
                doEdittingButtonsContainer.Visible = false;

                {
                    Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png");
                    addButton.Margin = new BorderDouble(right: 10);
                    doEdittingButtonsContainer.AddChild(addButton);
                    addButton.Click += (sender, e) =>
                    {
                        UiThread.RunOnIdle((state) =>
                        {
                            OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true);

                            FileDialog.OpenFileDialog(ref openParams);
                            LoadAndAddPartsToPlate(openParams.FileNames);
                        });
                    };

                    Button copyButton = textImageButtonFactory.Generate(LocalizedString.Get("Copy"));
                    doEdittingButtonsContainer.AddChild(copyButton);
                    copyButton.Click += (sender, e) =>
                    {
                        MakeCopyOfMesh();
                    };

                    Button deleteButton = textImageButtonFactory.Generate(LocalizedString.Get("Delete"));
                    deleteButton.Margin = new BorderDouble(left: 20);
                    doEdittingButtonsContainer.AddChild(deleteButton);
                    deleteButton.Click += (sender, e) =>
                    {
                        DeleteSelectedMesh();
                    };
                }

                KeyDown += (sender, e) =>
                {
                    KeyEventArgs keyEvent = e as KeyEventArgs;
                    if (keyEvent != null && !keyEvent.Handled)
                    {
                        if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back)
                        {
                            DeleteSelectedMesh();
                        }

                        if (keyEvent.KeyCode == Keys.Escape)
                        {
                            if (meshSelectInfo.downOnPart)
                            {
                                meshSelectInfo.downOnPart = false;
                                
                                ScaleRotateTranslate translated = SelectedMeshTransform;
                                translated.translation *= transformOnMouseDown;
                                SelectedMeshTransform = translated;

                                Invalidate();
                            }
                        }
                    }
                };

                editToolBar.AddChild(doEdittingButtonsContainer);
                buttonBottomPanel.AddChild(editToolBar);
            }

            autoArrangeButton.Click += (sender, e) =>
            {
                AutoArangePartsInBackground();
            };

            GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop);
            centerPartPreviewAndControls.AddChild(buttonRightPanelHolder);
            buttonRightPanelHolder.AddChild(buttonRightPanel);

            viewControls3D = new ViewControls3D(meshViewerWidget);

            buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
            buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
            buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover);
            LockEditControls();

            GuiWidget leftRightSpacer = new GuiWidget();
            leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
            buttonBottomPanel.AddChild(leftRightSpacer);

            if (windowType == WindowType.StandAlone)
            {
                Button closeButton = textImageButtonFactory.Generate(LocalizedString.Get("Close"));
                buttonBottomPanel.AddChild(closeButton);
                closeButton.Click += (sender, e) =>
                {
                    CloseOnIdle();
                };
            }

            mainContainerTopToBottom.AddChild(buttonBottomPanel);

            this.AddChild(mainContainerTopToBottom);
            this.AnchorAll();

            meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;
            AddChild(viewControls3D);
            viewControls3D.PartSelectVisible = false;

            AddHandlers();

            if (printItemWrapper != null)
            {
                // don't load the mesh until we get all the rest of the interface built
                meshViewerWidget.LoadMesh(printItemWrapper.FileLocation);
                meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);
            }

            UiThread.RunOnIdle(AutoSpin);

            if (printItemWrapper == null && windowType == WindowType.Embeded)
            {
                enterEditButtonsContainer.Visible = false;
            }

            if (windowType == WindowType.Embeded)
            {
                PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
                if (windowType == WindowType.Embeded)
                {
                    // make sure we lock the controls if we are printing or paused
                    switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
                    {
                        case PrinterConnectionAndCommunication.CommunicationStates.Printing:
                        case PrinterConnectionAndCommunication.CommunicationStates.Paused:
                            LockEditControls();
                            break;
                    }
                }
            }

            ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
        }
コード例 #30
0
		private void onLibraryLoadFileSelected(OpenFileDialogParams openParams)
		{
			if (openParams.FileNames != null)
			{
				this.libraryDataView.CurrentLibraryProvider.AddFilesToLibrary(openParams.FileNames, null);
			}
		}
コード例 #31
0
        void DoOpenFileButton_ButtonClick(object state)
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("3D Mesh Files|*.stl;*.amf");
            Stream streamToLoadFrom = FileDialog.OpenFileDialog(ref openParams);

            meshViewerWidget.LoadMesh(openParams.FileName);

            Invalidate();
        }
コード例 #32
0
        void loadFile_Click(object sender, MouseEventArgs mouseEvent)
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true);
            FileDialog.OpenFileDialog(ref openParams);
            if (openParams.FileNames != null)
            {
                foreach (string loadedFileName in openParams.FileNames)
                {
                    PrintItem printItem = new PrintItem();
                    printItem.Name = System.IO.Path.GetFileNameWithoutExtension(loadedFileName);
                    printItem.FileLocation = System.IO.Path.GetFullPath(loadedFileName);
                    printItem.PrintItemCollectionID = PrintLibraryListControl.Instance.LibraryCollection.Id;
                    printItem.Commit();

                    PrintLibraryListItem queueItem = new PrintLibraryListItem(new PrintItemWrapper(printItem));
                    PrintLibraryListControl.Instance.AddChild(queueItem);
                }
                PrintLibraryListControl.Instance.Invalidate();
            }
            PrintLibraryListControl.Instance.SaveLibraryItems();
        }
コード例 #33
0
        public List<PrintItem> OpenFromDialog()
        {
            OpenFileDialogParams openParams = new OpenFileDialogParams("Zip file|*.zip");

            FileDialog.OpenFileDialog(ref openParams);
			if (openParams.FileNames != null)
            {
                string loadedFileName = openParams.FileName;
                return ImportFromProjectArchive(loadedFileName);
            }
            else
            {
                return null;
            }
        }
コード例 #34
0
		private void onSettingsFileSelected(OpenFileDialogParams openParams)
		{
			if (openParams.FileNames != null)
			{
				LoadConfigurationSettingsFromFileAsUnsaved(openParams.FileName);
				ApplicationController.Instance.ReloadAdvancedControlsPanel();
			}
		}
コード例 #35
0
        public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, MeshViewerWidget.BedShape bedShape)
        {
            MeshExtraData = new List<PlatingMeshData>();
            MeshExtraData.Add(new PlatingMeshData());

            this.printItemWrapper = printItemWrapper;

            FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
            mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;

            FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
            centerPartPreviewAndControls.AnchorAll();

            GuiWidget viewArea = new GuiWidget();
            viewArea.AnchorAll();
            {
                meshViewerWidget = new MeshViewerWidget(viewerVolume, 1, bedShape);
                SetMeshViewerDisplayTheme();
                meshViewerWidget.AnchorAll();
            }
            viewArea.AddChild(meshViewerWidget);

            centerPartPreviewAndControls.AddChild(viewArea);
            mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);

            meshViewerWidget.LoadMesh(printItemWrapper.FileLocation);
            meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);

            FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
            buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
            buttonBottomPanel.Padding = new BorderDouble(3, 3);
            buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            buttonRightPanel = CreateRightButtonPannel(viewerVolume.y);

            CreateOptionsContent();

            // add in the plater tools
            {
                FlowLayoutWidget editToolBar = new FlowLayoutWidget();

				string progressFindPartsLbl = new LocalizedString ("Finding Parts").Translated;
				string progressFindPartsLblFull = string.Format ("{0}:", progressFindPartsLbl);

				processingProgressControl = new ProgressControl(progressFindPartsLblFull);
                processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
                editToolBar.AddChild(processingProgressControl);
                editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
                processingProgressControl.Visible = false;

				editPlateButton = textImageButtonFactory.Generate(new LocalizedString("Edit").Translated);
                editToolBar.AddChild(editPlateButton);

                editPlateButtonsContainer = new FlowLayoutWidget();
                editPlateButtonsContainer.Visible = false;

				Button addButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png");
                addButton.Margin = new BorderDouble(right: 10);
                editPlateButtonsContainer.AddChild(addButton);
                addButton.Click += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true);

                        FileDialog.OpenFileDialog(ref openParams);
                        LoadAndAddPartsToPlate(openParams.FileNames);
                    });
                };

				Button copyButton = textImageButtonFactory.Generate(new LocalizedString("Copy").Translated);
                editPlateButtonsContainer.AddChild(copyButton);
                copyButton.Click += (sender, e) =>
                {
                    MakeCopyOfMesh();
                };

				Button deleteButton = textImageButtonFactory.Generate(new LocalizedString("Delete").Translated);
                deleteButton.Margin = new BorderDouble(left: 20);
                editPlateButtonsContainer.AddChild(deleteButton);
                deleteButton.Click += (sender, e) =>
                {
                    DeleteSelectedMesh();
                };

                KeyDown += (sender, e) =>
                {
                    KeyEventArgs keyEvent = e as KeyEventArgs;
                    if (keyEvent != null && !keyEvent.Handled)
                    {
                        if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back)
                        {
                            DeleteSelectedMesh();
                        }

                        if (keyEvent.KeyCode == Keys.Escape)
                        {
                            if (meshSelectInfo.downOnPart)
                            {
                                meshSelectInfo.downOnPart = false;
                                SelectedMeshTransform = transformOnMouseDown;
                                Invalidate();
                            }
                        }
                    }
                };

                editToolBar.AddChild(editPlateButtonsContainer);
                buttonBottomPanel.AddChild(editToolBar);

                editPlateButton.Click += (sender, e) =>
                {
                    editPlateButton.Visible = false;

                    EnterEditAndSplitIntoMeshes();
                };
            }

            autoArrangeButton.Click += (sender, e) =>
            {
                AutoArangePartsInBackground();
            };

            GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop);
            centerPartPreviewAndControls.AddChild(buttonRightPanelHolder);
            buttonRightPanelHolder.AddChild(buttonRightPanel);

            buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
            buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
            buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover);
            LockEditControls();

            GuiWidget leftRightSpacer = new GuiWidget();
            leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
            buttonBottomPanel.AddChild(leftRightSpacer);

			closeButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated);
            buttonBottomPanel.AddChild(closeButton);

            mainContainerTopToBottom.AddChild(buttonBottomPanel);

            this.AddChild(mainContainerTopToBottom);
            this.AnchorAll();

            meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;
            AddViewControls();

            AddHandlers();
        }