public Form1() { InitializeComponent(); cancellationTokenSource = new CancellationTokenSource(); token = cancellationTokenSource.Token; proxy = new ChatServiceReference.ChatContractClient(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (userID != 0 && sessionID != 0) { proxy.Exit(userID, sessionID); } proxy.Close(); proxy = null; cancellationTokenSource.Cancel(); cancellationTokenSource.Dispose(); }