protected override void CreateWorkPakage() { var selectedItems = new CommonCollection <NonRoutineJob>(); foreach (NonRoutineJob o in DirectivesViewer.SelectedItems) { selectedItems.CompareAndAdd(o); } try { string message; var wp = GlobalObjects.WorkPackageCore.AddWorkPakage(selectedItems, CurrentAircraft, out message); if (wp == null) { MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } base.AddWorkPackageToContextMenu(wp); var refArgs = new ReferenceEventArgs { TypeOfReflection = ReflectionTypes.DisplayInNew, DisplayerText = CurrentAircraft != null ? CurrentAircraft.RegistrationNumber + "." + wp.Title : wp.Title, RequestedEntity = new WorkPackageScreen(wp) }; InvokeDisplayerRequested(refArgs); } catch (Exception ex) { Program.Provider.Logger.Log("error while create Work Package", ex); } }
protected override void OpenItem() { var selected = new CommonCollection <NonRoutineJob>(); foreach (NonRoutineJob o in DirectivesViewer.SelectedItems) { selected.CompareAndAdd(o); } foreach (NonRoutineJob t in selected) { var dp = ScreenAndFormManager.GetEditScreenOrForm(t); dp.Form.Show(); } selected.Clear(); }
protected override void AddToWorkPackage(WorkPackage wp) { var selected = new CommonCollection <NonRoutineJob>(); foreach (NonRoutineJob o in DirectivesViewer.SelectedItems) { selected.CompareAndAdd(o); } if (MessageBox.Show("Add item to Work Package: " + wp.Title + "?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { string message; if (!GlobalObjects.WorkPackageCore.AddToWorkPakage(selected, wp.ItemId, CurrentAircraft, out message)) { MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBox.Show("Items added successfully. Open work package?", (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { ReferenceEventArgs refArgs = new ReferenceEventArgs(); refArgs.TypeOfReflection = ReflectionTypes.DisplayInNew; refArgs.DisplayerText = CurrentAircraft != null ? CurrentAircraft.RegistrationNumber + "." + wp.Title : wp.Title; refArgs.RequestedEntity = new WorkPackageScreen(wp); InvokeDisplayerRequested(refArgs); } } catch (Exception ex) { Program.Provider.Logger.Log("error while create Work Package", ex); } } }
private void ToolStripMenuItemOpenClick(object sender, EventArgs e) { CommonCollection <MaintenanceDirective> selected = new CommonCollection <MaintenanceDirective>(); foreach (MaintenanceDirective o in _directivesViewer.SelectedItems) { selected.CompareAndAdd(o); } foreach (MaintenanceDirective t in selected) { var refE = new ReferenceEventArgs(); var dp = ScreenAndFormManager.GetMaintenanceDirectiveScreen(t); refE.SetParameters(dp); InvokeDisplayerRequested(refE); } selected.Clear(); }