XRefresh alternative solution

I am using two monitors for a web development for the past 4 years. Usually I have website that I am working on a left monitor and my Visual Studio on a right monitor. Usually I do change in Visual Studio then press Shift-F6 (in case of code change) or just Ctrl-S (to save). After that I grab a mouse, move cursor to browser on left monitor click and then F5 for refresh. If you do a little CSS tricks it is to much repetitive movements.

Dual Monitor Web Development

About two years ago I discovered XRefresh. I mentioned it in my ASP.NET development tips article. First I was really excited. It is excellent tool for html and CSS markup tweaking. But if you do a lot of code changes and need to recompile your project more often then markup tweaking then it might not be a best tool for you. XRefresh watches files. If file changes then it refreshes browser. Now imagine if you compile big project and compilation takes 15 sec. XRefresh would notice dll change and would try to refresh browser. However compilation is not done yet and some dll-s are locked. So, XRefresh most likely not going to work for Shift-F6 scenario (recompilation of project). This was quite annoying as you can imagine, so I thought there must be some way to come up with a solution. We may have read all the hardware and O2 uk broadband reviews possible, but if you're screen is not refreshing properly that can be very inconvenient. I am not one to sit around when presented with an inconvenient situation however.

So, I found XRefresh alternative solution. I wrote a Visual Studio macros. You can hook up to OnBuildDone event. Then find Firefox process. Move focus to Firefox window and send F5 keystroke to it. Macros below still needs some polishing, but you can get an idea:

Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, _ 
 ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
    Dim projects As Object() = DTE.ActiveSolutionProjects
    If projects.Length > 0 Then
        If CType(projects(0), Project).ExtenderNames.Length Then
            If CType(projects(0), Project).ExtenderNames(0) = "WebApplication" Then
                Dim proc As System.Diagnostics.Process() = _
                For i As Integer = 0 To proc.Length - 1
                    If proc(i).MainWindowHandle <> 0 Then
                        SetForegroundWindow(New HandleRef(Nothing, proc(i).MainWindowHandle))
                    End If
            End If
        End If
    End If
End Sub


I am open for discussions and any suggestions.

kick it on DotNetKicks.com

Posted on Monday, May 31, 2010 by | Comments (1) | Add Comment



Re:XRefresh alternative solution

XRefresh has filtering capabilities. I would have it 'refresh' only when the build finish report is written. BTW, I'm using PHP right now, so no compile.

Posted on 6/1/2010 8:14:34 AM by Joseph Gutierrez #

I know about filtering capabilities. What is "build finish report"?

New Comment

Your Name:
Email (for internal use only):
Code above:


Valid HTML5