private void DisposePageHavingResources() { try { Console.WriteLine("DisposePageHavingResources called!"); if (player != null) { // サウンド回りの終了処理はこの呼び出しで全て行われる player.togglePlayingTCP(); player = null; } if (socket != null) { // input server および image server との通信に利用しているソケットの終了処理 Device.BeginInvokeOnMainThread(() => { if (socket != null) { socket.Dispose(); } socket = null; }); } if (vdecoder != null) { vdecoder.Close(); vdecoder = null; } }catch (Exception e) { Console.WriteLine(e.ToString()); } }
protected override void OnClosing(CancelEventArgs e) { isDisposed = true; if (networkDiscovery != null) { networkDiscovery.Dispose(); networkDiscovery = null; } lock (this) { if (inputTimer != null) { inputTimer.Dispose(); inputTimer = null; } if (socket != null) { socket.Dispose(); socket = null; } } if (gzipStream != null) { gzipStream.Dispose(); gzipStream = null; } settingsOverlay.SaveSettings(); base.OnClosing(e); }
internal async Task <uint> WriteAndCloseAsync(IBuffer buffer) { uint bytesWritten = await DataSocket.OutputStream.WriteAsync(buffer); DataSocket.Dispose(); DataSocket = null; return(bytesWritten); }
public void Dispose() { if (DataSocket != null) { DataSocket.Dispose(); DataSocket = null; } if (ControlStreamSocket != null) { ControlStreamSocket.Dispose(); ControlStreamSocket = null; } }
void Exit(object sender, EventArgs e) { // dispose lock (this) { isDisposed = true; if (timer != null) { timer.Stop(); timer.Tick -= Timer_Tick; timer.Dispose(); timer = null; } if (networkDiscovery != null) { networkDiscovery.Dispose(); networkDiscovery = null; } if (socket != null) { socket.Dispose(); socket = null; } if (graphics != null) { graphics.Dispose(); graphics = null; } if (bitmap != null) { bitmap.Dispose(); bitmap = null; } } // exit trayIcon.Visible = false; Application.Exit(); }