/// <summary> /// Stores element in the undo/redo buffer /// </summary> /// <param name="operation">Operation that will be save for the element</param> /// <param name="element">Element to be buffered</param> public void StoreInBuffer(BufferOperation operation, ShapeElement element) { UndoElement UndoElement = new UndoElement(element, operation); this.undoManager.AddItem(UndoElement); element.UndoShape = element.Copy(); }
/// <summary> /// Envia dados de forma assíncrona /// </summary> /// <param name="packet"></param> public void AsyncSend(byte[] packet) { try { // cria o cabeçalho byte[] header = CreateHeader(packet); // combina o corpo do pacote com o cabeçalho byte[] finalPacket = BufferOperation.Combine(header, packet); asyncState.Socket.BeginSend(finalPacket, 0, finalPacket.Length, SocketFlags.None, AsyncSend, this); // espera a sinalização de que os dados foram transmitidos ou aguarda 1 segundo manualReset.WaitOne(1000); } catch (SocketException ex) { if (ex.SocketErrorCode != SocketError.Disconnecting && ex.SocketErrorCode != SocketError.NotConnected && ex.SocketErrorCode != SocketError.ConnectionReset && ex.SocketErrorCode != SocketError.ConnectionAborted && ex.SocketErrorCode != SocketError.Shutdown) { Debug.WriteLine(ex); } } }
/// <summary> /// Buffer element class that is used for buffering actions for undoing/redoing /// </summary> /// <param name="currentShape">Current shape</param> /// <param name="operation">Opertion</param> public UndoElement(ShapeElement currentShape, BufferOperation operation) { this.currentShape = currentShape; if (currentShape.UndoShape != null) { this.oldShape = currentShape.UndoShape.Copy(); } this.newShape = currentShape.Copy(); this.operation = operation; }
/// <summary> /// Envia dados /// </summary> /// <param name="packet"></param> public void Send(byte[] packet) { try { // cria o cabeçalho byte[] header = CreateHeader(packet); // combina o corpo do pacote com o cabeçalho byte[] finalPacket = BufferOperation.Combine(header, packet); asyncState.Socket.Send(finalPacket); } catch (SocketException ex) { if (ex.SocketErrorCode != SocketError.Disconnecting && ex.SocketErrorCode != SocketError.NotConnected && ex.SocketErrorCode != SocketError.ConnectionReset && ex.SocketErrorCode != SocketError.ConnectionAborted && ex.SocketErrorCode != SocketError.Shutdown) { Debug.WriteLine(ex); } } }
private static extern void BufferVertextList([In] ref Clip_vertex_list vtx_list, [In] double distance, [In] BufferOperation buffer_op, [In, Out] ref Clip_polygon result_polygon);