void UploadFile()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        //pth.filter = "all (*.*)";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath; // default path
        //pth.title = "Upload data";
        //pth.defExt = "txt";
        pth.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
                //0x00080000   是否使用新版文件选择窗口
                //0x00000200   是否可以多选文件
                if(OpenFileDialog.GetOpenFileName(pth))
        {
            string filepath = pth.file;

            paramSetting.ParseFile(filepath);
            //string newfile = Application.streamingAssetsPath + "/" + pth.fileTitle;

            //if (!Directory.Exists(Application.streamingAssetsPath)) {
            //    Directory.CreateDirectory(Application.streamingAssetsPath);
            //}
            //File.WriteAllText(newfile, File.ReadAllText(filepath));
        }
    }
Example #2
0
    void OnClickFileBtn()
    {
        OpenFileDlg param = new OpenFileDlg();

        param.structSize   = System.Runtime.InteropServices.Marshal.SizeOf(param);
        param.filter       = "png | *.png;*.jpg;";
        param.file         = new string(new char[256]);
        param.maxFile      = param.file.Length;
        param.fileTitle    = new string(new char[64]);
        param.maxFileTitle = param.fileTitle.Length;
        param.initialDir   = Application.dataPath; // default path
        param.title        = "标题";
        param.defExt       = "png";
        param.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;

        if (OpenFileDialog.GetOpenFileName(param))
        {
            Debug.Log(param.file);

            if (coroutine == null)
            {
                coroutine = StartCoroutine(ReadTexture(param.file));
            }
        }
    }
Example #3
0
    public static string AddGame()
    {
        OpenFileDlg pth      = new OpenFileDlg();
        string      filepath = null;

        pth.structSize = System.Runtime.InteropServices.Marshal.SizeOf(pth);

        //pth.filter = "exe (*.exe)";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); // default path
        pth.title        = "请选择游戏";
        pth.defExt       = "exe";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        //0x00080000   是否使用新版文件选择窗口
        //0x00000200   是否可以多选文件
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            filepath = pth.file;//选择的文件路径;
        }
        Debug.Log(filepath);
        return(filepath);
    }
            /// <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;
                        }
                    }
                }
            }
Example #5
0
    /// <summary>
    /// 打开文件
    /// </summary>
    /// <returns></returns>
    public static string OpenFile()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize   = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter       = "txt (*.txt)";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath; // default path
        pth.title        = "打开项目";
        pth.defExt       = "txt";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            string filepath = pth.file;//选择的文件路径;
            Debug.Log(filepath);
            return(filepath);
        }
        else
        {
            return("");
        }
    }
Example #6
0
    public string OpenProject()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize   = Marshal.SizeOf(pth);
        pth.filter       = "exe";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath.Replace("/", "\\") + "\\Resources"; //默认路径
        pth.title        = "打开项目";
        pth.defExt       = "dat";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            string filepath = pth.file; //选择的文件路径;
            UnityEngine.Debug.Log(filepath);
            return(pth.file);
        }
        else
        {
            return(null);
        }
    }
    public static void CustomSubMenu3()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter     = "动画模板文件(*.XML)\0*.XML";

        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); // default path
        pth.title        = "载入模板";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;

        if (!OpenFileDialog.GetOpenFileName(pth))
        {
            return;
        }

        string filepath = pth.file;//选择的文件路径;


        string[] strlis = File.ReadAllLines(filepath, Encoding.UTF8);
        File.WriteAllLines("XmlAnimation\\Animation.xml", strlis, Encoding.UTF8);
        Debug.Log("成功载入动画指令序列!");
    }
    static public string OpenFile()
    {
        string filepath = "";

        #if UNITY_EDITOR
        filepath = EditorUtility.OpenFilePanel("Open File", _lastDir, "yo");
        _lastDir = filepath;
        #else
        OpenFileDlg pth = new OpenFileDlg();
        pth.structSize   = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter       = "yo (*.yo)";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = _lastDir;    // default path
        pth.title        = "打开文件";
        pth.defExt       = "yo";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            filepath = pth.file;    //选择的文件路径;
            _lastDir = filepath;
        }
        #endif
        return(filepath);
    }
Example #9
0
        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));
        }
Example #10
0
 private void BtnBrowse_Click(object sender, EventArgs e)
 {
     OpenFileDlg.Filter = "FichierAccess|*.mdb|Tous fichiers|*.*";
     OpenFileDlg.ShowDialog();
     txtPath.Text = OpenFileDlg.FileName;
     getPath      = txtPath.Text;
 }
Example #11
0
    public static string OpenFile(string title, string defaultPath, string filter)
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize   = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter       = string.Format("{0}(*.{1})\0*.{2}", filter, filter, filter);
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = defaultPath; // default path
        pth.title        = title;
        pth.defExt       = filter;
        //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
        pth.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            Debug.Log(pth.file);
            return(pth.file);//选择的文件路径;
        }
        else
        {
            return(null);
        }
    }
    public static void CustomSubMenu1()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter     = "支持的模型文件(*.3DXML)\0*.3DXML";

        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); // default path
        pth.title        = "导入模型";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;

        if (!OpenFileDialog.GetOpenFileName(pth))
        {
            return;
        }

        string filepath = pth.file; //选择的文件路径;
                                    //Debug.Log(filepath);
        XmlModel x = new XmlModel(filepath);

        DestroyImmediate(GameObject.Find("ModelGenerator"));
        x.Render(new GameObject("ModelGenerator"));



        //打出一行字:模板生成在。。。.xml,请手动设置动画参数,或使用第二个选项自动设置参数。
    }
Example #13
0
 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;
     }
 }
Example #14
0
        private void BrowseBtn_Click(object sender, EventArgs e)
        {
            OpenFileDlg.FileName = PluginPathTxt.Text;

            if (OpenFileDlg.ShowDialog(this) == DialogResult.OK)
            {
                PluginPathTxt.Text = OpenFileDlg.FileName;
            }
        }
Example #15
0
File: Form1.cs Project: sven82/HFCS
 private void BtnOpen_Click(object sender, EventArgs e)
 {
     if (OpenFileDlg.ShowDialog() == DialogResult.OK)
     {
         string fileName = OpenFileDlg.FileName;
         TxtBox.Clear();
         TxtBox.Text = File.ReadAllText(fileName);
     }
 }
Example #16
0
    public void Btn_Open_Click()
    {
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize   = Marshal.SizeOf(pth);
        pth.filter       = "All files (*.*)|*.*";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath.Replace("/", "\\") + "\\Resources";
        pth.title        = "Open Project";
        pth.defExt       = "dat";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            string filepath = pth.file;
            Debug.Log(filepath);
            StreamReader sr = new StreamReader(filepath);
            sr.ReadLine();
            string        input = sr.ReadToEnd();
            string[]      s     = input.Split('\r');
            StringBuilder sb2   = new StringBuilder();
            for (int i = 0; i < s.Count(); i++)
            {
                string[] ss = s[i].Split(',');
                if (ss.Count() < 3)
                {
                    break;
                }
                int j = 0;
                foreach (GameObject l in lineList)
                {
                    if (j == 0)
                    {
                        Debug.Log(System.Convert.ToInt32(ss[0]));
                        m_DataDiagram.InputPoint(l, new Vector2(1, (float)(System.Convert.ToInt32(ss[0].ToString()) / 10.0)));
                        Debug.Log(System.Convert.ToInt32(ss[0]));
                    }
                    else if (j == 1)
                    {
                        Debug.Log(System.Convert.ToInt32(ss[1]));
                        m_DataDiagram.InputPoint(l, new Vector2(1, (float)(System.Convert.ToInt32(ss[1].ToString()) / 10.0)));
                        Debug.Log(System.Convert.ToInt32(ss[1]));
                    }
                    else
                    {
                        Debug.Log(System.Convert.ToInt32(ss[2]));
                        m_DataDiagram.InputPoint(l, new Vector2(1, (float)(System.Convert.ToInt32(ss[2].ToString()) / 10.0)));
                        Debug.Log(System.Convert.ToInt32(ss[2]));
                    }
                    j++;
                }
            }
        }
    }
Example #17
0
        void OnFileOpen(object sender, EventArgs e)
        {
            if (OpenFileDlg.ShowDialog(this) == DialogResult.OK)
            {
                OnFileClose(this, null);

                SetCacheViewerPath("Loading...");
                bgwCacheOpen.RunWorkerAsync(this);
            }
        }
Example #18
0
 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);
     }
     ;
 }
Example #19
0
 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();
     }
 }
Example #20
0
        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;
            }
        }
Example #21
0
        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
            }
        }
Example #22
0
        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();
        }
Example #24
0
    /// <summary>
    /// 打开项目
    /// </summary>
    public void OpenProject(FileType fileType, System.Action <string> action)
    {
        OpenQueueCall = action;
        OpenFileDlg pth = new OpenFileDlg();

        pth.structSize = Marshal.SizeOf(pth);
        switch (fileType)
        {
        case FileType.All:
            pth.filter = "All files (*.*)\0*.*";
            break;

        case FileType.png:
            pth.filter = "All files (*.png)\0*.png";
            break;

        case FileType.jpg:
            pth.filter = "All files (*.jpg)\0*.jpg";
            break;

        case FileType.txt:
            pth.filter = "All files (*.txt)\0*.txt";
            break;

        case FileType.json:
            pth.filter = "All files (*.json)\0*.json";
            break;

        default:
            break;
        }
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath.Replace("/", "\\") + "\\Resources"; //默认路径
        pth.title        = "打开项目";
        pth.defExt       = "dat";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (OpenFileDialog.GetOpenFileName(pth))
        {
            string filepath = pth.file; //选择的文件路径;
            Debug.Log(filepath);
            OpenQueueCall?.Invoke(filepath);
            OpenQueueCall = null;
        }
    }
 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);
     }
 }
Example #26
0
        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 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("Проверьте корректность ваших данных");
            }
        }
Example #28
0
        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;
            }
        }
Example #29
0
 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();
         }
     }
 }
Example #30
0
        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();
        }
        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 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);
        }
        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;
        }
Example #34
0
        //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();
        }
Example #35
0
        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
              }
        }
Example #36
0
        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();
        }
        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;
              }
        }