PDA

View Full Version : [CLOSED] translation problem



feanor91
Jun 13, 2012, 12:36 PM
Hello

I see this syntax in desktop example :



[DirectMethod(ShowMask = true)]
public void CreateWindow()
....


Ig I try to implement in VB:



<DirectMethod(ShowMask = True)> Public Sub BuildChartWindow(ByVal ChartToDraw As String)


I have a compilation error in ShowMask : "ShowMask is not declared, or is innaccessible".

Besides that, I have a lot of parameters I can use when I see the Intellisense of directmethod. So, how to translate?

Daniil
Jun 13, 2012, 1:57 PM
Hi,

You should use ":=" in VB.NET.

<DirectMethod(ShowMask:=True)>

I have got it from the "Attribute Parameters" part here:
http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx#Y28

Example

<%@ Page Language="VB" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
<DirectMethod(ShowMask:=True)>
Public Sub TestDirectMethod()
System.Threading.Thread.CurrentThread.Sleep(1500)
ExtNet.Msg.Alert("DirectMethod", "Hello from Server!").Show()
End Sub
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="DirectMethod">
<Listeners>
<Click Handler="App.direct.TestDirectMethod();" />
</Listeners>
</ext:Button>
</body>
</html>

feanor91
Jun 13, 2012, 2:10 PM
Works like a charm. I was not close to the solution, thanks a lot

feanor91
Jun 13, 2012, 2:20 PM
Do you remeber this function:



<DirectMethod(ShowMask:=True)> Public Sub SaveCharts(ByVal ChartName As String, ByVal chartSVG As String)

Dim ms As New MemoryStream()
SavePNG(ms, chartSVG, ChartName)

'Convert the memorystream to an array of bytes.
Dim byteArray() As Byte = ms.ToArray()
'Clean up the memory stream
ms.Flush()
ms.Close()
' Clear all content output from the buffer stream
Response.Clear()
Response.BufferOutput = True
Response.ClearHeaders()
' Add a HTTP header to the output stream that specifies the default filename
' for the browser's download dialog
Response.AddHeader("Content-Type", "application/force-download")
Response.AddHeader("Content-Disposition", "attachment; filename=" + ChartName + ".png")
Response.AddHeader("Content-Length", byteArray.Length.ToString())
' Add a HTTP header to the output stream that contains the
' content length(File Size). This lets the browser know how much data is being transfered
' Set the HTTP MIME type of the output stream
Response.ContentType = "application/octet-stream"
' Write the data out to the client.
Response.BinaryWrite(byteArray)
Response.End()

End Sub


The mask is not removed. I suppose that is because I use the response to transmit the file, A solution (else I will not display the mask).

Daniil
Jun 13, 2012, 2:31 PM
This is the limitation of AJAX downloading - the success/failure events are not fired, so, no way to hide a mask.

Please follow:
http://forums.ext.net/showthread.php?19430

There is the approach which could be helpful for you.