private void StartSelectSetting() { selectedInterface = ShowSelectInterfaceWindow(); if (selectedInterface == null) { return; } if (selectedInterface.ManualSetting == InterfaceInformation.ManualSettingType.Manual) { SetPrinterManually(); } else { StartSearchPrinter(selectedInterface); } }
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); }
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()); }