public IEnumerable <IResult> PrintDisplacementWaybill() { var req = new RequirementWaybill(); yield return(new DialogResult(req)); if (req.requirementWaybillName == null) { yield break; } yield return(new DialogResult(new PrintPreviewViewModel(new PrintResult("Требование-накладная", new DisplacementWDocument(Doc, Lines, Session.Query <WaybillSettings>().First(), req.requirementWaybillName))), fullScreen: true)); }
PrintResult IPrintable.Print() { var docs = new List <BaseDocument>(); if (!IsView) { var printItems = PrintMenuItems.Where(i => i.IsChecked).ToList(); if (!printItems.Any()) { printItems.Add(PrintMenuItems.First()); } foreach (var item in printItems) { if ((string)item.Header == "Печать документов") { docs.Add(new DisplacementDocument(Lines.ToArray())); } if ((string)item.Header == "Ярлыки") { Tags(); } if ((string)item.Header == "Требование-накладная") { var req = new RequirementWaybill(); var reqDialog = new DialogResult(req); reqDialog.Execute(null); if (req.requirementWaybillName != null) { docs.Add(new DisplacementWDocument(Doc, Lines, Session.Query <WaybillSettings>().First(), req.requirementWaybillName)); } } if ((string)item.Header == "Внутреннее-перемещение") { docs.Add(new DisplacementDocumentWaybill(Doc, Lines, Session.Query <WaybillSettings>().First())); } if ((string)item.Header == "Протокол согласования цен ЖНВЛП") { var req = new RequirementNegotiationProtocol(); var reqDialog = new DialogResult(req); reqDialog.Execute(null); if (req.Fio != null) { docs.Add(new PriceNegotiationProtocol(Doc, Lines, req.Fio)); } } } return(new PrintResult(DisplayName, docs, PrinterName)); } if (String.IsNullOrEmpty(LastOperation) || LastOperation == "Печать документов") { Coroutine.BeginExecute(Print().GetEnumerator()); } if (LastOperation == "Ярлыки") { Tags(); } if (LastOperation == "Требование-накладная") { Coroutine.BeginExecute(PrintDisplacementWaybill().GetEnumerator()); } if (LastOperation == "Внутреннее-перемещение") { Coroutine.BeginExecute(PrintDisplacementDocumentWaybill().GetEnumerator()); } if (LastOperation == "Протокол согласования цен ЖНВЛП") { Coroutine.BeginExecute(PrintPriceNegotiationProtocol().GetEnumerator()); } return(null); }