/// <summary> /// resolve the item to another excel file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> private void ResolveToolStripMenuItem_Click(object sender, System.EventArgs e) { //open the excel file OpenFileDlg.Title = Properties.Settings.Default.capForOpenDlg; OpenFileDlg.Filter = Properties.Settings.Default.filterForOpenDlg; OpenFileDlg.Multiselect = false; if (OpenFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DataGridViewRow oCurRow = DataGV.CurrentRow; string oFileName = oCurRow.Cells["FileName"].Value.ToString(); string oStatus = oCurRow.Cells["Status"].Value.ToString(); if (oFileName == OpenFileDlg.FileName && oStatus == "Up-to-date") { MessageBox.Show(Properties.Settings.Default.upToDate, Properties.Settings.Default.messageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { if (Helper.UpdateOrResolve(OpenFileDlg.FileName) == true) { _undoSta = 1; BtnUndo.Enabled = true; } } } }
public override void ExecutePlugin() { string modelFile = null; // when running tests we don't want file selection dialog to pop up. if (!TestManager.IsRunning) { modelFile = @"Models\curtainmedi.V3O"; // default model file if (!EditorManager.EngineManager.File_Exists(modelFile)) { // show a file open dialog to select a model file OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.Caption = "Selecting the Cloth Model File"; fileDlg.Description = "Please select the cloth model file you want to use and press OK to continue."; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] { ".model" }; if (fileDlg.ShowDialog() != DialogResult.OK) { return; } modelFile = fileDlg.FileName; } } ClothObjectShape shape = new ClothObjectShape("ClothObject", modelFile); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; Layer layer = EditorManager.Scene.ActiveLayer; EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(shape, layer.ActiveShape, layer, true)); }
private void BtnBrowse_Click(object sender, EventArgs e) { OpenFileDlg.Filter = "FichierAccess|*.mdb|Tous fichiers|*.*"; OpenFileDlg.ShowDialog(); txtPath.Text = OpenFileDlg.FileName; getPath = txtPath.Text; }
private void BrowseBtn_Click(object sender, EventArgs e) { OpenFileDlg.FileName = PluginPathTxt.Text; if (OpenFileDlg.ShowDialog(this) == DialogResult.OK) { PluginPathTxt.Text = OpenFileDlg.FileName; } }
private void BtnOpen_Click(object sender, EventArgs e) { if (OpenFileDlg.ShowDialog() == DialogResult.OK) { string fileName = OpenFileDlg.FileName; TxtBox.Clear(); TxtBox.Text = File.ReadAllText(fileName); } }
private void btnGrabberLibSel_Click(object sender, EventArgs e) { OpenFileDlg.Title = "Select the file that contains the frame grabber control library."; OpenFileDlg.FileName = txtGrabberLib.Text; if (OpenFileDlg.ShowDialog() == DialogResult.OK) { txtGrabberLib.Text = OpenFileDlg.FileName; } }
void OnFileOpen(object sender, EventArgs e) { if (OpenFileDlg.ShowDialog(this) == DialogResult.OK) { OnFileClose(this, null); SetCacheViewerPath("Loading..."); bgwCacheOpen.RunWorkerAsync(this); } }
void Event_PluginBrowse(object sender, EventArgs e) { if (PluginManager.ActivePlugin != null) { OpenFileDlg.FileName = PluginManager.ActivePlugin.PluginPath; } if (OpenFileDlg.ShowDialog(this) == DialogResult.OK) { Action_PluginAdd(OpenFileDlg.FileName); } ; }
private void OpenFile_Click(object sender, EventArgs e) { if (OpenFileDlg.ShowDialog() == DialogResult.OK) { TextBox_FilePath.Text = OpenFileDlg.FileName; img = new Image <Bgr, Byte>(TextBox_FilePath.Text); ImgBox_Original.Image = img.Bitmap; fnPreProcessing(); fnFindTriangleRect(); fnCircleDetection(); fnEdgeDetection(); } }
private void CmdOpen_Click(object sender, EventArgs e) { if (mDirty) { var resSave = MessageBox.Show("Do you want to save your changes?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (resSave == DialogResult.Yes) { if (!DoSave()) { // user cancelled save return; } } } // clear current filepath from open dialog so user does not get confused OpenFileDlg.FileName = string.Empty; var resOpen = OpenFileDlg.ShowDialog(); if (resOpen != DialogResult.OK) { return; } try { var rtCfg = RuntimeConfig.LoadFromFile(OpenFileDlg.FileName); BrowseIcon.FileName = rtCfg.PanelIcon; UpdatePanelIcon(); PanelText.Text = rtCfg.PanelText; RibbonText.Text = rtCfg.RibbonText; TabText.Text = rtCfg.TabText; mConfigs.Clear(); mConfigs.AddRange(rtCfg.CommandConfigs); // only update filepath if we have successfully loaded file mFilePath = OpenFileDlg.FileName; mDirty = false; UpdateUserInterface(); } catch { // ignore any errors, probably from incorrect xml file } }
private void btnOpenSourceData_Click(object sender, EventArgs e) { OpenFileDlg.FileName = ""; OpenFileDlg.Filter = "GIS(*.shp)|*.shp"; OpenFileDlg.FilterIndex = 1; OpenFileDlg.ShowDialog(); if (OpenFileDlg.FileName != "") { comboBoxInputData.Text = OpenFileDlg.FileName; IWorkspaceFactory pWorkspaceFactory; pWorkspaceFactory = new ShapefileWorkspaceFactory(); String wsp; int r; int l; r = comboBoxInputData.Text.LastIndexOf("\\"); l = comboBoxInputData.Text.LastIndexOf("."); wsp = comboBoxInputData.Text.Substring(0, r); IFeatureWorkspace pFWS; pFWS = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(wsp, 0); try { String sp; IFeatureClass pFeatureClass; sp = comboBoxInputData.Text.Substring(r + 1, l - r - 1); pFeatureClass = pFWS.OpenFeatureClass(sp); comboBoxZValueField.Items.Clear(); comboBoxZValueField.Items.Add("无"); try { for (int j = 0; j < pFeatureClass.Fields.FieldCount; j++) { if (pFeatureClass.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeDouble || pFeatureClass.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeSingle || pFeatureClass.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeSmallInteger || pFeatureClass.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeInteger) { comboBoxZValueField.Items.Add(pFeatureClass.Fields.get_Field(j).Name); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bDataPath = true; } }
private void FileSelectBtn_Click(object sender, EventArgs e) { if (OpenFileDlg.InitialDirectory.Length == 0) { OpenFileDlg.InitialDirectory = @"D:\"; } var dlgResult = OpenFileDlg.ShowDialog(); if (dlgResult == DialogResult.OK) { FileName = OpenFileDlg.FileName; FileNameBox.Text = FileName; } }
private void cmdLoadFile_Click(object sender, EventArgs e) { DialogResult result = OpenFileDlg.ShowDialog(); if (result == DialogResult.Cancel) { return; } if (!util.LoadDeviceLongInfo(OpenFileDlg.FileName, trModeInfo)) { MessageBox.Show("Failed to open file : " + OpenFileDlg.FileName); return; } DrawTrModeList(); }
private void btnBrowse_Click(object sender, EventArgs e) { try { txtFileName.Text = string.Empty; DialogResult dr = OpenFileDlg.ShowDialog(); if (dr != DialogResult.OK) { return; } txtFileName.Text = OpenFileDlg.FileName.Trim(); } catch (Exception ex) { clsStaticMethods.WriteLog("btnBrowse_Click()-->" + ex.Message); } }
private void mainMenu_File_Open_Click(object sender, EventArgs ev) { try { if (OpenFileDlg.ShowDialog() != DialogResult.OK) { return; } int[] arr = DataConverter.StrToArray <int>(DataIO.ReadFileToStr(OpenFileDlg.FileName)); DataGridViewHelper.ArrayToDGV(sourceArrayDGV, arr); } catch (Exception e) { MessagesUtils.ShowError("Проверьте корректность ваших данных"); } }
private void button_browse_Click(object sender, System.EventArgs e) { OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; fileDlg.Caption = "Selecting the Settings File"; fileDlg.Description = "Please select the vLux settings file you want to use and press OK to continue"; string settingsDir = EditorApp.Scene.LayerDirectoryName; fileDlg.InitialDirectory = settingsDir; fileDlg.Filter = new string[] { ".cfg" }; if (fileDlg.ShowDialog() != DialogResult.OK) { return; } textBox_CustomSettingsFile.Text = fileDlg.RelativeFileName; }
private void btnOpenBarrier_Click(object sender, EventArgs e) { OpenFileDlg.FileName = ""; OpenFileDlg.Filter = "GIS(*.shp)|*.shp"; OpenFileDlg.FilterIndex = 1; OpenFileDlg.ShowDialog(); if (OpenFileDlg.FileName != "") { String wsp; int r; int l; r = OpenFileDlg.FileName.LastIndexOf("\\"); l = OpenFileDlg.FileName.LastIndexOf("."); wsp = OpenFileDlg.FileName.Substring(0, r); IWorkspaceFactory pWorkspaceFactory; pWorkspaceFactory = new ShapefileWorkspaceFactory(); IFeatureWorkspace pFWS; pFWS = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(wsp, 0); try { String sp; IFeatureClass pFeatureClass; sp = OpenFileDlg.FileName.Substring(r + 1, l - r - 1); pFeatureClass = pFWS.OpenFeatureClass(sp); if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { comboBoxBarrier.Text = OpenFileDlg.FileName; } else { MessageBox.Show("请选择线类型的shape文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); comboBoxBarrier.Text = ""; return; } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bDataLinePath = true; } }
private void BtnSelectFile_Click(object sender, EventArgs e) { if (OpenFileDlg.ShowDialog() == DialogResult.OK) { TxtBoxFileLoc.Text = OpenFileDlg.FileName; ShowProgress(true); bwReadLines = new BackgroundWorker(); bwReadLines.WorkerReportsProgress = true; bwReadLines.WorkerSupportsCancellation = true; bwReadLines.DoWork += BackgroundWorker_ReadFileLines; bwReadLines.ProgressChanged += BackgroundWorker_ReadProgressChanged; bwReadLines.RunWorkerCompleted += BackgroundWorker_ReadCompleted; if (bwReadLines.IsBusy != true) { WriteOutput("Starting to count the lines in file " + TxtBoxFileLoc.Text + "..."); bwReadLines.RunWorkerAsync(); } } }
private void BtnInput_Click(object sender, EventArgs e) { String strPath; // '文件名 OpenFileDlg.FileName = ""; OpenFileDlg.Filter = "tif files (*.tif)|*.tif|All files (*.*)|*.*"; OpenFileDlg.FilterIndex = 2; OpenFileDlg.ShowDialog(); strPath = OpenFileDlg.FileName.Trim(); if (strPath == "") { return; } ComboBoxInLayer.Text = strPath; //获取图层的栅格信息 Reclassify(); }
private void button_Create_Click(object sender, EventArgs e) { if (CreationMethod == CreationMethod_e.ExistingTerrain) { OpenFileDlg dlg = new OpenFileDlg(); dlg.Caption = "Select existing terrain file"; dlg.Description = "Select an existing terrain file that should be referenced by this scene"; dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.Filter = new string[] { ".vtc" }; if (dlg.ShowDialog() == DialogResult.OK) { TerrainShape.TerrainConfig.TerrainFolder = System.IO.Path.GetDirectoryName(dlg.RelativeFileName); TerrainShape._bIsReference = true; TerrainShape._bBakeMode = true; this.DialogResult = DialogResult.OK; } } else if (CreationMethod == CreationMethod_e.NewTerrain) { TerrainConfigDlg dlg = new TerrainConfigDlg(); dlg.Config = TerrainShape.TerrainConfig; dlg.Config._terrainFolder = TerrainConfig.CreateUniqueFolderName(); dlg.NewTerrain = true; if (dlg.ShowDialog() != DialogResult.OK) { return; } string abspath = System.IO.Path.Combine(EditorManager.Project.ProjectDir, dlg.Config.TerrainFolder); if (Directory.Exists(abspath)) { if (EditorManager.ShowMessageBox("The specified directory '" + dlg.Config.TerrainFolder + "' already exists.\n\nAny existing terrain inside this folder would be overwritten.\nContinue anyway?", "Create terrain", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } } TerrainShape.TerrainConfig = dlg.Config; this.DialogResult = DialogResult.OK; } }
private void LoadDocument() { try { if (OpenFileDlg.ShowDialog(this) == DialogResult.OK) { Program.Document = MidiMapperDocument.Load(OpenFileDlg.FileName); UpdateUI(); Text = "Midi Mapper - [" + Program.Document.FilePath + "]"; Program.Document.IsDirty = false; } } catch (Exception e) { Program.Document = null; ShowError(e); } }
private void button_Browse_Click(object sender, System.EventArgs e) { OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; string exportDir = ""; if (_settings.ExportPath!=null) exportDir = System.IO.Path.GetDirectoryName(_settings.ExportPath); if (System.IO.Directory.Exists(exportDir)) fileDlg.InitialDirectory = exportDir; else fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] { "." + SceneExportProfile.FILE_EXTENSION_EXPORT }; if (fileDlg.ShowDialog() != DialogResult.OK) return; string pathBase = MakeExportBaseName(EditorManager.Project.MakeRelative(fileDlg.FileName), true); text_Pathname.Text = pathBase; OnCheckProfileModified(); }
public override void ExecutePlugin() { string modelFile = null; // when running tests we don't want file selection dialog to pop up. if (!TestManager.IsRunning) { modelFile = @"Models\curtainmedi.V3O"; // default model file if (!EditorManager.EngineManager.File_Exists(modelFile)) { // show a file open dialog to select a model file OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.Caption = "Selecting the Cloth Model File"; fileDlg.Description = "Please select the cloth model file you want to use and press OK to continue."; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] {".model"}; if (fileDlg.ShowDialog() != DialogResult.OK) return; modelFile = fileDlg.FileName; } } ClothObjectShape shape = new ClothObjectShape("ClothObject",modelFile); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; Layer layer = EditorManager.Scene.ActiveLayer; EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(shape, layer.ActiveShape, layer, true)); }
//打开excel的题库,将其转换成list格式,并初始化两个列表 private void OpenFileBtn_Click(object sender, EventArgs e) { // string strOdbcConn; if (OpenFileDlg.ShowDialog() == DialogResult.OK) { _FileName = OpenFileDlg.FileName; } if (!string.IsNullOrEmpty(_FileName)) { if (TimuList == null) { TimuList = new List <TiMuItem>(); } else { TimuList.Clear(); } if (TimuWrongList == null) { TimuWrongList = new List <TiMuItem>(); } else { TimuWrongList.Clear(); } //选择题库的按钮禁用 this.OpenFileBtn.Enabled = false; this.Cursor = Cursors.WaitCursor; ReadExcel readExcel = new ReadExcel(); string[,] readResult = readExcel.OpenExcel(_FileName, "A", "D"); readResult.GetLength(0); for (int i = 0; i < readResult.GetLength(0); i++) { TiMuItem item = new TiMuItem(); item.XuHao = int.Parse(readResult[i, 0]); item.Type = readResult[i, 1]; item.Content = readResult[i, 2]; item.Answer = readResult[i, 3]; TimuList.Add(item); } /* * int[,,,] arr = new int[9, 8, 7, 6]; * arr.Rank;//返回4 * arr.GetLength(0);//返回9 * arr.GetLength(1);//返回8 * arr.GetLength(2);//返回7 * arr.GetLength(3);//返回6 * arr.GetUpperBound(0)+1;//返回9 * arr.Length;//返回3024 * */ //strOdbcConn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source={0}; Extended Properties=Excel 8.0;", _FileName); //using (OleDbConnection OleDb = new OleDbConnection(strOdbcConn)) //{ // OleDb.Open(); // //"select * from [Sheet1$] where 类型='多选题'" // OleDbCommand oleCommmand = new OleDbCommand("select * from [Sheet1$];", OleDb); // OleDbDataReader dr = oleCommmand.ExecuteReader(); // while (dr.Read()) // { // TiMuItem item = new TiMuItem(); // item.XuHao = int.Parse(dr[0].ToString()); // item.Type = dr[1].ToString(); // item.Content = dr[2].ToString(); // item.Answer = dr[3].ToString(); // TimuList.Add(item); // } // dr.Close(); //} this.groupBox1.Visible = true; this.label1.Text = "题目总数:" + TimuList.Count.ToString(); this.Cursor = Cursors.Default; this.NextBtn.Visible = true; } }
DecorationModelResource CreateNewModel(DecorationModelResource lodOrigin, string name) { if (TerrainEditor.CurrentTerrain == null) return null; DecorationModelResource model = TerrainEditor.CurrentTerrain.CreateDecorationModelResource(); // pick the model file OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Text = "Select model file"; fileDlg.Caption = fileDlg.Text; fileDlg.Filter = new string[] { ".model", ".srt", ".atlas" }; // TODO: get via available plugins? fileDlg.FileName = model.Filename; if (fileDlg.ShowDialog(this) != DialogResult.OK) return null; model._LODOrigin = lodOrigin; model.Filename = EditorManager.Project.MakeRelative(fileDlg.FileName); if (string.IsNullOrEmpty(name)) model.Name = System.IO.Path.GetFileNameWithoutExtension(model.Filename); else model.Name = name; EditorManager.Actions.Add(new AddDecorationModelAction(TerrainEditor.CurrentTerrain, model)); return model; }
private void editExistingBillboardAtlasToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; fileDlg.Caption = "Open existing Billboard Atlas file"; fileDlg.Description = "Browse directories to open an existing texture atlas file. Then press OK to edit the atlas."; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] { ".atlas" }; // start with selected model (if it is an .atlas file) if (TerrainEditor.CurrentDecorationModel != null && string.Compare(Path.GetExtension(TerrainEditor.CurrentDecorationModel.Filename), ".atlas", true) == 0) fileDlg.FileName = EditorManager.Project.MakeAbsolute(TerrainEditor.CurrentDecorationModel.Filename); if (fileDlg.ShowDialog() != DialogResult.OK) return; TextureAtlas atlas = TextureAtlas.CreateFromFile(EditorManager.Project.MakeRelative(fileDlg.FileName)); if (atlas == null) { EditorManager.ShowMessageBox("Error loading atlas file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TextureAtlasEditorDlg dlg = new TextureAtlasEditorDlg(true); dlg.Atlas = atlas; if (dlg.ShowDialog(this) != DialogResult.OK) return; dlg.Atlas.SaveToFile(null); }
public override void PerformRelevantOperation(string name, int iShapeIndex, int iShapeCount) { base.PerformRelevantOperation(name, iShapeIndex, iShapeCount); if (name == "Load XML") { OpenFileDlg dlg = new OpenFileDlg(); dlg.Caption = "Opening a model group file"; dlg.Description = "Please select a model group file and click OK to continue"; dlg.Text = "Opening an model group file"; dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.FileName = _filename; dlg.Filter = new string[] { ".xml" }; if (dlg.ShowDialog() == DialogResult.OK) { _filename = EditorManager.Project.MakeRelative(dlg.FileName); if (UIDialogInstance.BuildFromXML(_filename) == false) { EditorManager.ShowMessageBox("Wrong Dialog resource file."); _filename = ""; } } UpdateLayout(); //UpdateShape } else if (name == "Save XML") { CreateFileDlg dlg = new CreateFileDlg(); dlg.Caption = "Opening a GUI Dialog file"; dlg.Description = "Please select a GUI Dialog file and click OK to continue"; dlg.Text = "Opening a GUI Dialog file"; dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.FileName = _filename; dlg.Filter = new string[] { ".xml" }; dlg.AllowOverwrite = true; if (dlg.ShowDialog() == DialogResult.OK) { _filename = EditorManager.Project.MakeRelative(dlg.FileName); if (UIDialogInstance.BuildToXML(dlg.FileName) == false) { EditorManager.ShowMessageBox("Write failed."); _filename = ""; } } UpdateLayout(); } else if (name == "Rebuild UI Shape tree from XML") { OpenFileDlg dlg = new OpenFileDlg(); dlg.Caption = "Opening a model group file"; dlg.Description = "Please select a model group file and click OK to continue"; dlg.Text = "Opening an model group file"; dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.FileName = _filename; dlg.Filter = new string[] { ".xml" }; if (dlg.ShowDialog() == DialogResult.OK) { _filename = EditorManager.Project.MakeRelative(dlg.FileName); if (UIDialogInstance.BuildFromXML(_filename) == false) { EditorManager.ShowMessageBox("Wrong Dialog resource file."); _filename = ""; } } ShapeCollection Collection = ChildCollection; foreach (ShapeBase shape in Collection) { RemoveChild(shape); } int iItemCount = UIDialogInstance.GetChildUIInstanceCount(); this.Bound = UIDialogInstance.GetBound(); UpdateLayout(); } }
/// <summary> /// Import Points /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> private void BtnImport_Click(object sender, System.EventArgs e) { // if the current object is a sketch if (!(_InvApp.ActiveEditObject is Sketch) && !(_InvApp.ActiveEditObject is Sketch3D)) { MessageBox.Show(Properties.Settings.Default.notSketch, Properties.Settings.Default.messageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // open the excel file string oSelectExcelFile = null; OpenFileDlg.Title = Properties.Settings.Default.capForOpenDlg; OpenFileDlg.Filter = Properties.Settings.Default.filterForOpenDlg; OpenFileDlg.Multiselect = false; if (OpenFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { oSelectExcelFile = OpenFileDlg.FileName; } else { return; } // check if the file has been imported to // the current sketch DialogResult oResult = System.Windows.Forms.DialogResult.OK; foreach (DataGridViewRow oRow in DataGV.Rows) { string oFileName = oRow.Cells["FileName"].Value.ToString(); string oGuid = oRow.Cells["Guid"].Value.ToString(); object oCurSketch = Helper.GetSketchFromGuid(oGuid); if (oCurSketch != null) { if (oFileName == oSelectExcelFile && oCurSketch == _InvApp.ActiveEditObject) { oResult = MessageBox.Show(Properties.Settings.Default.hasImport, Properties.Settings.Default.errorCaption, MessageBoxButtons.OKCancel, MessageBoxIcon.Information); break; } } else { MessageBox.Show(Properties.Settings.Default.generalError, Properties.Settings.Default.errorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (oResult == System.Windows.Forms.DialogResult.OK) { if (Helper.ImportNewPoints(oSelectExcelFile)) { _undoSta = 0; BtnUndo.Enabled = true; } } }
private void Menu_File_ExportLayersAsPrefabsIntoFolder_Click(object sender, EventArgs e) { if (EditorManager.Project != null) { //We have a project. Show our own file open dialog OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.BrowseDirectoriesOnly = true; fileDlg.Caption = "Choose a folder"; fileDlg.Description = "Please select the folder you want to save the layers as prefabs to and press OK to continue"; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; if (fileDlg.ShowDialog() != DialogResult.OK) return; ExportLayersAsPrefabs(fileDlg.FileName); UpdateToolbars(); //update toolbars in case the user saves the prefabs to the prefabs folder. Then the shapecreator panel must be also updated to show the new prefabs } }
//File->Open Scene private void Menu_File_OpenScene_Click(object sender, System.EventArgs e) { string sceneName; //scene file name if (EditorManager.Project!=null) { //We have a project. Show our own file open dialog OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; fileDlg.ThumbnailProvider = new StandardThumbnailProvider(new string[] { @"{0}.Layers\Thumbnail.bmp", @"{0}.Layers\Thumbnail.jpg" }); fileDlg.Caption = "Opening a Scene File"; fileDlg.Description = "Please select the scene file you want to open and press OK to continue"; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] {".scene"}; if (fileDlg.ShowDialog() != DialogResult.OK) return; //Make sure the current scene is saved if (EditorApp.PromptSaveScene() == DialogResult.Cancel) return; sceneName = fileDlg.FileName; } else { // No project ? Show the normal file open dialog and try to // figure out which project to load for it. FileDialog fileDlg = new OpenFileDialog(); fileDlg.Title = "Open Scene"; fileDlg.InitialDirectory = EditorManager.Settings.LastSceneDirectory; fileDlg.Filter = "Scene files (*.Scene)|*.Scene" ; fileDlg.RestoreDirectory = true; if (fileDlg.ShowDialog() != DialogResult.OK) return; sceneName = fileDlg.FileName; } // loads the scene if possible if (LoadScene(sceneName, false)) { // Save project and scene directory for the next time EditorManager.Settings.LastSceneDirectory = (new FileInfo(sceneName)).DirectoryName; EditorManager.Settings.LastProjectDirectory = EditorManager.Project.ProjectDir; } UpdateToolbars(); }
private void BtnFilePicker_Click(object sender, EventArgs e) { DialogResult dr = OpenFileDlg.ShowDialog(); TxtFilePicked.Text = OpenFileDlg.FileName; }
private void toolStripButton_ImportReference_Click(object sender, EventArgs e) { if (EditorManager.Scene == null) return; OpenFileDlg dlg = new OpenFileDlg("Import Layer from external scene", "Import a .layer file from another scene in the same project", null, true, new string[1] { ".layer" }); if (dlg.ShowDialog() != DialogResult.OK) return; string[] absNames = dlg.FileNames; StringCollection nameList = new StringCollection(); foreach (string name in absNames) nameList.Add(name); StringCollection errorList = new StringCollection(); EditorApp.Scene.ImportLayerReferences(nameList, errorList); if (errorList.Count > 0) { string error = "Error while importing the following layers as a refernces:\n\n"; foreach (string s in errorList) error += " - " + s + "\n"; EditorManager.ShowMessageBox(error, "Error loading references", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button_browse_Click(object sender, System.EventArgs e) { OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; fileDlg.Caption = "Selecting the Settings File"; fileDlg.Description = "Please select the vLux settings file you want to use and press OK to continue"; string settingsDir = EditorApp.Scene.LayerDirectoryName; fileDlg.InitialDirectory = settingsDir; fileDlg.Filter = new string[] {".cfg"}; if (fileDlg.ShowDialog() != DialogResult.OK) return; textBox_CustomSettingsFile.Text = fileDlg.RelativeFileName; }
private void button_Create_Click(object sender, EventArgs e) { if (CreationMethod == CreationMethod_e.ExistingTerrain) { OpenFileDlg dlg = new OpenFileDlg(); dlg.Caption = "Select existing terrain file"; dlg.Description = "Select an existing terrain file that should be referenced by this scene"; dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.Filter = new string[] { ".vtc" }; if (dlg.ShowDialog() == DialogResult.OK) { TerrainShape.TerrainConfig.TerrainFolder = System.IO.Path.GetDirectoryName(dlg.RelativeFileName); TerrainShape._bIsReference = true; TerrainShape._bBakeMode = true; this.DialogResult = DialogResult.OK; } } else if (CreationMethod == CreationMethod_e.NewTerrain) { TerrainConfigDlg dlg = new TerrainConfigDlg(); dlg.Config = TerrainShape.TerrainConfig; dlg.Config._terrainFolder = TerrainConfig.CreateUniqueFolderName(); dlg.NewTerrain = true; if (dlg.ShowDialog() != DialogResult.OK) return; string abspath = System.IO.Path.Combine(EditorManager.Project.ProjectDir, dlg.Config.TerrainFolder); if (Directory.Exists(abspath)) { if (EditorManager.ShowMessageBox("The specified directory '" + dlg.Config.TerrainFolder + "' already exists.\n\nAny existing terrain inside this folder would be overwritten.\nContinue anyway?", "Create terrain", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; } TerrainShape.TerrainConfig = dlg.Config; this.DialogResult = DialogResult.OK; } }