コード例 #1
0
        private ModelInformation DecideModel(PortInfo portInfo)
        {
            ModelInformation.PrinterModel model = ModelFinder.FindPrinterModel(portInfo.ModelName);

            bool isDecideModel = false;

            if (model != ModelInformation.PrinterModel.Unknown)
            {
                isDecideModel = ShowModelConfirmWindow(model);
            }

            ModelInformation modelInformation;

            if (isDecideModel)
            {
                modelInformation = new ModelInformation(model);
            }
            else
            {
                modelInformation = ShowSelectModelWindow();
            }

            if (modelInformation == null)
            {
                return(null);
            }

            if (modelInformation.ChangeDrawerOpenStatusIsEnabled)
            {
                bool?drawerOpenStatus = ShowSelectDrawerOpenStatusWindow();

                if (drawerOpenStatus == null)
                {
                    return(null);
                }

                modelInformation.DrawerOpenStatus = (bool)drawerOpenStatus;
            }
            else
            {
                modelInformation.DrawerOpenStatus = true;
            }

            if (PortInfoManager.IsSerialPort(portInfo))
            {
                string portSettings = ShowManualPortSettingsWindowForSerialPort();

                if (portSettings == null)
                {
                    return(null);
                }

                modelInformation.PortSettings = portSettings;
            }

            return(modelInformation);
        }
コード例 #2
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static bool IsSupportedDriverQueueName(string queueName)
        {
            ModelInformation.PrinterModel model = GetPrinterModelWithModelName(queueName);

            if (model != ModelInformation.PrinterModel.Unknown)
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        private bool ShowModelConfirmWindow(ModelInformation.PrinterModel model)
        {
            ModelInformation modelInformation = new ModelInformation(model);

            SelectSettingWindow confirmWindow = new SelectSettingWindow();

            confirmWindow.Title = "Confirm";
            confirmWindow.AcceptButtonContent = "Yes";
            confirmWindow.CancelButtonContent = "No";
            confirmWindow.SettingTitle        = "Is your printer " + modelInformation.SimpleModelName + "?";

            return((bool)confirmWindow.ShowDialog());
        }
コード例 #4
0
        private PaperSize GetDefaultPaperSize(ModelInformation.PrinterModel moden)
        {
            PaperSize paperSize;

            switch (moden)
            {
            default:
            case ModelInformation.PrinterModel.POP10:
                paperSize = new PaperSize(PaperSize.PaperSizeType.TwoInch);
                break;
            }

            return(paperSize);
        }
コード例 #5
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static ModelInformation.PrinterModel GetPrinterModelWithBtDeviceNamePrefix(string btDeviceNamePrefix)
        {
            foreach (KeyValuePair <ModelInformation.PrinterModel, ModelDictionary.PrinterInfo> pair in ModelDictionary.ModelInformationDictionary)
            {
                ModelInformation.PrinterModel model = pair.Key;
                ModelDictionary.PrinterInfo   info  = pair.Value;

                string[] refBtDeviceNamePrefix = info.btDeviceNamePrefix;

                if (StartsWith(btDeviceNamePrefix, refBtDeviceNamePrefix))
                {
                    return(model);
                }
            }

            return(ModelInformation.PrinterModel.Unknown);
        }
コード例 #6
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static ModelInformation.PrinterModel GetPrinterModelWithDeviceId(string deviceId)
        {
            foreach (KeyValuePair <ModelInformation.PrinterModel, ModelDictionary.PrinterInfo> pair in ModelDictionary.ModelInformationDictionary)
            {
                ModelInformation.PrinterModel model = pair.Key;
                ModelDictionary.PrinterInfo   info  = pair.Value;

                string[] refDeviceId = info.deviceId;

                if (ContainsString(refDeviceId, deviceId))
                {
                    return(model);
                }
            }

            return(ModelInformation.PrinterModel.Unknown);
        }
コード例 #7
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static ModelInformation.PrinterModel GetPrinterModelWithModelName(string modelName)
        {
            foreach (KeyValuePair <ModelInformation.PrinterModel, ModelDictionary.PrinterInfo> pair in ModelDictionary.ModelInformationDictionary)
            {
                ModelInformation.PrinterModel model = pair.Key;
                ModelDictionary.PrinterInfo   info  = pair.Value;

                string refModelName = info.modelName;

                if (CompareString(modelName, refModelName))
                {
                    return(model);
                }
            }

            return(ModelInformation.PrinterModel.Unknown);
        }
コード例 #8
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static ModelInformation.PrinterModel GetPrinterModelWithDeviceIdAndNicName(string deviceId, string nicName)
        {
            foreach (KeyValuePair <ModelInformation.PrinterModel, ModelDictionary.PrinterInfo> pair in ModelDictionary.ModelInformationDictionary)
            {
                ModelInformation.PrinterModel model = pair.Key;
                ModelDictionary.PrinterInfo   info  = pair.Value;

                string[] refDeviceId = info.deviceId;
                string   refNicName  = info.nicName;

                if (ContainsString(refDeviceId, deviceId) && CompareString(refNicName, nicName))
                {
                    return(model);
                }
            }

            return(ModelInformation.PrinterModel.Unknown);
        }
コード例 #9
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static ModelInformation.PrinterModel GetPrinterModelWithSomothingName(string somethingName)
        {
            ModelInformation.PrinterModel model = ModelInformation.PrinterModel.Unknown;

            model = GetPrinterModelWithModelName(somethingName);

            if (model != ModelInformation.PrinterModel.Unknown)
            {
                return(model);
            }

            model = GetPrinterModelWithDeviceId(somethingName);

            if (model != ModelInformation.PrinterModel.Unknown)
            {
                return(model);
            }

            model = GetPrinterModelWithBtDeviceNamePrefix(somethingName);

            return(model);
        }
コード例 #10
0
 private bool IsStaticPaperSizeModel(ModelInformation.PrinterModel model)
 {
     return(model == ModelInformation.PrinterModel.POP10);
 }
コード例 #11
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static string GetModelName(ModelInformation.PrinterModel model)
        {
            ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model);

            return(printerInfo.modelName);
        }
コード例 #12
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
 public static ModelDictionary.PrinterInfo GetPrinterInfo(ModelInformation.PrinterModel model)
 {
     return(ModelDictionary.ModelInformationDictionary[model]);
 }
コード例 #13
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static bool GetChangeDrawerOpenStatusIsEnabled(ModelInformation.PrinterModel model)
        {
            ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model);

            return(printerInfo.changeDrawerOpenStatusIsEnabled);
        }
コード例 #14
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static string GetDefaultPortSettings(ModelInformation.PrinterModel model)
        {
            ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model);

            return(printerInfo.defaultPortSettings);
        }
コード例 #15
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static string[] GetBtDeviceNamePrefix(ModelInformation.PrinterModel model)
        {
            ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model);

            return(printerInfo.btDeviceNamePrefix);
        }
コード例 #16
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
        public static string[] GetDeviceId(ModelInformation.PrinterModel model)
        {
            ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model);

            return(printerInfo.deviceId);
        }
コード例 #17
0
        public override void Execute(object parameter)
        {
            Emulation emulation = SharedInformationManager.GetSelectedEmulation();

            ModelInformation.PrinterModel model = SharedInformationManager.SelectedModelManager.SelectedModel.Model;

            if (ModelConfirmMessage != null)
            {
                bool result = Util.ShowConfirmMessage("Confirm", ModelConfirmMessage);

                if (!result)
                {
                    return;
                }
            }

            if (SelectLanguageWindow != null)
            {
                Language selectedLanguage = ShowSelectLanguageWindow();

                if (selectedLanguage.Type == Language.LanguageType.Unknown)
                {
                    return;
                }
                else
                {
                    SharedInformationManager.SetLanguage(selectedLanguage);
                }
            }
            else if (!IsMaitainReceiptsSettings)
            {
                SharedInformationManager.SetLanguage(new Language());
            }

            if (SelectPaperSizeWindow != null)
            {
                PaperSize selectedPaperSize;

                if (IsStaticPaperSizeEmulation(emulation) &&
                    IsStaticPaperSizeForEmulation)
                {
                    selectedPaperSize = GetDefaultPaperSize(emulation);
                }
                else if (IsStaticPaperSizeModel(model) &&
                         IsStaticPaperSizeForModel)
                {
                    selectedPaperSize = GetDefaultPaperSize(model);
                }
                else
                {
                    selectedPaperSize = ShowSelectPaperSizeWindow();
                }

                if (selectedPaperSize.Type == PaperSize.PaperSizeType.Unknown)
                {
                    return;
                }
                else
                {
                    SharedInformationManager.SetPaperSize(selectedPaperSize);
                }
            }
            else if (!IsMaitainReceiptsSettings)
            {
                SharedInformationManager.SetPaperSize(new PaperSize());
            }

            base.Execute(parameter);
        }
コード例 #18
0
ファイル: ModelFinder.cs プロジェクト: SE343TC/starprntsdk1
 public static Emulation GetEmulation(ModelInformation.PrinterModel model)
 {
     return(ModelDictionary.ModelEmulationDictionary[model]);
 }