In the previous steps you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.
Complete the following steps:
Visual Basic Copy Code Imports C1.WPF OR Imports C1.Silverlight
C# Copy Code using C1.WPF; OR using C1.Silverlight;
Visual Basic Copy Code Private Sub Button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) ShowWindow(False) End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) ShowWindow(True) End Sub
C# Copy Code void button1_Click(object sender, RoutedEventArgs e) { ShowWindow(false); } void button2_Click(object sender, RoutedEventArgs e) { ShowWindow(true); }
Visual Basic Copy CodePrivate Sub ShowWindow(ByVal showModal As Boolean) Dim wnd As New C1Window() wnd.Header = "This is the header." wnd.Height = 120 wnd.Width = 200 wnd.Content = New MyWindow() wnd.CenterOnScreen() If showModal Then wnd.ShowModal() Else wnd.Show() End If End Sub
C# Copy Code private void ShowWindow(bool showModal) { C1Window wnd = new C1Window(); wnd.Header = "This is the header."; wnd.Height = 120; wnd.Width = 200; wnd.Content = new MyWindow(); wnd.CenterOnScreen(); if (showModal) wnd.ShowModal(); else wnd.Show(); }
This code specifies the size of the window and opens a new window.
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.