/// <summary>
 /// Создать пдф по координатам и формату
 /// </summary>
 public IResultApplication PrintStamp(IStamp stampContainer, ColorPrintApplication colorPrint, string prefixSearchPaperSize) =>
 new ResultAppValue <IStamp>(stampContainer, new ErrorApplication(ErrorApplicationType.StampNotFound, "Штамп не найден")).
 ResultValueContinue(stamp => stamp is IStampMicrostation,
                     okFunc: stamp => (IStampMicrostation)stamp,
                     badFunc: _ => new ErrorApplication(ErrorApplicationType.StampNotFound, "Штамп не соответствует формату Microstation")).
 ResultVoidOk(stamp => stamp.StampCellElement.ModelMicrostation.Activate()).
 ResultValueOkBind(stamp => ApplicationMicrostation.SetPrintingFenceByRange(stamp.StampCellElement.Range).
                   ToResultApplicationValue(stamp)).
 ResultValueOkBind(stamp => ApplicationMicrostation.SetPrinterPaperSize(stamp.PaperSize, prefixSearchPaperSize).
                   ToResultApplicationValue(stamp))?.
 ResultVoidOk(stamp => ApplicationMicrostation.SetPrintingOrientation(stamp.Orientation)).
 ResultVoidOk(stamp => ApplicationMicrostation.SetPrintScale(stamp.StampCellElement.UnitScale)).
 ResultVoidOk(_ => ApplicationMicrostation.SetPrintColor(colorPrint)).
 ResultVoidOk(_ => ApplicationMicrostation.PrintCommand()).
 ToResultApplication();
        /// <summary>
        /// Установить цвет печати
        /// </summary>
        public void SetPrintColor(ColorPrintApplication colorPrint)
        {
            void SetColorMode(string colorCommand) => Application.CadInputQueue.SendCommand($"PRINT colormode {colorCommand}");

            switch (colorPrint)
            {
            case ColorPrintApplication.BlackAndWhite:
                SetColorMode("monochrome");
                return;

            case ColorPrintApplication.GrayScale:
                SetColorMode("grayscale");
                return;

            case ColorPrintApplication.Color:
                SetColorMode("color");
                return;

            default:
                throw new InvalidEnumArgumentException(nameof(colorPrint), (int)colorPrint, typeof(ColorPrintApplication));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Команда печати
 /// </summary>
 public IResultApplication PrintStamp(IStamp stamp, ColorPrintApplication colorPrint, string prefixSearchPaperSize) =>
 new ResultApplication().
 Void(_ => ApplicationOffice.PrintCommand());