public override void Dispose() { DockServices.Helpers.HelperStatusChanged -= HandleHelperStatusChanged; Helper = null; HelpButton.Clicked -= HandleHelpButtonClicked; HelpButton.Dispose(); HelpButton.Destroy(); if (UninstallButton != null) { UninstallButton.Clicked -= HandleUninstallButtonClicked; UninstallButton.Dispose(); UninstallButton.Destroy(); } base.Dispose(); }
public override void Dispose() { Addin = null; Provider = null; ConfigButton.Clicked -= HandleConfigButtonClicked; ConfigButton.Dispose(); ConfigButton.Destroy(); UpButton.Clicked -= HandleUpButtonClicked; UpButton.Dispose(); UpButton.Destroy(); DownButton.Clicked -= HandleDownButtonClicked; DownButton.Dispose(); DownButton.Destroy(); HelpButton.Clicked -= HandleHelpButtonClicked; HelpButton.Dispose(); HelpButton.Destroy(); base.Dispose(); }
private static void DataListenLoop() { try { int cyclesCount = 0; System.Timers.Timer timer = new System.Timers.Timer(1000); timer.Elapsed += (sender, args) => { main.cycleSpeedReceive.Text = cyclesCount.ToString(); cyclesCount = 0; }; timer.Enabled = true; while (true) { Socket pipeListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); pipeListener.Bind(new IPEndPoint(localIP, 4578)); pipeListener.Listen(10); pipe = pipeListener.Accept(); //int startTime = DateTime.Now.Millisecond; while (pipe.Connected) { cyclesCount++; //main.cycleSpeedReceive.Text = (DateTime.Now.Millisecond - startTime).ToString(); //startTime = DateTime.Now.Millisecond; //Thread.Sleep(10); int bytes = 0; byte[] data = new byte[30000]; do { bytes = pipe.Receive(data); } while (pipe.Available > 0); try { object imgData = Serializer.BytesToObj(data, bytes); if (!(imgData is ImageStreamPart)) { throw new Exception("Wrong data!"); } data = (imgData as ImageStreamPart).bitmap; //decompressing byte[] decompressedImage = new byte[(imgData as ImageStreamPart).originalSize]; LZ4Codec.Decode(data, decompressedImage); strWin.img.Pixbuf = new Gdk.Pixbuf(decompressedImage); if (disconnectRequest) { pipe.Disconnect(true); pipe.Dispose(); pipe = null; discBtn.Hide(); discBtn.Destroy(); discBtn.Dispose(); disconnectRequest = false; strWin.Hide(); strWin.Dispose(); strWin = null; break; //searchTask.Start(); } } catch (Exception e1) { ConsoleLogic.WriteConsole("Error at converting received data"); } } } } catch (Exception e) { ConsoleLogic.WriteConsole("error at DataListenLoop"); } }