/// <summary>
        /// Destroys the NormalSwitcherControl and resets the GUI-elements.
        /// </summary>
        /// <param name="sender">closeToolStripMenuItem</param>
        /// <param name="e">Standard EventArgs</param>
        private void CloseFile(object sender, EventArgs e)
        {
            if (currentFile != "")
            {
                if ((undoButton.Enabled) && (MessageBox.Show("Do you want to save your changes?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    this.SaveAs(sender, e);
                }

                splitContainer2.Panel2.Controls.Clear();
                visualization          = null;
                originTrackBar.Visible = false;
                history.Clear();
                currentSelection.Clear();
                currentFile        = "";
                allButton.Enabled  = false;
                undoButton.Enabled = false;

                vertexArray = normalArray = backupNormals = null;
                parser      = new STLParser();

                normalListView.Items.Clear();
                normalListView.Items.Add(new ListViewItem(new string[2] {
                    "Select a File!", "Select a File!"
                }));
                normalListView.Items[0].Tag = -2;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Destroys the NormalSwitcherControl and resets the GUI-elements.
        /// </summary>
        /// <param name="sender">closeToolStripMenuItem</param>
        /// <param name="e">Standard EventArgs</param>
        private void CloseFile(object sender, EventArgs e)
        {
            if (currentFile != "")
            {
                if (changed && (MessageBox.Show("Do you want to save your changes?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    if ((triangleList.Count == 0) && (MessageBox.Show("You need at least one triangle to save!", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel))
                    {
                        throw new Exception();
                    }
                    else if (triangleList.Count > 0)
                    {
                        this.SaveAs(sender, e);
                    }
                }

                splitContainer2.Panel2.Controls.Clear();
                visualization          = null;
                originTrackBar.Visible = false;
                history.Clear();
                currentSelection.Clear();
                currentFile        = "";
                allButton.Enabled  = false;
                undoButton.Enabled = false;

                triangleList = backupList = null;
                parser       = new STLParser();
                changed      = false;
                triVertices  = new float[9];
                corners      = new float[9];

                tabControl1.TabPages.Clear();
            }
        }
 /// <summary>
 /// Creates a new NormalSwitcherControl and adds it to the NormalSwitcherForm.
 /// </summary>
 private void InitVisualization()
 {
     visualization = new NormalSwitcherControl(this, parser.Scale);
     splitContainer2.Panel2.Controls.Add(visualization);
     visualization.Dock = DockStyle.Fill;
 }