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); }
public static bool IsSupportedDriverQueueName(string queueName) { ModelInformation.PrinterModel model = GetPrinterModelWithModelName(queueName); if (model != ModelInformation.PrinterModel.Unknown) { return(true); } return(false); }
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()); }
private PaperSize GetDefaultPaperSize(ModelInformation.PrinterModel moden) { PaperSize paperSize; switch (moden) { default: case ModelInformation.PrinterModel.POP10: paperSize = new PaperSize(PaperSize.PaperSizeType.TwoInch); break; } return(paperSize); }
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); }
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); }
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); }
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); }
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); }
private bool IsStaticPaperSizeModel(ModelInformation.PrinterModel model) { return(model == ModelInformation.PrinterModel.POP10); }
public static string GetModelName(ModelInformation.PrinterModel model) { ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model); return(printerInfo.modelName); }
public static ModelDictionary.PrinterInfo GetPrinterInfo(ModelInformation.PrinterModel model) { return(ModelDictionary.ModelInformationDictionary[model]); }
public static bool GetChangeDrawerOpenStatusIsEnabled(ModelInformation.PrinterModel model) { ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model); return(printerInfo.changeDrawerOpenStatusIsEnabled); }
public static string GetDefaultPortSettings(ModelInformation.PrinterModel model) { ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model); return(printerInfo.defaultPortSettings); }
public static string[] GetBtDeviceNamePrefix(ModelInformation.PrinterModel model) { ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model); return(printerInfo.btDeviceNamePrefix); }
public static string[] GetDeviceId(ModelInformation.PrinterModel model) { ModelDictionary.PrinterInfo printerInfo = GetPrinterInfo(model); return(printerInfo.deviceId); }
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); }
public static Emulation GetEmulation(ModelInformation.PrinterModel model) { return(ModelDictionary.ModelEmulationDictionary[model]); }