public void Start() { try { if (_mLicConnector != null) { _mLicConnector.Close(); _mLicConnector = null; } _mLicConnector = new LicConnector(); _mLicConnector.Debug += OnDebug; _mLicConnector.ServerConnectionEvent += LicConnector_ServerConnectionEvent; _mLicConnector.MessageReceivedEvent += LicConnector_MessageReceivedEvent; _mLicConnector.EncryptObject = this; _mLicConnector.Client = "License Demo - 0"; _mLicConnector.Host = _mHost; _mLicConnector.Port = _mPort; _mLicConnector.BeginConnect(); _mLicMgeNum = MConnectError; OnDebug(LogMode.Info, string.Format("LicenseHelper started.\t{0}\t{1}", _mHost, _mPort)); } catch (Exception ex) { OnDebug(LogMode.Error, string.Format("LicenseHelper start fail.\t{0}", ex.Message)); } }
public void Start() { try { if (mLicConnector != null) { mLicConnector.Close(); mLicConnector = null; } mLicConnector = new LicConnector(); mLicConnector.Debug += OnDebug; mLicConnector.ServerConnectionEvent += LicConnector_ServerConnectionEvent; mLicConnector.MessageReceivedEvent += LicConnector_MessageReceivedEvent; mLicConnector.EncryptObject = this; mLicConnector.Client = string.Format("{0}:{1}", CurrentApp.Session.UserID, CurrentApp.Session.UserInfo.UserName); mLicConnector.Host = mHost; mLicConnector.Port = mPort; mLicConnector.BeginConnect(); OnDebug(LogMode.Info, string.Format("LicenseHelper started.\t{0}\t{1}", mHost, mPort)); } catch (Exception ex) { OnDebug(LogMode.Error, string.Format("LicenseHelper start fail.\t{0}", ex.Message)); } }
void BtnQueryLic_Click(object sender, RoutedEventArgs e) { try { string strLicID = TxtLicID.Text; long licID; if (!long.TryParse(strLicID, out licID)) { AppendMessage(string.Format("LicID invalid")); return; } mLicID = licID; if (mLicChecker != null) { mLicChecker.Close(); mLicChecker = null; } mLicChecker = new LicConnector(); mLicChecker.Debug += (client, mode, msg) => AppendMessage(string.Format("{0}\t{1}", client, msg)); mLicChecker.ServerConnectionEvent += LicChecker_ConnectionEvent; mLicChecker.MessageReceivedEvent += LicChecker_MessageReceiveEvent; mLicChecker.EncryptObject = this; mLicChecker.Client = "LicChecker - 0"; mLicChecker.Host = "192.168.4.182"; mLicChecker.Port = 3070; mLicChecker.Connect(); } catch (Exception ex) { AppendMessage(string.Format("Fail.\t{0}", ex.Message)); } }
void MainWindow_Closing(object sender, CancelEventArgs e) { if (mLicConnector != null) { mLicConnector.Close(); mLicConnector = null; } }
private void BtnConnect_OnClick(object sender, RoutedEventArgs e) { try { if (!CheckInput()) { return; } if (mIsConnected) { DisConnect(); BtnConnect.IsEnabled = true; BtnDisconnect.IsEnabled = false; mIsConnected = false; CbServer.IsChecked = true; CheckBoxView_OnClick(null, null); } else { CreateLicensePoolItems(); if (mLicConnector != null) { mLicConnector.Close(); mLicConnector = null; } mLicConnector = new LicConnector(); mLicConnector.Debug += LicConnector_Debug; mLicConnector.ServerConnectionEvent += LicConnector_ServerConnectionEvent; mLicConnector.MessageReceivedEvent += LicConnector_MessageReceivedEvent; mLicConnector.EncryptObject = this; mLicConnector.Client = TxtName.Text; mLicConnector.ModuleTypeID = 7692; //作为监控端 mLicConnector.Host = TxtServer.Text; mLicConnector.Port = int.Parse(TxtPort.Text); mLicConnector.Connect(); //mLicConnector.BeginConnect(); BtnConnect.IsEnabled = false; BtnDisconnect.IsEnabled = true; mIsConnected = true; CbServer.IsChecked = false; CheckBoxView_OnClick(null, null); } } catch (Exception ex) { ShowErrorMessage(ex.Message); } }
private void DisConnect() { mListClients.Clear(); mListLicensePools.Clear(); mListSoftdogs.Clear(); mListLicenseServers.Clear(); mListProperties.Clear(); mIsConnected = false; if (mLicConnector != null) { mLicConnector.Close(); mLicConnector = null; } SetStatues(); }
void MainWindow_Closing(object sender, CancelEventArgs e) { if (mLicConnector != null) { mLicConnector.Close(); mLicConnector = null; } if (mLicChecker != null) { mLicChecker.Close(); mLicChecker = null; } if (mLicHelper != null) { mLicHelper.Stop(); mLicHelper = null; } }
public void Stop() { try { _mListLicenses.Clear(); if (_mLicConnector != null) { _mLicConnector.Close(); _mLicConnector = null; } OnDebug(LogMode.Info, string.Format("LicenseHelper stopped.")); } catch (Exception ex) { OnDebug(LogMode.Error, string.Format("LicenseHelper stop fail.\t{0}", ex.Message)); } }