IDataObject clipData = Clipboard.GetDataObject();
//retrieve an array of strings for all the formats available on the clipboard.
string[] formats = clipData.GetFormats();
//iterate through the list of formats on the clipboard
foreach (string format in formats)
{
//add each objeoct to an arraylist so we can inspect the object types
object dataObject = clipData.GetData(format);
}Dim clipData As IDataObject = Clipboard.GetDataObject
Dim formats() As String = clipData.GetFormats
'iterate through the list of formats on the clipboard
For Each format As String In formats
'add each objeoct to an arraylist so we can inspect the object types
Dim dataObject As Object = clipData.GetData(format)
Next
private void UploadStreamBlock(string format, string objectType, MemoryStream memStream)
{
//each time we enter this function we have a new transaction beginning. A transaction represents a comlete
//object on the clipboard and we'll use this on the server side to know how to put the stream back together
string transactionGuid = System.Guid.NewGuid().ToString();
memStream.Position = 0;
byte[] buffer = new byte[byteCount];
bool isFinalTransaction = false;
//while the current stream position plus our byte count is less than the length of the stream continue sending as much
//as we can.
while ((memStream.Position + byteCount) <= memStream.Length)
{
//if we happen to be on the last byte of the stream set the final transaction flag to true so the server
//will know that this is the last bit of this transaction to expect.
if (memStream.Position + byteCount == memStream.Length)
{
isFinalTransaction = true;
}
//read the stream into our buffer for transmission over the web service.
memStream.Read(buffer, 0, byteCount);
ws.InsertMessageStream(buffer, format, objectType, transactionGuid, isFinalTransaction, clipBoardGUID);
}
long remainingBytes = memStream.Length - memStream.Position;
//if we still have remaining bytes left figure out how many and transmit the last bit of this ojbect over the
//web service.
if ((int)remainingBytes > 0)
{
byte[] remainingBuffer = new byte[(int)remainingBytes];
memStream.Read(remainingBuffer, 0, (int)remainingBytes);
ws.InsertMessageStream(remainingBuffer, format, objectType, transactionGuid, true, clipBoardGUID);
}
} Private Sub UploadStreamBlock(ByVal format As String, ByVal objectType As String, ByVal memStream As MemoryStream)
'each time we enter this function we have a new transaction beginning. A transaction represents a comlete
'object on the clipboard and we'll use this on the server side to know how to put the stream back together
Dim transactionGuid As String = System.Guid.NewGuid.ToString
memStream.Position = 0
Dim buffer() As Byte = New Byte((byteCount) - 1) {}
Dim isFinalTransaction As Boolean = False
'while the current stream position plus our byte count is less than the length of the stream continue sending as much
'as we can.
While ((memStream.Position + byteCount) _
<= memStream.Length)
'if we happen to be on the last byte of the stream set the final transaction flag to true so the server
'will know that this is the last bit of this transaction to expect.
If ((memStream.Position + byteCount) _
= memStream.Length) Then
isFinalTransaction = True
End If
'ream the stream into our buffer for transmission over the web service.
memStream.Read(buffer, 0, byteCount)
clipService.InsertMessageStream(buffer, format, objectType, transactionGuid, isFinalTransaction, clipBoardGUID)
End While
Dim remainingBytes As Long = (memStream.Length - memStream.Position)
'if we still have remaining bytes left figure out how many and transmit the last bit of this ojbect over the
'web service.
If (CType(remainingBytes, Integer) > 0) Then
Dim remainingBuffer() As Byte = New Byte((CType(remainingBytes, Integer)) - 1) {}
memStream.Read(remainingBuffer, 0, CType(remainingBytes, Integer))
clipService.InsertMessageStream(remainingBuffer, format, objectType, transactionGuid, True, clipBoardGUID)
End If
End SubTodas as matérias de Redação Oficina da Net
O computador terá o tamanho que você quiser. Poderá ser do tamanho da .
Aqui veremos como aplicar uma tatuagem a qualquer pessoa de uma maneir.
Público é um item fundamental para se ter um site. De que adianta você.
Veja como transformar suas imagens em quebra cabeças de uma maneira be.
Olá pessoal, estou aqui para mais uma vídeo aula, desta vez vou mostra.
Aplicações de Internet Rica (da sigla em inglês RIA - Rich Internet Ap.
Olá pessoal, estou aqui para mais uma vídeo aula, desta vez vou mostra.
Programação extrema (do inglês eXtreme Programming), ou simplesmente X.
Modelagem de Dados é a atividade de especificação das estruturas de da.
Nesse artigo veremos como criar miniaturas de sites usando apenas um l.
© 2005 - 2009 - Oficina da Net - v 4.0 - É proibida a reprodução parcial ou completa do conteúdo deste site sem autorização por escrito. Resolução adequada: 1024x768px.
Seja o primeiro a comentar!