protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); SavedValueRegistry.SaveValue("LoginName", txtLoginName.Text); SavedValueRegistry.SaveValue("LoginServer", txtLoginServer.Text); SavedValueRegistry.SaveValue("LogServer", txtLogServer.Text); SavedValueRegistry.SaveValue("ProcessName", txtLogId.Text); m_TickTimer.Stop(); m_TickTimer = null; if (m_OnlineClient != null) { m_OnlineClient.DisconnectAll(); m_OnlineClient.Dispose(); m_OnlineClient = null; } if (m_MessageRouter != null) { m_MessageRouter.Dispose(); m_MessageRouter = null; } GlobalEngine.Stop(); }
public void Dispose() { CloseAllConnections(); if (m_ConnectionManagermentGroup != null) { m_ConnectionManagermentGroup.Dispose(); } m_ConnectionManagermentGroup = null; m_MessageRouter = null; }
public TestNet2MainWindow() { InitializeComponent(); var logServerAddress = SavedValueRegistry.ReadValue("LogServer", null); if (!string.IsNullOrEmpty(logServerAddress)) { txtLogServer.Text = logServerAddress; } var loginServerAddress = SavedValueRegistry.ReadValue("LoginServer", null); if (!string.IsNullOrEmpty(loginServerAddress)) { txtLoginServer.Text = loginServerAddress; } txtLoginName.Text = SavedValueRegistry.ReadValue("LoginName", ""); var processName = SavedValueRegistry.ReadValue("ProcessName", "TestNet2.WinSharp"); txtLogId.Text = processName; GlobalEngine.Start(processName, logServerAddress, 0xFFFFFFFF); m_MessageRouter = new SFMessageRouter(); RegisterMessageLiteners(); UpdateButtonState(); OnlineClient.OnOnlineStateChanged += (object sender, OnlineClient.OnlineState prevState, OnlineClient.OnlineState newState) => { UpdateStatusText(newState); }; UpdateStatusText(OnlineClient.OnlineState.None); m_TickTimer = new System.Windows.Threading.DispatcherTimer(); m_TickTimer.Tick += new EventHandler(Timer_Tick); m_TickTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); m_TickTimer.Start(); }
public void UnInitEngine() { m_MessageRouter = null; if (m_ConnectionLogin != null) { m_ConnectionLogin.Dispose(); } m_ConnectionLogin = null; if (m_ConnectionGame != null) { m_ConnectionGame.Dispose(); } m_ConnectionGame = null; if (mRecvChatHistorys != null) { mRecvChatHistorys.Clear(); mRecvChatHistorys = null; } }
public void UnInitEngine() { m_MessageRouter = null; }