/// <summary> /// close dongle before form closing /// </summary> private void DongleForm_FormClosing(object sender, FormClosingEventArgs e) { if (this.dongle != null) { this.dongle.Dispose(); this.dongle = null; } }
public static IDongle GetDongle() { if (ContextManager.dongle == null) { ContextManager.dongle = applicationContext.GetObject <IDongle>(configSelected[ContextConst.DongleSelectedKey]); } return(ContextManager.dongle); }
private void DongleForm_Load(object sender, EventArgs e) { this.logger = ContextManager.GetLogger(); this.dongle = ContextManager.GetDongle(); this.UserRootKey.Text = BitConverter.ToString(ByteUtil.Malloc(16, 0x0a)); this.TestPlain.Text = "01234567"; Update(); RefreshDongle(true); }
public static void Close() { if (ContextManager.dongle != null) { ContextManager.dongle.Close(); ContextManager.dongle = null; } if (ContextManager.reader != null) { ContextManager.reader.Close(); ContextManager.reader = null; } }
static DongleUtil() { dongle = ContextManager.GetDongle(); }