Beispiel #1
0
        public void StyleSecondPriorityCharacterEncoding(string objectIdentifier, string type, IReactPromise <JSValue.Void> promise)
        {
            if (!GetObject(objectIdentifier, out PageModeBuilder nativeObject) ||
                !StarIO10ValueConverter.ToPrinterCharacterEncodingType(type, out CharacterEncodingType nativeType))
            {
                promise.Reject(new ReactError());
                return;
            }

            nativeObject.StyleSecondPriorityCharacterEncoding(nativeType);

            promise.Resolve();
        }
Beispiel #2
0
        public void ActionPrintBarcode(string objectIdentifier, string content, string symbology, bool printHri, int barDots, string barRatioLevel, double height, IReactPromise <JSValue.Void> promise)
        {
            if (!GetObject(objectIdentifier, out PageModeBuilder nativeObject) ||
                !StarIO10ValueConverter.ToPrinterBarcodeParameter(content, symbology, printHri, barDots, barRatioLevel, height, out BarcodeParameter parameter))
            {
                promise.Reject(new ReactError());
                return;
            }

            nativeObject.ActionPrintBarcode(parameter);

            promise.Resolve();
        }
Beispiel #3
0
        public void StyleMagnification(string objectIdentifier, int width, int height, IReactPromise <JSValue.Void> promise)
        {
            if (!GetObject(objectIdentifier, out PageModeBuilder nativeObject) ||
                !StarIO10ValueConverter.ToMagnificationParameter(width, height, out MagnificationParameter parameter))
            {
                promise.Reject(new ReactError());
                return;
            }

            nativeObject.StyleMagnification(parameter);

            promise.Resolve();
        }
        public void AddPageMode(string objectIdentifier, double x, double y, double width, double height, string pageModeBuilderIdentifier, IReactPromise <JSValue.Void> promise)
        {
            if (!GetObject(objectIdentifier, out PrinterBuilder nativeObject) ||
                !PageModeBuilderWrapper.GetObject(pageModeBuilderIdentifier, out PageModeBuilder pageModeBuilder) ||
                !StarIO10ValueConverter.ToPrinterPageModeAreaParameter(x, y, width, height, out PageModeAreaParameter nativeParameter))
            {
                promise.Reject(new ReactError());
                return;
            }

            nativeObject.AddPageMode(nativeParameter, pageModeBuilder);

            promise.Resolve();
        }
        public void Init(string[] interfaceTypes, IReactPromise <string> promise)
        {
            List <InterfaceType> nativeInterfaceTypes = new List <InterfaceType>();

            foreach (string interfaceType in interfaceTypes)
            {
                if (!StarIO10ValueConverter.ToInterfaceType(interfaceType, out InterfaceType nativeInterfaceType))
                {
                    promise.Reject(new ReactError());
                    return;
                }

                nativeInterfaceTypes.Add(nativeInterfaceType);
            }

            IStarDeviceDiscoveryManager nativeObject = StarDeviceDiscoveryManagerFactory.Create(nativeInterfaceTypes);

            SetObject(nativeObject, out string objectIdentifier);

            nativeObject.PrinterFound += (sender, e) =>
            {
                if (!StarIO10ValueConverter.ToString(e.Printer.ConnectionSettings.InterfaceType, out string interfaceTypeString) ||
                    !StarIO10ValueConverter.ToString(e.Printer.Information.Model, out string modelString) ||
                    !StarIO10ValueConverter.ToString(e.Printer.Information.Emulation, out string emulationString))
                {
                    return;
                }

                PrinterFound(new PrinterFoundParameter()
                {
                    identifier           = objectIdentifier,
                    interfaceType        = interfaceTypeString,
                    connectionIdentifier = e.Printer.ConnectionSettings.Identifier,
                    model     = modelString,
                    emulation = emulationString
                });
            };
            nativeObject.DiscoveryFinished += (sender, e) =>
            {
                DiscoveryFinished(new EventParameter()
                {
                    identifier = objectIdentifier
                });
            };

            promise.Resolve(objectIdentifier);
        }