private void toolStripMenuItemMoveToStore_Click(object sender, EventArgs e) { var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(_currentBaseComponent.ParentAircraftId); var form = new MoveComponentForm(new Component[] { _currentBaseComponent }, aircraft); if (form.ShowDialog() == DialogResult.OK) { InvokeComponentMovedTo(); } }
private void MoveToCommand() { if (_directivesViewer.SelectedItems.Count == 0) { return; } if (GlobalObjects.AircraftsCore.GetAircraftsCount() == 0 && GlobalObjects.CasEnvironment.Stores.Count == 0) { MessageBox.Show("You dont remove this component because you dont have a aircrafts", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var components = new CommonCollection <Component>(); foreach (var o in _directivesViewer.SelectedItems) { IDirective dir; if (o is NextPerformance) { dir = ((NextPerformance)o).Parent; } else { dir = o as IDirective; } if (dir == null) { continue; } if (dir is ComponentDirective && !components.Contains(((ComponentDirective)dir).ParentComponent)) { components.Add(((ComponentDirective)dir).ParentComponent); } else if (dir is Component && !components.Contains((Component)dir)) { components.Add((Component)dir); } } if (components.Count <= 0) { return; } var dlg = new MoveComponentForm(components.ToArray(), CurrentStore); dlg.Text = "Move " + (components.Count > 1 ? "components" : "component " + components[0].Description) + " to aircraft"; dlg.ShowDialog(); if (dlg.DialogResult == DialogResult.OK) { AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork; //AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoFilteringWork; AnimatedThreadWorker.DoWork += AnimatedThreadWorkerDoWork; AnimatedThreadWorker.RunWorkerAsync(); } }