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 PortInfoManager[] CreatePortInfoManager(PortInfo[] portInfoArray)
        {
            List <PortInfoManager> managerList = new List <PortInfoManager>();

            foreach (PortInfo portInfo in portInfoArray)
            {
                PortInfoManager manager = new PortInfoManager(portInfo);
                managerList.Add(manager);
            }

            return(managerList.ToArray());
        }
Example #3
0
        private void StartSearchPrinter(InterfaceInformation interfaceInformation)
        {
            List <PortInfo> portInfoList = new List <PortInfo>();

            switch (interfaceInformation.ManualSetting)
            {
            case InterfaceInformation.ManualSettingType.NotManually:
                PrinterInterfaceType type = interfaceInformation.Type;
                portInfoList = SearchPrinterWithProgressBar(type);
                break;

            case InterfaceInformation.ManualSettingType.All:
                portInfoList = SearchPrinterWithProgressBar();
                break;

            case InterfaceInformation.ManualSettingType.Manual:
                break;
            }

            portListBox.ItemsSource = PortInfoManager.CreatePortInfoManager(portInfoList.ToArray());
        }
Example #4
0
        private string CreateSelectedModelDescription()
        {
            if (!IsSelectedModel)
            {
                return("Unselected State");
            }
            else
            {
                string          modelName = CreateSelectedModelName(SelectedPort);
                PortInfoManager manager   = new PortInfoManager(SelectedPort);

                if (PortInfoManager.IsSerialPort(SelectedPort))
                {
                    return(modelName + "\n" + SelectedPort.PortName + " ( " + SelectedModel.PortSettings + " )");
                }
                else
                {
                    return(modelName + "\n" + manager.Description);
                }
            }
        }
Example #5
0
        private string CreateSelectedSubModelDescription()
        {
            if (!IsSelectedSubModel)
            {
                return("Unselected State");
            }
            else
            {
                PortInfo         subPortInfo = SelectedPorts[1];
                ModelInformation subModel    = SelectedModels[1];

                string          modelName = CreateSelectedModelName(subPortInfo);
                PortInfoManager manager   = new PortInfoManager(subPortInfo);

                if (PortInfoManager.IsSerialPort(subPortInfo))
                {
                    return(modelName + "\n" + subPortInfo.PortName + " ( " + subModel.PortSettings + " )");
                }
                else
                {
                    return(modelName + "\n" + manager.Description);
                }
            }
        }