- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
DYNAMIC LANGUAGES AND DYNAMIC .NET FOR SILVERLIGHT in Visual Basic .NET
CHAPTER 14 DYNAMIC LANGUAGES AND DYNAMIC .NET FOR SILVERLIGHT Generate QR Code In Visual Basic .NET Using Barcode generator for .NET Control to generate, create Quick Response Code image in .NET framework applications. www.OnBarcode.comQR Code 2d Barcode Recognizer In VB.NET Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comCreating a SilverlightMap.rb IronRuby File and Adding Map Mode
PDF 417 Creation In VB.NET Using Barcode drawer for .NET Control to generate, create PDF 417 image in .NET applications. www.OnBarcode.comPrinting Linear 1D Barcode In Visual Basic .NET Using Barcode encoder for VS .NET Control to generate, create 1D Barcode image in .NET framework applications. www.OnBarcode.comNext create a simple text file named SilverlightMap.rb as an IronRuby file and write the following lines of code to include the required assemblies (including MapControl.dlls) and turn on aerial view with labels of the Map control. Notice that with the new Just-Text approach, I could reference the Map object by name. Any XAML elements with the x:Name set can be accessed through root_visual shorthand as shown here. require "bingmaps/Microsoft.Maps.MapControl" require "bingmaps/Microsoft.Maps.MapControl.Common" include include include include System::Windows System::Windows::Controls Microsoft::Maps::MapControl Microsoft::Scripting::Silverlight EAN128 Creator In VB.NET Using Barcode drawer for VS .NET Control to generate, create UCC.EAN - 128 image in .NET applications. www.OnBarcode.comCode 39 Extended Drawer In VB.NET Using Barcode creation for .NET framework Control to generate, create Code 39 Extended image in .NET applications. www.OnBarcode.comDynamicApplication.current.load_root_visual_from_string File.read("SilverlightMap.xaml") sm = DynamicApplication.current.root_visual.silverlight_map sm.map_in_ironruby.mode = AerialMode.new(true) As we included a reference of the XAML file to the SilverlightMap.xaml file, we need to include the same for the SilverlightMap.rb file, as shown here in highlighted bold fonts. <html> <head> <script src="dlr.js" type="text/javascript"> </script> </head> <body> <script type="application/x-zip-compressed" src="bingmaps.zip"> </script> <script type="application/xml+xaml" src="SilverlightMap.xaml" id="sl_map" Width="1350" Height="575" defer="true"> </script> <script type="application/ruby" src="SilverlightMap.rb" class="sl_map"> </script> </body> </html> Now if you copy updated the SilverlightMap.html file and newly created SilverlightMap.rb file to the web server root folder and browse it, you ll see the black background, skewed 3D angle, and labeled aerial view, as shown in Figure 14-4. Print Quick Response Code In VB.NET Using Barcode generator for Visual Studio .NET Control to generate, create QR Code JIS X 0510 image in Visual Studio .NET applications. www.OnBarcode.comIdentcode Creation In VB.NET Using Barcode printer for .NET framework Control to generate, create Identcode image in VS .NET applications. www.OnBarcode.comCHAPTER 14 DYNAMIC LANGUAGES AND DYNAMIC .NET FOR SILVERLIGHT
Denso QR Bar Code Generation In None Using Barcode generation for Software Control to generate, create QR Code 2d barcode image in Software applications. www.OnBarcode.comScan Denso QR Bar Code In Java Using Barcode decoder for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comFigure 14-4. Map mode set to aerial with labels mode and 3D projection
QR Code Generator In .NET Using Barcode creation for .NET framework Control to generate, create Denso QR Bar Code image in Visual Studio .NET applications. www.OnBarcode.comBarcode Maker In Visual C# Using Barcode creator for Visual Studio .NET Control to generate, create Barcode image in .NET framework applications. www.OnBarcode.comAdd Rotate Map Capabilities
ECC200 Creation In None Using Barcode creation for Font Control to generate, create DataMatrix image in Font applications. www.OnBarcode.comGenerating QR Code In None Using Barcode printer for Software Control to generate, create QR image in Software applications. www.OnBarcode.comOne of the popular demonstrations at the Mix09 conference was Silverlight and Microsoft Bing Map integration with spinning capabilities for the Map object. Let s implement something similar in IronRuby. To implement this feature, you first need to define the Grid with two columns using ColumnDefinitions. <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="1100"/> </Grid.ColumnDefinitions> Next add three buttons named Rotate Map, Pause, and Stop and Reset, along with title text in the XAML file within the Border. All of this is in the first column on the Grid, as shown here. <StackPanel Grid.Column="0" Orientation="Vertical"> <Border CornerRadius="20" Margin="0,50,0,5" Width="150" Background="DarkBlue" HorizontalAlignment="Center"> <StackPanel Orientation="Vertical"> <TextBlock Text="3D Rotation" HorizontalAlignment="Center" FontSize="12" Foreground="White" Margin="0,5,0,10"/> <Button x:Name="rotate_map" Height="25" Content="Rotate Map" Width="100" Margin="0,0,0,10" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Center" /> Encoding UPCA In Java Using Barcode maker for Java Control to generate, create UPC Symbol image in Java applications. www.OnBarcode.comRecognize Data Matrix In VB.NET Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comCHAPTER 14 DYNAMIC LANGUAGES AND DYNAMIC .NET FOR SILVERLIGHT
2D Drawer In C#.NET Using Barcode maker for .NET Control to generate, create 2D Barcode image in .NET framework applications. www.OnBarcode.comDraw QR Code 2d Barcode In None Using Barcode generator for Microsoft Excel Control to generate, create QR Code JIS X 0510 image in Microsoft Excel applications. www.OnBarcode.com<Button x:Name="pause_resume" Height="25" Content="Pause" Background="DarkGoldenrod" Foreground="Black" Width="100" Margin="0,0,0,10" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Button x:Name="stop_reset" Height="25" Content="Stop and Reset" Background="DarkGoldenrod" Foreground="Black" Width="100" Margin="0,0,0,10" VerticalAlignment="Center" HorizontalAlignment="Center" /> </StackPanel> </Border> </StackPanel> Now add the Map object to the second column of the Grid. <StackPanel Grid.Column="1"> <m:Map x:Name="map_in_ironruby" CredentialsProvider="Your Authentication Key Goes Here" Width="800" Height="400" HorizontalAlignment="Center"> <m:Map.Projection> <PlaneProjection RotationX="-20" RotationY="0" RotationZ="0"/> </m:Map.Projection> </m:Map> </StackPanel> In the next step you ll need to create some rather complex XAML update code. I would recommend creating the XAML file using a development environment such as Visual Studio or Expression Blend to take advantage of their editing and IntelliSense features. Then you can copy the completed XAML to the app.xaml file of your project. Create a storyboard with the name map_animation targeted for the Map object named map_in_ironruby. The storyboard defines the keyframes for the PlaneProjection animation properties RotationZ, RotationY, GlobalOffsetX, and GlobalOffsetZ. Add the storyBoard as a UserControl resource. <UserControl.Resources> <Storyboard x:Name="map_animation"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="map_in_ironruby" Storyboard.TargetProperty= "(UIElement.Projection). (PlaneProjection.RotationZ)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="15"/> <EasingDoubleKeyFrame KeyTime="00:00:01" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:02" Value="-15"/> <EasingDoubleKeyFrame KeyTime="00:00:03" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:04" Value="15"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="map_in_ironruby" Storyboard.TargetProperty= Decoding UPC-A Supplement 5 In .NET Framework Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comCreating Barcode In None Using Barcode encoder for Microsoft Word Control to generate, create Barcode image in Microsoft Word applications. www.OnBarcode.comCHAPTER 14 DYNAMIC LANGUAGES AND DYNAMIC .NET FOR SILVERLIGHT
"(UIElement.Projection). (PlaneProjection.RotationY)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90"/> <EasingDoubleKeyFrame KeyTime="00:00:01" Value="-180"/> <EasingDoubleKeyFrame KeyTime="00:00:02" Value="-270"/> <EasingDoubleKeyFrame KeyTime="00:00:03" Value="-360"/> <EasingDoubleKeyFrame KeyTime="00:00:04" Value="-270"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="map_in_ironruby" Storyboard.TargetProperty= "(UIElement.Projection). (PlaneProjection.GlobalOffsetX)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:01" Value="200"/> <EasingDoubleKeyFrame KeyTime="00:00:02" Value="300"/> <EasingDoubleKeyFrame KeyTime="00:00:03" Value="200"/> <EasingDoubleKeyFrame KeyTime="00:00:04" Value="0"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="map_in_ironruby" Storyboard.TargetProperty= "(UIElement.Projection). (PlaneProjection.GlobalOffsetZ)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:01" Value="300"/> <EasingDoubleKeyFrame KeyTime="00:00:02" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:03" Value="-300"/> <EasingDoubleKeyFrame KeyTime="00:00:04" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> Next implement the Click events within the IronRuby code to start, pause, resume, and stop the animation. First you need to include a reference to System.Windows.Media and System.Windows.Media.Animation. include System::Windows::Media include System::Windows::Media::Animation Now load the Disable pause_resume button during the initialization process of the application. sm.pause_resume.is_enabled = false Now implement the Click event of each button. Start with the rotate_map button. First set the Map object to left horizontal alignment in order to best use the available space for the animation. Then set the RepeatBehavior property of the storyboard animation to Forever and begin the animation. Finally enable the pause_resume button and set the button content to Pause. sm.rotate_map.click do |s,e| sm.map_in_ironruby.horizontal_alignment =
|
|