Hi all,
I have a program which having "PageMain.xaml" as startup. Now, I'm adding new window named "Settings.xaml" where it will be use to handle any configuration and store to "app.config" file. When I'm running a "MyApplication.exe" it will start with "PageMain.xaml".
Let's say before run the application, I want to open the Settings first to set the configuration and after complete save new configuration, I will run the EXE for main program. Is there any way to start the configuration window?
I have the script using batch file to open specific form. But it works on WinForms. How to do this using WPF? Below are the script for WinForms:-
@echo off
start MyWinForm.exe /config
The WinForm has recognition when program start, it will see if the send the args is like:-
<pre lang="c#">private static void Main(string[] args){
if (args.Length.Equals(0)){
}else if (args.Length.Equals(1) && args[0].ToLower() == "/config"){
}
}
How to do it on VB.Net at Application_Startup?
What I have tried:
Private Sub Application_Startup(ByVal sender As Object, ByVal e As System.Windows.StartupEventArgs) Handles Me.Startup
If sender.Length.Equals(0) Then
LogEvents("Sender is sending " & sender.Length.Equals(0).ToString, EventLogEntryType.Information)
ElseIf sender.Length.Equals(1) AndAlso sender(0).ToLower() = "/config" Then
LogEvents("Sender is sending " & sender(0).ToLower().ToString, EventLogEntryType.Information)
Else
LogEvents("Sender is sending " & sender.Length.Equals(0).ToString, EventLogEntryType.Information)
End If
What I have tried goes exception with "Ex-Public member 'Length' on type 'App' not found"