// 5.B Here we define the method called from App.xaml thanks to the property Startup="Application_Startup" private void Application_Startup(object sender, StartupEventArgs e) { MainWindow wnd = new MainWindow(); wnd.Title = "Title defined from App.cs"; // 6. Now we wanna show that is possible to run our application passing some input parameters. // In our case, we are just going to take this parameters and show them in a MessageBox if (e.Args != null && e.Args.Length > 0) { string arguments = ""; for (int i = 0; i < e.Args.Length; i++) { arguments = arguments + e.Args[i] + " "; } MessageBox.Show("We passed " + e.Args.Length + " arguments: " + arguments); } else { MessageBox.Show("No input arguments have been passed!"); } // END 6 wnd.Show(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Wnd = ((WPF_Tutorial.MainWindow)(target)); return; case 2: #line 32 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CutCommand_CanExecute); #line default #line hidden #line 33 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CutCommand_Executed); #line default #line hidden return; case 3: #line 35 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.PasteCommand_CanExecute_1); #line default #line hidden #line 36 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.PasteCommand_Executed_1); #line default #line hidden return; case 4: this.pnlMainGrid = ((System.Windows.Controls.Grid)(target)); #line 42 "..\..\MainWindow.xaml" this.pnlMainGrid.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.pnlMainGrid_MouseUp); #line default #line hidden return; case 5: #line 48 "..\..\MainWindow.xaml" ((System.Windows.Documents.Hyperlink)(target)).RequestNavigate += new System.Windows.Navigation.RequestNavigateEventHandler(this.Hyperlink_RequestNavigate); #line default #line hidden return; case 6: #line 56 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 7: #line 72 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_4); #line default #line hidden return; case 8: #line 79 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_5); #line default #line hidden return; case 9: this.openFileTxtBox = ((System.Windows.Controls.TextBox)(target)); return; case 10: this.commandsTxtBox = ((System.Windows.Controls.TextBox)(target)); return; case 11: #line 137 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 12: #line 142 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; case 13: #line 295 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_3); #line default #line hidden return; case 14: this.addButton = ((System.Windows.Controls.Button)(target)); #line 312 "..\..\MainWindow.xaml" this.addButton.Click += new System.Windows.RoutedEventHandler(this.addButton_Click); #line default #line hidden return; case 15: this.changeButton = ((System.Windows.Controls.Button)(target)); #line 313 "..\..\MainWindow.xaml" this.changeButton.Click += new System.Windows.RoutedEventHandler(this.changeButton_Click); #line default #line hidden return; case 16: this.deleteButton = ((System.Windows.Controls.Button)(target)); #line 314 "..\..\MainWindow.xaml" this.deleteButton.Click += new System.Windows.RoutedEventHandler(this.deleteButton_Click); #line default #line hidden return; case 17: this.listUsers = ((System.Windows.Controls.ListBox)(target)); return; case 18: this.label1TextBox = ((System.Windows.Controls.TextBox)(target)); return; case 19: this.label2TextBox = ((System.Windows.Controls.TextBox)(target)); return; case 20: #line 409 "..\..\MainWindow.xaml" ((System.Windows.Controls.TextBox)(target)).SelectionChanged += new System.Windows.RoutedEventHandler(this.TextBox_SelectionChanged); #line default #line hidden return; case 21: this.txtStatus = ((System.Windows.Controls.TextBox)(target)); return; case 22: this.threeStateCB = ((System.Windows.Controls.CheckBox)(target)); #line 433 "..\..\MainWindow.xaml" this.threeStateCB.Checked += new System.Windows.RoutedEventHandler(this.threeStateCB_Checked); #line default #line hidden #line 434 "..\..\MainWindow.xaml" this.threeStateCB.Unchecked += new System.Windows.RoutedEventHandler(this.threeStateCB_Checked); #line default #line hidden return; case 23: this.chkb1 = ((System.Windows.Controls.CheckBox)(target)); return; case 24: this.chkb2 = ((System.Windows.Controls.CheckBox)(target)); return; case 25: this.chkb3 = ((System.Windows.Controls.CheckBox)(target)); return; case 26: this.txtValueConverter = ((System.Windows.Controls.TextBox)(target)); return; case 27: this.txtBox = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }