private void OnSelectedChanged(InstanceUC inst, SelectedChangedEventArgs e) { if (OnSelected != null) { OnSelected(inst, e); } }
private void newFileButton_Click(object sender, EventArgs e) { //here we create a new default airplane InputBox ib = new InputBox("Create a new aircraft design", "Name of new design:"); if (ib.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (ib.InputText == string.Empty) { return; } Aircraft ac = new Aircraft(); ac.Initial_AVL_File.Title = ib.InputText; //make wing surface AVL_File.Surface wingSurf = new AVL_File.Surface("Wing", ac.Initial_AVL_File); AVL_File.Surface.Section startSec = new AVL_File.Surface.Section(wingSurf); startSec.Chord = 12; wingSurf.Sections.Add(startSec); AVL_File.Surface.Section endsec = new AVL_File.Surface.Section(wingSurf); endsec.Chord = 12; endsec.Y_LeadingEdge = 20; wingSurf.Sections.Add(endsec); ac.Initial_AVL_File.Surfaces.Add(wingSurf); //make hstab surface AVL_File.Surface hSurf = new AVL_File.Surface("HTail", ac.Initial_AVL_File); AVL_File.Surface.Section startHSec = new AVL_File.Surface.Section(hSurf); startHSec.Chord = 7; startHSec.X_LeadingEdge = 30; hSurf.Sections.Add(startHSec); AVL_File.Surface.Section endHsec = new AVL_File.Surface.Section(hSurf); endHsec.Chord = 7; endHsec.X_LeadingEdge = 30; endHsec.Y_LeadingEdge = 9; hSurf.Sections.Add(endHsec); ac.Initial_AVL_File.Surfaces.Add(hSurf); ac.Initial_AVL_File.Sref = 480; ac.Initial_AVL_File.Bref = 40; ac.Initial_AVL_File.Cref = 12; ac.Initial_AVL_File.Xref = 3; this.designs.Add(ac); InstanceUC iuc = new InstanceUC(ac); this.flowLayoutPanel1.Controls.Add(iuc); iuc.Click += new EventHandler(iuc_Click); System.Threading.Thread.Sleep(75); ConstraintsUC cuc = new ConstraintsUC(ac); cuc.Height = flowLayoutPanel2.Height - 25; this.flowLayoutPanel2.Controls.Add(cuc); } }
private void Aircraft_OnUpdateAircraft(Aircraft sender, Aircraft.AircraftUpdateEventArgs e) { switch (e.UpdateType) { case Aircraft.AircraftUpdateEventArgs.Update_Type.Closed: { //remove the instance usercontrol InstanceUC iuc = null; foreach (Control c in flowLayoutPanel1.Controls) { if (c.GetType() == typeof(InstanceUC)) { if ((c as InstanceUC).aircraft == sender) { iuc = (c as InstanceUC); } } } if (iuc != null) { flowLayoutPanel1.Controls.Remove(iuc); } //remove the constraint usercontrol ConstraintsUC cuc = null; foreach (Control c in flowLayoutPanel2.Controls) { if (c.GetType() == typeof(ConstraintsUC)) { if ((c as ConstraintsUC).DispAircraft == sender) { cuc = (c as ConstraintsUC); } } } if (cuc != null) { flowLayoutPanel2.Controls.Remove(cuc); } //finally remove this aircraft from our list of designs designs.Remove(sender); }; break; } }
public DesignCasesWindow(List<Aircraft> craft) : this() { foreach (Aircraft ac in craft) { if (ac.PrimaryInstance == null) continue; InstanceUC iuc = new InstanceUC(ac); iuc.Selectable = true; iuc.MultiSelect = false; iuc.OnSelected += new InstanceUC.SelectedEventHandler(iuc_OnSelected); this.flowLayoutPanel1.Controls.Add(iuc); //if this is the first control added, auto-select it if (this.flowLayoutPanel1.Controls.Count == 1) iuc.Selected = true; } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.Title = "AVL Vehicle File"; fd.Multiselect = true; fd.Filter = "AVL Files (*.avl)|*.avl"; fd.InitialDirectory = Properties.Settings.Default.AVL_Location; if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in fd.FileNames) { if (!fd.CheckFileExists) { return; } Aircraft des = new Aircraft(file); designs.Add(des); InstanceUC iuc = new InstanceUC(des); this.flowLayoutPanel1.Controls.Add(iuc); iuc.Click += new EventHandler(iuc_Click); System.Threading.Thread.Sleep(75); ConstraintsUC cuc = new ConstraintsUC(des); cuc.Height = flowLayoutPanel2.Height - 25; this.flowLayoutPanel2.Controls.Add(cuc); //RibbonButton rb = new RibbonButton(des.Configuration_Name.Substring(0, 10)); //if (des.PrimaryInstance.Geometry_Image != null) // rb.Image = des.PrimaryInstance.Geometry_Image.GetThumbnailImage(40, 40, new Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero); //aircraftButtonList.Buttons.Add(rb); //rb.Visible = true; } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.Title = "AVL Vehicle File"; fd.Multiselect = true; fd.Filter = "AVL Files (*.avl)|*.avl"; fd.InitialDirectory = Properties.Settings.Default.AVL_Location; if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in fd.FileNames) { if (!fd.CheckFileExists) return; Aircraft des = new Aircraft(file); designs.Add(des); InstanceUC iuc = new InstanceUC(des); this.flowLayoutPanel1.Controls.Add(iuc); iuc.Click += new EventHandler(iuc_Click); System.Threading.Thread.Sleep(75); ConstraintsUC cuc = new ConstraintsUC(des); cuc.Height = flowLayoutPanel2.Height-25; this.flowLayoutPanel2.Controls.Add(cuc); //RibbonButton rb = new RibbonButton(des.Configuration_Name.Substring(0, 10)); //if (des.PrimaryInstance.Geometry_Image != null) // rb.Image = des.PrimaryInstance.Geometry_Image.GetThumbnailImage(40, 40, new Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero); //aircraftButtonList.Buttons.Add(rb); //rb.Visible = true; } } }
private void newFileButton_Click(object sender, EventArgs e) { //here we create a new default airplane InputBox ib = new InputBox("Create a new aircraft design", "Name of new design:"); if(ib.ShowDialog()== System.Windows.Forms.DialogResult.OK) { if (ib.InputText == string.Empty) return; Aircraft ac = new Aircraft(); ac.Initial_AVL_File.Title = ib.InputText; //make wing surface AVL_File.Surface wingSurf = new AVL_File.Surface("Wing", ac.Initial_AVL_File); AVL_File.Surface.Section startSec = new AVL_File.Surface.Section(wingSurf); startSec.Chord = 12; wingSurf.Sections.Add(startSec); AVL_File.Surface.Section endsec = new AVL_File.Surface.Section(wingSurf); endsec.Chord = 12; endsec.Y_LeadingEdge = 20; wingSurf.Sections.Add(endsec); ac.Initial_AVL_File.Surfaces.Add(wingSurf); //make hstab surface AVL_File.Surface hSurf = new AVL_File.Surface("HTail", ac.Initial_AVL_File); AVL_File.Surface.Section startHSec = new AVL_File.Surface.Section(hSurf); startHSec.Chord = 7; startHSec.X_LeadingEdge = 30; hSurf.Sections.Add(startHSec); AVL_File.Surface.Section endHsec = new AVL_File.Surface.Section(hSurf); endHsec.Chord = 7; endHsec.X_LeadingEdge = 30; endHsec.Y_LeadingEdge = 9; hSurf.Sections.Add(endHsec); ac.Initial_AVL_File.Surfaces.Add(hSurf); ac.Initial_AVL_File.Sref = 480; ac.Initial_AVL_File.Bref = 40; ac.Initial_AVL_File.Cref = 12; ac.Initial_AVL_File.Xref = 3; this.designs.Add(ac); InstanceUC iuc = new InstanceUC(ac); this.flowLayoutPanel1.Controls.Add(iuc); iuc.Click += new EventHandler(iuc_Click); System.Threading.Thread.Sleep(75); ConstraintsUC cuc = new ConstraintsUC(ac); cuc.Height = flowLayoutPanel2.Height - 25; this.flowLayoutPanel2.Controls.Add(cuc); } }
private void iuc_OnSelected(InstanceUC sender, InstanceUC.SelectedChangedEventArgs e) { if (e.Selected) { this.selected_Aircraft = sender.aircraft; primaryVarCombobox_SelectedIndexChanged(sender, null); additionalVarCombobox_SelectedIndexChanged(sender, null); DefineControlSurfaceOptions(primaryExtraCombobox); DefineControlSurfaceOptions(additionalExtraCombobox); listView1.Items.Clear(); } }