/// <summary> /// Handles the OnEnd event of the Application control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public void Application_OnEnd(object sender, EventArgs e) { if (tcpServer != null) { tcpServer.Stop(); } if (host != null && host.State == CommunicationState.Opened) { host.Close(); } if (container != null) // 销毁容器 { container.Dispose(); } }
/// <summary> /// 释放容器 /// </summary> public static void Dispose() { DefaultContainer?.Dispose(); }