コード例 #1
0
        private void StartSelectSetting()
        {
            selectedInterface = ShowSelectInterfaceWindow();

            if (selectedInterface == null)
            {
                return;
            }

            if (selectedInterface.ManualSetting == InterfaceInformation.ManualSettingType.Manual)
            {
                SetPrinterManually();
            }
            else
            {
                StartSearchPrinter(selectedInterface);
            }
        }
コード例 #2
0
        private InterfaceInformation ShowSelectInterfaceWindow()
        {
            InterfaceInformation interfaceInformation = new InterfaceInformation();

            SelectSettingWindow selectInterfaceWindow = new SelectSettingWindow(FindResource("SelectInterfaceWindow") as SelectSettingWindow);

            bool?result = selectInterfaceWindow.ShowDialog();

            if (result == true)
            {
                interfaceInformation = selectInterfaceWindow.SelecedInterfaceType;
            }
            else
            {
                return(null);
            }

            return(interfaceInformation);
        }
コード例 #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());
        }