private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "All Files (*.*)|*.*";
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            MeshModel model;

            try
            {
                model = MeshModel.LoadFromFile(ofd.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    this.form,
                    ex.Message,
                    this.form.Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (this.model != null)
            {
                this.model.Dispose();
            }
            this.model = model;

            this.InitializeModelUI(this.model);
        }
Exemple #2
0
 private MeshModel GetModelFromName(string model)
 {
     if (this.models.ContainsKey(model) == false)
     {
         this.models[model] = MeshModel.LoadFromFile("./Models/" + Path.GetFileNameWithoutExtension(model) + ".bwm");
     }
     return(this.models[model]);
 }