5 changed files with 0 additions and 640 deletions
@ -1,102 +0,0 @@ |
|||||
package com.dreamchaser.depository_manage.controller.EPSON; |
|
||||
|
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.MessageString; |
|
||||
import com.dreamchaser.depository_manage.EPSON.epsonException.EPDMException; |
|
||||
import com.dreamchaser.depository_manage.entity.EPSON.EPDM.MEDIA_LAYOUT_RANGE; |
|
||||
import com.dreamchaser.depository_manage.exception.MyException; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.EPDM.EPDMWrapperImpl; |
|
||||
|
|
||||
public class AddMediaLayoutDlg { |
|
||||
|
|
||||
private String _devName; |
|
||||
private String _portName; |
|
||||
private boolean _isEPDMOpen = true; |
|
||||
|
|
||||
public AddMediaLayoutDlg(String devName, String portName) |
|
||||
{ |
|
||||
|
|
||||
_devName = devName; |
|
||||
_portName = portName; |
|
||||
} |
|
||||
|
|
||||
public void AddMediaLayoutDlg_Load() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl.GetInstance().Open(_devName, _portName); |
|
||||
UpdateMediaLayoutRangeString(); |
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} |
|
||||
} |
|
||||
/** |
|
||||
* 这是更新媒体布局范围字符串的方法。 |
|
||||
*/ |
|
||||
private void UpdateMediaLayoutRangeString() { |
|
||||
MEDIA_LAYOUT_RANGE obj = EPDMWrapperImpl.GetInstance().GetMediaLayoutRangeValue(); |
|
||||
GetMediaLayoutRangeString(MediaLayoutRangeToString(obj.MinPaperWid), MediaLayoutRangeToString(obj.MaxPaperWid)); |
|
||||
GetMediaLayoutRangeString(MediaLayoutRangeToString(obj.MinLabelWid), MediaLayoutRangeToString(obj.MaxLabelWid)); |
|
||||
GetMediaLayoutRangeString(MediaLayoutRangeToString(obj.MinLabelHig), MediaLayoutRangeToString(obj.MaxLabelHig)); |
|
||||
GetMediaLayoutRangeString(MediaLayoutRangeToString(obj.MinLabelGap), MediaLayoutRangeToString(obj.MaxLabelGap)); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是获取媒体布局范围字符串的方法。 |
|
||||
* @param minRangeString 最小范围字符串。 |
|
||||
* @param maxRangeString 最大范围字符串。 |
|
||||
* @return |
|
||||
*/ |
|
||||
private String GetMediaLayoutRangeString(String minRangeString, String maxRangeString) { |
|
||||
try { |
|
||||
String rangeString = ""; |
|
||||
|
|
||||
if (minRangeString.length() > 0 && maxRangeString.length() > 0) { |
|
||||
rangeString = "( " + minRangeString + " - " + maxRangeString + " )"; |
|
||||
} |
|
||||
return rangeString; |
|
||||
} catch (Exception e) { |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是将媒体布局范围值更改为字符串的方法。 |
|
||||
* |
|
||||
* @param size 介质布局范围值(0.1mm单位) |
|
||||
* @return |
|
||||
*/ |
|
||||
private String MediaLayoutRangeToString(double size) { |
|
||||
try { |
|
||||
// Changed the size. (0.1mm to mm)
|
|
||||
double d = size / 10; |
|
||||
|
|
||||
return String.format("%01f", d); |
|
||||
} catch (Exception e) { |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 这是关闭应用的方法。 |
|
||||
*/ |
|
||||
private void ExceptionClose() { |
|
||||
EPDMClose(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是用于关闭的方法 |
|
||||
*/ |
|
||||
private void EPDMClose() { |
|
||||
if (_isEPDMOpen) { |
|
||||
EPDMWrapperImpl.GetInstance().Close(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,80 +0,0 @@ |
|||||
package com.dreamchaser.depository_manage.controller.EPSON; |
|
||||
|
|
||||
import com.dreamchaser.depository_manage.EPSON.ENS.ENSEnumrations; |
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.MessageString; |
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.Print; |
|
||||
import com.dreamchaser.depository_manage.EPSON.epsonException.ENSException; |
|
||||
import com.dreamchaser.depository_manage.exception.MyException; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.ENS.ENSWrapper; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.ENS.ENSWrapperImpl; |
|
||||
|
|
||||
public class PrintDlg { |
|
||||
private String _devName; |
|
||||
private String _portName; |
|
||||
private boolean _isENSInitialize = true; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是PrintDlg的构造函数 |
|
||||
* |
|
||||
* @param devName 选中的打印机的设备名称 |
|
||||
* @param portName 选中的打印机的端口名称 |
|
||||
*/ |
|
||||
public PrintDlg(String devName, String portName) { |
|
||||
|
|
||||
_devName = devName; |
|
||||
_portName = portName; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 获取打印机状态和打印动作。 |
|
||||
*/ |
|
||||
private void PrintButton_Click() { |
|
||||
ENSWrapperImpl obj = ENSWrapperImpl.GetInstance(); |
|
||||
// 获取打印数量
|
|
||||
int printPage = 1; |
|
||||
try { |
|
||||
try { |
|
||||
obj.Initialize(_devName, _portName); |
|
||||
} catch (Exception e) { |
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
if (_isENSInitialize) { |
|
||||
ENSEnumrations.StatusCode sc = obj.GetStatusInformation(); |
|
||||
ENSEnumrations.ErrorCode ec = obj.GetErrorInformation(); |
|
||||
ENSWrapperImpl.WARNING_INFO wc = obj.GetWarningInformation(); |
|
||||
if (!MessageString.GetPrinterStatusError(sc, ec, wc)) { |
|
||||
return; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
Print print = new Print(_devName, _portName, printPage); |
|
||||
print.DoPrinting(); |
|
||||
} catch (Exception e) { |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} finally { |
|
||||
ENSClose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
private void ENSClose() { |
|
||||
if (_isENSInitialize) { |
|
||||
try { |
|
||||
ENSWrapperImpl.GetInstance().Release(); |
|
||||
} catch (Exception e) { |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// This is the method that close application.
|
|
||||
/// </summary>
|
|
||||
private void ExceptionClose() { |
|
||||
ENSClose(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,279 +0,0 @@ |
|||||
package com.dreamchaser.depository_manage.controller.EPSON; |
|
||||
|
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.MessageString; |
|
||||
import com.dreamchaser.depository_manage.EPSON.epsonException.EPDMException; |
|
||||
import com.dreamchaser.depository_manage.entity.EPSON.EPDM.MEDIA_LAYOUT; |
|
||||
import com.dreamchaser.depository_manage.entity.EPSON.EPDM.MEDIA_TYPE; |
|
||||
import com.dreamchaser.depository_manage.entity.EPSON.EPDM.PRINT_QUALITY; |
|
||||
import com.dreamchaser.depository_manage.exception.MyException; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.EPDM.EPDMWrapper; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.EPDM.EPDMWrapperImpl; |
|
||||
import org.springframework.stereotype.Controller; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.HashMap; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
|
|
||||
public class PrintSettingsDlg { |
|
||||
private List<MEDIA_LAYOUT> _mediaLayoutList; |
|
||||
private List<MEDIA_TYPE> _mediaTypeList; |
|
||||
private List<PRINT_QUALITY> _printQualityList; |
|
||||
private String _devName; |
|
||||
private String _portName; |
|
||||
private boolean _isEPDMOpen = true; |
|
||||
|
|
||||
/** |
|
||||
* 这是PrintSettingsDlg的构造函数。 |
|
||||
* @param devName |
|
||||
* @param portName |
|
||||
*/ |
|
||||
public PrintSettingsDlg(String devName, String portName) |
|
||||
{ |
|
||||
|
|
||||
_devName = devName; |
|
||||
_portName = portName; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 初始化加载方法 |
|
||||
*/ |
|
||||
public Map<String,List<String>> PrintSettings_Load() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl.GetInstance().Open(_devName, _portName); |
|
||||
List<String> StrMediaLayoutList = UpdateMediaLayoutComboBox(); |
|
||||
List<String> StrMediaTypeList = UpdateMediaTypeComboBox(); |
|
||||
List<String> StrPrintQualityList = UpdatePrintQualityComboBox(); |
|
||||
Map<String,List<String>> listMap = new HashMap<>(); |
|
||||
listMap.put("StrMediaLayoutList",StrMediaLayoutList); |
|
||||
listMap.put("StrMediaTypeList",StrMediaTypeList); |
|
||||
listMap.put("StrPrintQualityList",StrPrintQualityList); |
|
||||
return listMap; |
|
||||
} |
|
||||
catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是在MediaTypeComboBox更改操作上实现更新打印质量列表的事件处理程序。 |
|
||||
*/ |
|
||||
private void MediaTypeComboBox_SelectedIndexChanged() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl obj = EPDMWrapperImpl.GetInstance(); |
|
||||
// int index = MediaTypeComboBox.SelectedIndex;
|
|
||||
int index = 1; // 获取选中的数据的下标
|
|
||||
|
|
||||
obj.SetMediaType(_mediaTypeList.get(index).getMediaTypeID()); |
|
||||
|
|
||||
// 同时获取输出index
|
|
||||
_printQualityList = obj.GetPrintQualityList(index); |
|
||||
if (_printQualityList == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
List<String> StrPrintQualityList = new ArrayList<>(); |
|
||||
|
|
||||
// PrintQualityComboBox.Items.Clear();
|
|
||||
|
|
||||
for (PRINT_QUALITY printQuality : _printQualityList) |
|
||||
{ |
|
||||
StrPrintQualityList.add(printQuality.getStrPrintQuality()); |
|
||||
// PrintQualityComboBox.Items.Add(printQuality.StrPrintQuality);
|
|
||||
// this.Controls.Add(PrintQualityComboBox);
|
|
||||
} |
|
||||
// 设置选中的下标
|
|
||||
// PrintQualityComboBox.SelectedIndex = index;
|
|
||||
} catch (Exception ep) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
private void ApplyButton_Click() |
|
||||
{ |
|
||||
EPDMWrapperImpl obj = EPDMWrapperImpl.GetInstance(); |
|
||||
try |
|
||||
{ |
|
||||
int index = 0; |
|
||||
|
|
||||
// index为选中的媒体布局下标
|
|
||||
// index = MediaLayoutComboBox.SelectedIndex;
|
|
||||
obj.SetMediaLayout(_mediaLayoutList.get(index).getMediaLayoutID()); |
|
||||
|
|
||||
// index为选中的媒体类型下标
|
|
||||
// index = MediaTypeComboBox.SelectedIndex;
|
|
||||
obj.SetMediaType(_mediaTypeList.get(index).getMediaTypeID()); |
|
||||
//
|
|
||||
// index为选中的打印质量下标
|
|
||||
// index = PrintQualityComboBox.SelectedIndex;
|
|
||||
if (index >= 0) |
|
||||
{ |
|
||||
// 如果选中的大于0
|
|
||||
obj.SetPrintQuality(_printQualityList.get(index).getPrintQualityID()); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
// 否则设置为将打印质量设置为不可用
|
|
||||
// PrintQualityComboBox.Enabled = false;
|
|
||||
} |
|
||||
obj.UpdateDevMode(); |
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} |
|
||||
finally |
|
||||
{ |
|
||||
EPDMClose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是更新打印质量组合框列表的方法。 |
|
||||
*/ |
|
||||
private List<String> UpdatePrintQualityComboBox() |
|
||||
{ |
|
||||
// 用于保存当前打印质量
|
|
||||
List<String> StrPrintQualityList = new ArrayList<>(); |
|
||||
try |
|
||||
{ |
|
||||
Integer index = 0; |
|
||||
|
|
||||
_printQualityList = EPDMWrapperImpl.GetInstance().GetPrintQualityList( index); |
|
||||
if (_printQualityList == null) |
|
||||
{ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
for (PRINT_QUALITY printQuality : _printQualityList) |
|
||||
{ |
|
||||
StrPrintQualityList.add(printQuality.getStrPrintQuality()); |
|
||||
} |
|
||||
return StrPrintQualityList; |
|
||||
// index 是选中的打印质量
|
|
||||
} |
|
||||
catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 这是更新媒体类型组合框列表的方法。 |
|
||||
*/ |
|
||||
private List<String> UpdateMediaTypeComboBox() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
int index = 0; |
|
||||
|
|
||||
_mediaTypeList = EPDMWrapperImpl.GetInstance().GetMediaTypeList(index); |
|
||||
if (_mediaTypeList == null) |
|
||||
{ |
|
||||
return null; |
|
||||
} |
|
||||
List<String> StrMediaTypeList = new ArrayList<>(); |
|
||||
|
|
||||
|
|
||||
for (MEDIA_TYPE mediaType : _mediaTypeList) |
|
||||
{ |
|
||||
// MediaTypeComboBox.Items.Add(mediaType.StrMediaType);
|
|
||||
// this.Controls.Add(MediaTypeComboBox);
|
|
||||
StrMediaTypeList.add(mediaType.getStrMediaType()); |
|
||||
} |
|
||||
|
|
||||
return StrMediaTypeList; |
|
||||
// MediaTypeComboBox.SelectedIndex = index;
|
|
||||
} |
|
||||
catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是更新媒体布局组合框列表的方法。 |
|
||||
*/ |
|
||||
private List<String> UpdateMediaLayoutComboBox() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
int index = 0; |
|
||||
|
|
||||
_mediaLayoutList = EPDMWrapperImpl.GetInstance().GetMediaLayoutList(index); |
|
||||
if (_mediaLayoutList == null) |
|
||||
{ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
List<String> StrMediaLayoutList = new ArrayList<>(); |
|
||||
|
|
||||
|
|
||||
for (MEDIA_LAYOUT mediaLayout : _mediaLayoutList) |
|
||||
{ |
|
||||
StrMediaLayoutList.add(mediaLayout.getStrMediaLayout()); |
|
||||
} |
|
||||
// index是选中的下标
|
|
||||
return StrMediaLayoutList; |
|
||||
|
|
||||
} |
|
||||
catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是关闭PrintSettingsDlg的方法。 |
|
||||
*/ |
|
||||
private void EPDMClose() |
|
||||
{ |
|
||||
if (_isEPDMOpen) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl.GetInstance().Close(); |
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是关闭对话的方法 |
|
||||
*/ |
|
||||
private void ExceptionClose() |
|
||||
{ |
|
||||
EPDMClose(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,80 +0,0 @@ |
|||||
package com.dreamchaser.depository_manage.controller.EPSON; |
|
||||
|
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.MessageString; |
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.SelectPrinterInfo; |
|
||||
import com.dreamchaser.depository_manage.exception.MyException; |
|
||||
import com.dreamchaser.depository_manage.pojo.RestResponse; |
|
||||
import com.dreamchaser.depository_manage.utils.CrudUtil; |
|
||||
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
||||
import org.springframework.stereotype.Controller; |
|
||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
import java.io.*; |
|
||||
import java.util.ArrayList; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
@RestController |
|
||||
@RequestMapping("/Epson") |
|
||||
public class PrinterIndexDlg { |
|
||||
|
|
||||
private List<SelectPrinterInfo.PRINTER_INFO> _printerInfoList; |
|
||||
|
|
||||
private PrintSettingsDlg printSettingsDlg; |
|
||||
|
|
||||
/** |
|
||||
* 用于获取当前电脑的爱普生打印机列表 |
|
||||
* @return |
|
||||
*/ |
|
||||
@PostMapping("/GetPrinterInfoList") |
|
||||
public RestResponse GetPrinterInfoList(){ |
|
||||
try { |
|
||||
List<String> list = new ArrayList<>(); |
|
||||
_printerInfoList = SelectPrinterInfo.GetPrinterInfoList(); |
|
||||
if (_printerInfoList.size() == 0) { |
|
||||
MessageString.GetSystemError(MessageString.STATE_DRIVER_NOT_FOUND); |
|
||||
return new RestResponse(null); |
|
||||
} else { |
|
||||
for (SelectPrinterInfo.PRINTER_INFO printerInfo : _printerInfoList) |
|
||||
{ |
|
||||
list.add(printerInfo.devName); |
|
||||
} |
|
||||
} |
|
||||
return new RestResponse(list); |
|
||||
}catch (Exception e){ |
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 用于初始化打印机设置页面 |
|
||||
* @param map 选中的打印机 |
|
||||
* @return |
|
||||
*/ |
|
||||
@PostMapping("/PrintSettingLoad") |
|
||||
public RestResponse PrintSettingLoad(@RequestBody Map<String,Object> map){ |
|
||||
if(map.containsKey("index")){ |
|
||||
Integer index = ObjectFormatUtil.toInteger(map.get("index")); |
|
||||
printSettingsDlg = new PrintSettingsDlg(_printerInfoList.get(index).devName,_printerInfoList.get(index).portName); |
|
||||
return new RestResponse(200); |
|
||||
}else{ |
|
||||
throw new MyException("缺少必要参数"); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 用于初始化打印机设置页面中的列表 |
|
||||
* @return |
|
||||
*/ |
|
||||
@PostMapping("/updatePrintSettingPage") |
|
||||
public RestResponse updatePrintSettingPage(){ |
|
||||
Map<String, List<String>> listMap = printSettingsDlg.PrintSettings_Load(); |
|
||||
return new RestResponse(listMap); |
|
||||
} |
|
||||
} |
|
||||
@ -1,99 +0,0 @@ |
|||||
package com.dreamchaser.depository_manage.controller.EPSON; |
|
||||
|
|
||||
import com.dreamchaser.depository_manage.EPSON.Other.MessageString; |
|
||||
import com.dreamchaser.depository_manage.EPSON.epsonException.EPDMException; |
|
||||
import com.dreamchaser.depository_manage.entity.EPSON.EPDM.MEDIA_POSITION; |
|
||||
import com.dreamchaser.depository_manage.exception.MyException; |
|
||||
import com.dreamchaser.depository_manage.service.impl.EPSON.EPDM.EPDMWrapperImpl; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.List; |
|
||||
|
|
||||
public class SetRollPaperDlg { |
|
||||
private List<MEDIA_POSITION> _mediaPositionList; |
|
||||
private String _devName; |
|
||||
private String _portName; |
|
||||
private boolean _isEPDMOpen = true; |
|
||||
|
|
||||
public SetRollPaperDlg(String _devName, String _portName) { |
|
||||
this._devName = _devName; |
|
||||
this._portName = _portName; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是加载时的方法 |
|
||||
*/ |
|
||||
private void SetRollPaperDlg_Load(){ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl.GetInstance().Open(_devName, _portName); |
|
||||
UpdateMediaPositionComboBox(); |
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是更新媒体位置组合框列表的方法 |
|
||||
*/ |
|
||||
private void UpdateMediaPositionComboBox(){ |
|
||||
List<String> strMediaPositionList = new ArrayList<>(); |
|
||||
try |
|
||||
{ |
|
||||
Integer index = 0; |
|
||||
|
|
||||
_mediaPositionList = EPDMWrapperImpl.GetInstance().GetMediaPositionList(index); |
|
||||
if (_mediaPositionList == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
for (MEDIA_POSITION mediaPosition : _mediaPositionList) |
|
||||
{ |
|
||||
strMediaPositionList.add(mediaPosition.StrMediaPosition); |
|
||||
} |
|
||||
// 最终选中
|
|
||||
// MediaPositionComboBox.SelectedIndex = index;
|
|
||||
|
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
ExceptionClose(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 这是用于关闭EPDM的方法 |
|
||||
*/ |
|
||||
private void EPDMClose() |
|
||||
{ |
|
||||
if (_isEPDMOpen) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
EPDMWrapperImpl.GetInstance().Close(); |
|
||||
} catch (Exception e) |
|
||||
{ |
|
||||
// Error handling.
|
|
||||
throw new MyException(e.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 这是用于关闭的的方法。 |
|
||||
*/ |
|
||||
private void ExceptionClose() |
|
||||
{ |
|
||||
EPDMClose(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
Loading…
Reference in new issue