Finally getting around to posting my notes from my session on communicating with .NET web application from Flex that I gave at Adobe’s MAX in Las Vegas this year. I enjoyed giving this session as I truly believe Flex and .NET work well together and there are many methods for communication between both technologies, but currently there aren’t’ many resources covering it. In this session I talk mainly about 3 methods. Using HTTPServer/xml, WebServices, and AMF, as well as briefly touch upon Binary Sockets. I’m hoping in the future to have more detailed cover on each method.
You can download the slides and source code from here
Next week MAX will be held in Vegas and will be under the Adobe name for the first time. I’ll be there and will be speaking as well on Flex and .NET Interoperability. I’m looking forward to be giving this session as I believe there is a lot to be said about Flex and .NET, and there doesn’t seem to be enough resources on the topic. Actually I’m always amazed at how little the .NET development community knows about Flex/Flash. On my team, we have had great success with .NET as our back-end system and Flex as our rich client technology, and am a strong believer that they are very complimentary platforms.
In the session I plan to cover
- Different communication mechanisms (AMF/Flash Remoting, XML, Sockets)
- Debugging
- Tips from experience
If you missed this session when you initially setup your schedule that is because there was a change only a few weeks ago on the session topic, but it should be available now in the MAX scheduling system. If you are attending MAX, make sure to say hello. I always enjoy meeting fellow developers. If you aren’t attending MAX, I don’t think it is too late to show up 
I recently started playing around with macros in Visual Studio .NET 2003 and wrote up two I find very helpful: Wrap Try/Catch and Wrap Try/Finally. Basically, they take the selected text and wrap it in a try/catch block or a try/finally block.
This version supports empty selections (to create a new block) and both full-line and partial selections. It places the insertion point inside the try block for an empty selection and inside the catch block for a text selection.
Enjoy!
Imports EnvDTE
Imports System.Diagnostics
Public Module CodeModifiers
Sub WrapTryCatch()
WrapTrySomething("Catch ex As Exception")
End Sub
Sub WrapTryFinally()
WrapTrySomething("Finally")
End Sub
Private Sub WrapTrySomething(ByVal middleText As String)
If DTE.ActiveDocument Is Nothing Then
Return
End If
Dim selection As TextSelection
Dim startPoint As EditPoint
Dim endPoint As EditPoint
Dim insertPoint As EditPoint
Dim empty As Boolean
selection = DTE.ActiveDocument.Selection()
startPoint = selection.TopPoint.CreateEditPoint()
endPoint = selection.BottomPoint.CreateEditPoint()
empty = startPoint.EqualTo(endPoint)
DTE.UndoContext.Open("Wrap Try")
Try
Dim insertEndingCrLf As Boolean
If endPoint.AtEndOfLine Then
insertEndingCrLf = endPoint.AtStartOfLine
Else
insertEndingCrLf = True
End If
If Not endPoint.AtStartOfLine OrElse _
endPoint.EqualTo(startPoint) Then
endPoint.Insert(ControlChars.CrLf)
End If
endPoint.Insert(middleText + ControlChars.CrLf)
If Not empty Then
insertPoint = endPoint.CreateEditPoint()
End If
endPoint.Insert(ControlChars.CrLf + "End Try")
If insertEndingCrLf Then
endPoint.Insert(ControlChars.CrLf)
End If
' insert try
If Not AtStartOfLineIgnoringWhitepsace(startPoint) Then
startPoint.Insert(ControlChars.CrLf)
End If
startPoint.Insert("Try" + _
ControlChars.CrLf)
If empty Then
insertPoint = startPoint.CreateEditPoint()
End If
selection.MoveToPoint(insertPoint)
selection.Indent()
Finally
DTE.UndoContext.Close()
End Try
End Sub
Private Function AtStartOfLineIgnoringWhitepsace( _
ByVal point As EditPoint) As Boolean
If point.AtStartOfLine Then
Return True
End If
Dim p As EditPoint = point.CreateEditPoint()
Do
p.CharLeft()
If Not Char.IsWhiteSpace(p.GetText(1), 0) Then
Return False
End If
If p.AtStartOfLine Then
Return True
End If
Loop
End Function
End Module
This macro will only work for VB.NET. It can be translated to work with C# code or you can use the wonderful resharper plugin which unfortunately isn’t available for VB.NET.