6/21/2011

Pass parameters to a WPF Click-Once Application

Pass parameters to a WPF Click-Once Application

Introduction


Environment : Visual Studio 2010

Application   : WPF

Language     : VB.NET

Deployment  : Click-Once

Suppose you have a WPF application which has 5 XAML windows.

1. Main Window

2. Application 1

3. Application 2

4. Application 3

5. Application 4

When application get launched, the Main Window will open which will have a combo-box containing the Application's Name to select.


So any user can go from Main Window to App1, App2, App3 or App4.

Once deployed, the URL will be something like, http://www.servername.com/MainWindow.application

Problem :


But the problem is if a user wants to directly open App1, App2, App3 or App4, he/she won't be able to.

Solution :


The solution is simple.  Pass the parameters to the URL of Click-Once and force it to recognize the parameters and open up the application.

The ClickOnce application named MainWindow that you host on servername, and you want to pass in a value for the variable username when the application launches. Your URL might look like the following:

http://www.servername.com/MainWindow.application?AppID=App1

Steps To Be Followed :

A.  If you are using the application's config file then follow the below procedure:
Steps :

1. Open your project (In Visual Studio 2010)

2. Right click on your project and select Properties:



3.  Select Publish Tab and Select Options.





4. Select the Allow URL parameters to be passed to application check box.







B.  If you are using any ClickOnce.target file:




Add Below Entry:




    <GenerateDeploymentManifest

EntryPoint="$(ClickOnceInstallDirectory)$(AssemblyName).exe.manifest"

DeploymentUrl ="$(ClickOnceApplicationUrl)"

OutputManifest="$(ClickOnceInstallDirectory)$(AssemblyName).application"

AssemblyName="$(ClickOnceAppTitle)"

MapFileExtensions="true"

Publisher="$(Company)"

AssemblyVersion="$(AssemblyVersion)"

MinimumRequiredVersion="$(AssemblyVersion)"

Product="$(ClickOnceAppTitle)"

Install="true"

UpdateEnabled="true"

UpdateMode="Foreground"

TargetFrameworkVersion="v4.0"

TargetFrameworkMoniker=".NETFramework,Version=v4.0"

                TrustURLParameters="true"

>


Code :

Write below code in your MainWindow.xaml.cs/vb file:



    Public Sub New()

        InitializeComponent()

            Dim instance As ApplicationDeployment

            If (ApplicationDeployment.IsNetworkDeployed) Then

instance = ApplicationDeployment.CurrentDeployment

                If Not IsNothing(instance) Then

                    Dim activateUri As Uri = instance.ActivationUri

                    If activateUri IsNot Nothing AndAlso activateUri.Query <> String.Empty Then

                        Dim nameValueTable = System.Web.HttpUtility.ParseQueryString(activateUri.Query)

                        If nameValueTable Is Nothing Then

                            'nameValueTable Is Nothing

                        Else

                            If nameValueTable.Keys.Count = 0 Then

                            'No Parameters has been passed.

                            Else

                            Select Case nameValueTable("ID")

                                Case "1"

'Open App1

                                Case "2"

'Open App2

                                Case "3"

'Open App3

                                Case "4"

'Open App4

                                Case Else

'Open Main Window

                            End Select

                            End If

                        End If

                    End If

                End If

            End If

    End Sub

Conclusion


Please let me know if you need any help.

6/16/2011

40+ Cool Features of Microsoft Office

40+ Cool Features of Microsoft Office

Visual Studio 2010 Keybinding Posters

Visual Studio 2010 Keybinding Posters
Reference posters for the default keybindings in Visual Studio 2010 for Visual Basic, Visual C#, Visual C++ and Visual F#.

High quality, print-ready PDFs in letter & A4 format containing the default keybindings in Visual Studio 2010 for Visual Basic, Visual C#, Visual C++ and Visual F#. High-resolution versions are also available.


VS-KB-Brochure-CPP-A4.pdf

267KB





VS-KB-Brochure-CPP-A4-HiRez.pdf

793KB





VS-KB-Brochure-CPP-Letter.pdf

270KB





VS-KB-Brochure-CPP-Letter-HiRez.pdf

802KB





VS-KB-Brochure-CSharp-A4.pdf

259KB





VS-KB-Brochure-CSharp-A4-HiRez.pdf

777KB





VS-KB-Brochure-CSharp-Letter.pdf

844KB





VS-KB-Brochure-CSharp-Letter-HiRez.pdf

2.5MB





VS-KB-Brochure-FSharp-A4.pdf

819KB





VS-KB-Brochure-FSharp-A4-HiRez.pdf

2.7MB





VS-KB-Brochure-FSharp-Letter.pdf

817KB





VS-KB-Brochure-FSharp-Letter-HiRez.pdf

2.7MB





VS-KB-Brochure-VB-A4.pdf

302KB





VS-KB-Brochure-VB-A4-HiRez.pdf

819KB





VS-KB-Brochure-VB-Letter.pdf

942KB





VS-KB-Brochure-VB-Letter-HiRez.pdf

2.8MB





Introducing Debugger Canvas : Released Now!!

Introducing Debugger Canvas : Released Now!!

About Debugger Canvas

Debugger Canvas is a new user experience for the debugger in Visual Studio Ultimate. It pulls together the code you’re exploring onto a single pan-and-zoom display. As you hit breakpoints or step into code, Debugger Canvas shows just the methods that you’re debugging, with call lines and local variables, to help you see the bigger picture.


Get Debugger Canvas



Try out Debugger Canvas, a new user experience for the debugger in Visual Studio Ultimate.


Install Debugger Canvas


Get Started











Download and Install Debugger Canvas.
Read the Guide to get started with Debugger Canvas.

Requirements

  • Visual Studio 2010 Ultimate SP1 (works with C# and Visual Basic)









Source : http://research.microsoft.com/en-us/projects/debuggercanvas/

6/10/2011

WPF application Single Instance in one line

WPF application Single Instance in one line
WPF application Single Instance in one line

Usage: WpfSingleInstance.Make(); or WpfSingleInstance.Make(SingleInstanceModes.ForEveryUser);

1. Add only a line of code (above) in the App.xaml.cs or in the main window.
2. Add a small static class in project (and a dummy enum SingleInstanceModes).

No additional inheritance in App class.
No App.xalm deleting.
No so redundant WCF and Remoting.
It works by the EventWaitHandle. Look in code, it's so simply.

 



 

SharePoint 2010 Articles and Tutorials

SharePoint 2010 Articles and Tutorials
In this post, I wanted to highlight some excellent SharePoint 2010 Articles and Tutorials written by the authors of DotNetCurry.com. I am sure these articles will help you understand the capabilities of SharePoint 2010, as well as give you development, reporting administration and architectural tips and demonstrate techniques on how to resolve existing pain-points while implementing a SharePoint solution in your organization.





































































Article Title

Author
SharePoint 2010: Connect InfoPath Form Web part with Excel Web PartPravinkumar Dabade
Connected Web Parts in SharePoint 2010 - an Architectural FrameworkLavanya Kammari, Nataraj Yadavalli, Mark Kendall
Custom Content Types in SharePointSumit Maitra
SharePoint: Create Dashboards with KPI, Scorecard and Report using Excel ServicesPravinkumar Dabade
Create SQL Server Dashboard in SharePointPravinkumar Dabade
SharePoint – Creating Page Layouts for Custom Content TypesSumit Maitra
Create SQL Server Dashboard in SharePointPravinkumar Dabade
Mastering Business Connectivity Services in SharePoint 2010 - Part 1Mark Kendall
Create Excel Dashboards in SharePointPravinkumar Dabade
SharePoint: Writing a Custom Event ReceiverSumit Maitra
SharePoint Dashboard with Common Filters using PerformancePoint Services 2010Pravinkumar Dabade
Mastering Business Connectivity Services in SharePoint 2010 - Part 2Mark Kendall
Designing Dashboards and Scorecards using SharePoint PerformancePoint Services 2010 and SSAS – Part 1Pravinkumar Dabade
Designing Dashboards and Scorecards using SharePoint PerformancePoint Services 2010 and SSAS – Part 2Pravinkumar Dabade
Designing Dashboards and Scorecards using SharePoint PerformancePoint Services 2010 and SSAS – Part 3Pravinkumar Dabade