Dispose() public method

The dispose.
public Dispose ( ) : void
return void
示例#1
0
        /// <summary>
        /// The export mesh to obj tool strip menu item_ click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <remarks></remarks>
        private void exportMeshToOBJToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveMetaDialog.InitialDirectory = Prefs.pathExtractsFolder;
            saveMetaDialog.DefaultExt = "obj";
            saveMetaDialog.FileName = map.SelectedMeta.name.Substring(map.SelectedMeta.name.LastIndexOf('\\') + 1);
            saveMetaDialog.Filter = "Object file (*.obj)|*.obj";
            if (saveMetaDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            Prefs.pathExtractsFolder = saveMetaDialog.FileName.Substring(
                0, saveMetaDialog.FileName.LastIndexOf('\\'));

            Form tempForm = new Form();
            tempForm.ControlBox = false;
            tempForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            tempForm.Size = new Size(250, 100);
            Label tempLabel = new Label();
            tempLabel.AutoSize = true;
            tempLabel.Location = new Point(20, 20);
            tempLabel.Text = "Loading BSP, please wait...";
            ProgressBar tempPB = new ProgressBar();
            tempPB.Location = new Point(20, 60);
            tempPB.Size = new Size(210, 20);
            tempPB.Minimum = 0;
            tempPB.Maximum = 100;
            tempForm.Controls.Add(tempLabel);
            tempForm.Controls.Add(tempPB);
            tempForm.Show();
            Application.DoEvents();

            BSPModel pm = new BSPModel(ref map.SelectedMeta);
            string[] temps = saveMetaDialog.FileName.Split('\\');
            string[] temps2 = temps[temps.Length - 1].Split('.');
            pm.Name = temps2[0];

            // pm.LoadModelStructure(ref Map.SelectedMeta, map);
            // pm.LoadPermutations(ref Map.SelectedMeta, map);
            // pm.LoadUnknowns(ref Map.SelectedMeta, map);
            // pm.Shaders = new Entity.BSP.BSPModel.BSPShaderContainer( pm, ref Map.SelectedMeta, map);
            tempLabel.Text = "Extracting BSP as 2 files...";
            tempPB.Value = 80;
            Application.DoEvents();
            pm.ExtractModelAsSingleMesh(saveMetaDialog.FileName);
            pm.Dispose();

            #region Remove form that shows progress

            tempForm.Dispose();

            #endregion

            MessageBox.Show("Done");
        }