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);
        }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
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);
                }
            }
        }