European Silverlight 4 & Silverlight 5 Hosting BLOG

BLOG about Silverlight 5 Hosting and Its Techologies - Dedicated to European Windows Hosting Customer

European Silverlight Hosting - Amsterdam :: How To Control Playback of Media Using a MediaElement of Silverlight?

clock October 18, 2019 11:42 by author Peter

We can integrate media into our Silverlight pages and WPF UserControls. The MediaElement object provides several media-specific properties. The following list describes the commonly used properties.

  •     AutoPlay: Specifies whether the MediaElement should begin playing automatically. The default value is True.
  •     IsMuted: Specifies whether the MediaElement is silenced. A value of True mutes the MediaElement. The default value is False.
  •     Stretch: Specifies how video is stretched to fill the MediaElement object. Possible values are None, Uniform, UniformToFill, and Fill. The default is Fill.
  •     Volume: Specifies the volume of the MediaElement object’s audio as a value from 0 to 1, with 1 being the loudest. The default value is 0.5.

In addition to its media-specific properties, MediaElement also has all the properties of a UIElement, such as Opacity and Clip.

Controlling Media Playback
You can control media playback by using the Play, Pause, and Stop methods of a MediaElement object.
<Canvas
    xmlns="http://schemas.microsoft.com/client/2007"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="CanvasLoaded">
    <MediaElement x:Name="MyMedia" Stretch="Uniform"
        Source="/images/Silverlight_Small.wmv" Height="200" Width="200" />
  <Canvas x:Name="ButtonPanel">
      <Canvas Background="Red" Canvas.Left="10" Canvas.Top="185" Height="25" Width="50"
        MouseLeftButtonDown="StopMedia" Cursor="Hand">
        <Rectangle Height="30" Width="40" Canvas.Left="10" />
        <TextBlock Text="Stop" Canvas.Left="10" Foreground="Yellow" />
       </Canvas>
       
       <Canvas Background="Green" Canvas.Left="70" Canvas.Top="185" Height="25" Width="50"
        MouseLeftButtonDown="PlayMedia" Cursor="Hand">
        <Rectangle Height="30" Width="40" Canvas.Left="10" />
        <TextBlock Text="Play" Canvas.Left="10" Foreground="Yellow" />
       </Canvas>
       
       <Canvas Background="Blue" Canvas.Left="130" Canvas.Top="185" Height="25" Width="60"
        MouseLeftButtonDown="PauseMedia" Cursor="Hand">
        <Rectangle Height="30" Width="40" Canvas.Left="10" />
        <TextBlock Text="Pause" Canvas.Left="10" Foreground="Yellow" />
       </Canvas>
       
       <Canvas Background="Black" Canvas.Left="10" Canvas.Top="215" Height="25" Width="180"
        MouseLeftButtonDown="ToggleFullScreen" Cursor="Hand">
        <Rectangle Height="30" Width="40" Canvas.Left="10" />
        <TextBlock Text="Full Screen" Canvas.Left="55" Foreground="Yellow" />
       </Canvas>
    </Canvas>
  </Canvas>    

// --------- JavaScript Code to control the Media object -------------
// Fires when Canvas is loaded
function CanvasLoaded(sender, args)
{
    var canvas = sender.getHost();
    canvas.content.onfullScreenChange = onFullScreenChanged;                            
}
// Fires when Full screen is changed
function onFullScreenChanged(sender, args)
{
    var canvas = sender.getHost();
    var buttonPanel = sender.findName("ButtonPanel");
    // Change the opacity of the button panel so that in the full screen it disappears and in normal screen it appears
    if (canvas.content.fullScreen == true)
        buttonPanel.opacity = 0;
    else
        buttonPanel.opacity = 1;
    // change the media object height and width to the canvas height and width
    var media = sender.findName("MyMedia");
    media.width = canvas.content.actualWidth;
    media.height = canvas.content.actualHeight;
}
//Fires when Full Screen button is clicked
function ToggleFullScreen(sender, args)
{
    var canvas = sender.getHost();
    canvas.content.fullScreen = !canvas.content.fullScreen;
}
// Fires when Stop button is clicked
function StopMedia(sender, args)
{
    sender.findName("MyMedia").stop();
}
// Fires when Play button is clicked
function PlayMedia(sender, args)
{
    sender.findName("MyMedia").play();
}
// Fires when Pause button is clicked
function PauseMedia(sender, args)
{
    sender.findName("MyMedia").pause();

Hope this helps!!



Silverlight 5 Hosting - HostForLIFE.eu :: How to Resolve and Avoid Crashes in Silverlight 5?

clock March 30, 2016 20:26 by author Anthony

Some websites require a plugin to display its content properly. When a web page containing a particular contains, eat plugin will automatically run and execute the code and render the content that is specifically aimed at the area of the web. One plugin that can do this is Silverlight. Silverlight is a product of Microsoft. Microsoft Silverlight is a cross-browser plug-in powered by the .NET that allows you to view certain multimedia such as high quality video or interactive web. But when you have problem with the content of the video or interactive web browsing, you may need updating or need to install Microsoft Silverlight on your device. Sometimes a web browser crashes can be caused by Silverlight that is not functioning properly.

If that happens, then it must be overcome so that web browsers can work as usual. So in this article, I will discuss about how to cope with a crash on the Silverlight plugin, and also how to prevent Silverlight from crashing.

STEP 1

Make sure the Silverlight plugin has been installed properly. Please try to run your web browser, and download Silverlight. Once downloaded, run the installation file. If completed please close your web browser and then run it back to see to it whether the issue has been resolved.

STEP 2

Try to reset Internet Explorer Internet Privacy Settings. Click Tools> Internet Options> Privacy, and select Sites. Then simply enter the URL of the web that you want to visit that requires the Silverlight application. Then click OK. Then please restart Internet Explorer to test Silverlight.

STEP 3

Disable the Silverlight plugin from Google Chrome your web browser, then restart your browser. Type about: plugins in the address bar. Then click the Disable button that is located next to Microsoft Silverlight. Then close the plugin tab, repeat this process and then click Enable to restart Silverlight.

STEP 4

Change the name of the file MSPR.HDS associated with Silverlight. Run Windows Explorer on your computer, open the file C:\ProgramData\Microsoft\PlayReady. Then click on MSPR.HDS file, right click and select "Rename", please rename the file with the name you want.

STEP 5

Close your web browser, and then try to run it again to test Silverlight.

 

How To Prevent Silverlight from crashes?

Google Chrome users may not be able to enjoy this plugin automatically. To overcome this problem can perform the following steps so that you can enjoy Silverlight in Google Chrome

  • Open your Google Chrome browser, type chrome://banners/#enable-NPAPI in the address bar and press enter.
  • Click Enable.
  • If you are using Silverlight in websites such as Netflix, Amazon Instant Video, you only need to right click on the content in question and select Run this plugin.
  • Now you can experience the difference when using Microsoft Silverlight plugin.

 

HostForLIFE.eu Silverlight 5 Hosting

HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.



Silverlight 5 Hosting France - HostForLife.eu :: How to Use Silverlight to Run an Elevated Trust Applications

clock June 23, 2015 06:39 by author Rebecca

In this article, you will see how to run an Elevated Trust Application within the Browser using Silverlight 5 Beta. For this demonstration, you will first create a Silverlight application by using Visual Studio 2010 with Silverlight Version 5.

Step 1

We will rename the application as 'TrustedAppsInBrowser' as shown below:

Step 2

Make sure you choose Silverlight version 5.0. Now let's add a reference of a API 'Microsoft.CSharp.dll' to our Silverlight application. Browse this API from the path 'C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client'. Then, design the MainPage.xaml. and replace <Grid></Grid> with following code:

<Grid x:Name="LayoutRoot" Background="Black">         <Grid.RowDefinitions>             <RowDefinition Height="44*" />             <RowDefinition Height="44*" />             <RowDefinition Height="44*" />             <RowDefinition Height="170*" />         </Grid.RowDefinitions>         <StackPanel Orientation="Horizontal" Grid.Row="0">             <TextBlock Text="TO - :" Foreground="Yellow" FontSize="14"         HorizontalAlignment="Center" VerticalAlignment="Center"/>             <TextBox x:Name="txtTO" Width="350" Height="30"/>         </StackPanel>         <StackPanel Orientation="Horizontal" Grid.Row="1">             <TextBlock Text="CC - :" Foreground="Yellow" FontSize="14"         HorizontalAlignment="Center" VerticalAlignment="Center"/>             <TextBox x:Name="txtCC" Width="350" Height="30"/>         </StackPanel>         <StackPanel Orientation="Horizontal" Grid.Row="2">             <TextBlock Text="Subject - :" Foreground="Yellow" FontSize="14"         HorizontalAlignment="Center" VerticalAlignment="Center"/>             <TextBox x:Name="txtsubject" Width="315" Height="30"/>         </StackPanel>         <StackPanel Orientation="Vertical" Grid.Row="3">             <TextBox x:Name="txtmessage" Width="400" Height="120"         HorizontalAlignment="Left" VerticalAlignment="Top" />             <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">                 <Button x:Name="btnSend" Content="Send" Height="30" Width="100"          Click="btnSend_Click"/>                 <Button x:Name="btncancel" Content="Cancel" Height="30" Width="100" />             </StackPanel>         </StackPanel> </Grid>

Step 3

Now let's import a namespace to our code behind:

using System.Runtime.InteropServices.Automation;

Step 4

Now run your application and click on the 'Send' button. You will get an exception as shown below:

The operation is not supported in this context. You cannot call COM components directly from the browser due to security reasons. However you can achieve the same by making this Silverlight Application as an Out-Of-Browser application with Elevated Trust. You have to run this application in the Browser. To run this application in the browser, you must set this application to run Out-Of-Browser with Elevated Trust. Right click the Silverlight Application and go to Properties. Choose checkbox 'Enable running application Out of the browser' and click on 'Out of browser settings' button. From the setting window, chose a checkbox 'Require Elevated trust when running outside the browser'.

Step 5

Now you will have to follow the steps given below for enabling our Silverlight application to run within the browser, with Elevated trust.

1: Go to Start and click on Run.  Type 'RegEdit'. This will open the 'Registry Editor' window. Now the most important thing is that If you running the app on a 32 bit machine, you will have to find:

· HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight\

and if you are running on a 64-bit machine, you will have to find:

· HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Silverlight\

I took the reference of MSDN for this path. My computer is 64-bit, so I have chosen the second option. Once you find the above path in the registry, make a change to 'UpdateConsentMode' from '0' to '1' as shown below:

2: Now the second step is to Sign the .XAP file of our Silverlight application with code signing certificate. Right click t Sheilverlight application and go to properties. Choose ‘Signing from the left hand side’ and check the checkbox 'Sign the .XAP file' as shown below:

Now click on the button 'Create Test Certificate'. Enter the password and confirm password and click 'OK' button.

3: Now click on the 'More Details' button highlighted in blue colour. This will show you a 'Certificate' window. Click on the 'Install Certificate' button as shown below:

Clicking on the button brings up the 'Certificate Import wizard'. Click on the 'Next' button and choose 'Place all certificates in the following store'. Click on the Browse button. This will show you a 'Certificate Store'. Choose 'Trusted Publisher' and finish the wizard. Now repeat the same step to install this certificate in 'Trusted Root Certification Authorities'.

That's it! You are done with the configuration. Now hit 'F5' to launch the Silverlight application in a browser. Fill the details and click on the 'Send' button. This will show you a Internet Security dialog box. Click on the 'Allow' button and you will see the output as shown below:

HostForLIFE.eu Silverlight 5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Silverlight 5 Hosting Germany - HostForLIFE.eu :: How to Get and Set the Control's Coordinate

clock April 11, 2015 06:48 by author Rebecca

Unlike normal C#, in Silverlight, you cannot access a control's coordinate through the object.Location.X and object.Location.Y. Instead, it is more troublesome to get and set the values. An in this article, I'm gonna tell you how to get and set the control's coordinate/location/position.

For example, if you want to add Label on the GUI through the code instead of XAML, you need to do have the following codes:

          Label[] arrayScores = new Label[MAX_PLAYERS]; //MAX_PLAYERS = 4
          for (int i = 0; i < arrayScores.Length; i++)
                {
                    arrayScores[i] = new Label();
                    arrayScores[i].Name = "Scores" + i;
                    arrayScores[i].Width = 50;
                    arrayScores[i].Height = 30;
                }

But that's not nough, you haven't set the coordinates of the Labels. You might think that adding the remaining codes at anywhere can do the job. However, it does not. Remember to put the coordinates setting code AFTER the page is loaded.

1. Add this.Loaded event in the constructor after the InitializeComponent()

    public MainPage()
            {
                InitializeComponent();
                ...
                ...
                this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            }

2. Set coordinates using CANVAS: set position, then add into canvas.


            void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                Canvas.SetLeft(arrayScores[0], SCORE_OFFSET_LEFT);
                Canvas.SetLeft(arrayScores[1], SCORE_OFFSET_LEFT);
                Canvas.SetLeft(arrayScores[2], SCORE_OFFSET_LEFT);
                Canvas.SetLeft(arrayScores[3], SCORE_OFFSET_LEFT);
                canvas1.Children.Add(arrayScores[0]);
                canvas2.Children.Add(arrayScores[1]);
                canvas3.Children.Add(arrayScores[2]);
                canvas4.Children.Add(arrayScores[3]);
            }

Happy coding!

HostForLIFE.eu Silverlight 5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Silverlight 5 Hosting - HostForLIFE.eu :: Using Stack Panel Layout in Silverlight

clock March 3, 2015 08:11 by author Peter

In this article let us figure out how to utilize Stack panel Layout in a Silverlight application. StackPanel is an alternate most critical board in Silverlight. It is predominantly helpful when we need to demonstrate some of your Silverlight components either Horizontally or Vertically.

Of course, open visual studio and select Silverlight project. We can perceive that there is a Grid format in our MainPage.xaml. Delete the default Grid layout and just drag and drop the Stack panel Layout into our application. The code for this looks like as:
<StackPanel Orientation="Vertical" Background="White" Height="200" Width="100">
            <Rectangle Height="50" Width="100" Fill="Red" />
            <Rectangle Height="50" Width="100" Fill="Blue" />
           <Rectangle Height="50" Width="100" Fill="Gray" />
            <Rectangle Height="50" Width="100" Fill="Goldenrod" />      
</StackPanel>

From the above code we can perceive that I put 4 rectangles in our Stack panel layout. What's more I have given a worth "Vertical" to the property "Orientation" of Stack board design. It implies that all the four rectangles will allign in vertical request. Presently give us a chance to assume we need all the rectangles to be adjusted in level request, then we ought to give the worth "Flat" to the property "Introduction" of Stack board format.

The code for this looks like as:
Presently give us a chance to assume we need all the rectangles to be adjusted in flat request, then we ought to give value “Horizontal” to the property “Orientation”  of Stack panel layout. The code for this looks like as
<StackPanel Orientation="Horizontal" Background="White" Height="100" Width="300">
            <Rectangle Height="100" Width="60" Fill="Red" />
            <Rectangle Height="100" Width="60" Fill="Blue" />
            <Rectangle Height="100" Width="60" Fill="gray" />
            <Rectangle Height="100" Width="60" Fill="Goldenrod" />      
</StackPanel>

And this is the output:

Here is the sample code for the above explanation:

MainPage.xaml
<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:d=http://schemas.microsoft.com/expression/blend/2008
    xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <StackPanel Orientation="Vertical" Background="White" Height="200" Width="100">          

            <Rectangle Height="50" Width="100" Fill="Red" />
            <Rectangle Height="50" Width="100" Fill="Blue" />
            <Rectangle Height="50" Width="100" Fill="Gray" />
            <Rectangle Height="50" Width="100" Fill="Goldenrod" />     
    </StackPanel>
</UserControl>

That above code will give you rectangles with vertical alignment. If you want horizontal alignment then replace complete code between <StackPanel> and </StackPanel> with the horizontal code.

HostForLIFE.eu Silverlight 5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Silverlight 5 Hosting Germany - HostForLIFE.eu :: Using "ClickMode" Property for Button control in Silverlight

clock January 27, 2015 06:35 by author Peter

In this article let us see the distinctive methods for utilizing the property Clickmode for a Button Control in a Silverlight application. Of course, open the visual studio and select the Silverlight 5 project.

First let us drag 3 different Button and TextBlock controls to Stack Panel as shown below into MainPage.xaml. Here I utilized a property called "ClickMode" for all the three button controls, But the value assigned to it is diverse.

For the first button I allocated the quality Hover to the ClickMode property, It implies that the click event handler happens at whatever point the mouse is floated onto this button.

For the second button, I allocated the quality Press to the ClickMode property, It implies that the click occasion handler happens at whatever point the mouse is clicked on this catch.  For the third button I assigned the value Release to the ClickMode property, It implies that the click event handler happens at whatever point the mouse is discharged from this button.

<Button x:Name="btn1" Margin ="5" HorizontalAlignment="Left"
Foreground="Black" Width="320" Click="OnClick1"
Content="On Mouse Hover this text will appear below" ClickMode="Hover" />
<TextBlock x:Name="text1" Margin ="0,8,0,0" />
<Button x:Name="btn2" Margin ="5,5,5,5"  HorizontalAlignment="Left"
Foreground="Black" Width="320" Click="OnClick2"
Content="On Button Press this text will appear below" ClickMode="Press" />
<TextBlock x:Name="text2" Margin="0,8,0,0" />
<Button x:Name="btn3" Margin ="5,5,5,5" HorizontalAlignment="Left"           

Click="OnClick3" Width="320" Content="On Button Release this text will appear    below" ClickMode="Release"/>
<TextBlock x:Name="text3" Margin ="0,8,0,0" />

Now i am writing the code for button click events in the MainPage.xaml.cs
public MainPage()
        {
            InitializeComponent();
        }
        void OnClick1(object sender, RoutedEventArgs e)
        {
            btn1.Foreground = new SolidColorBrush(Colors.Blue);
            text1.Text = "On Mouse Hover this text will appear below.";
            text2.Text = "";
            text3.Text = "";
        }
        void OnClick2(object sender, RoutedEventArgs e)
        {
            btn2.Foreground = new SolidColorBrush(Colors.Green);
            text1.Text = "";
            text2.Text = "On Button Press this text will appear below.";
            text3.Text = "";
        }
        void OnClick3(object sender, RoutedEventArgs e)
        {
            btn1.Foreground = new SolidColorBrush(Colors.Green);
            btn2.Foreground = new SolidColorBrush(Colors.Blue);
            text1.Text = "";
            text2.Text = "";
            text3.Text = "On Button Release this text will appear below.";
        }

Just refresh it. And here is the output.

Output for the first Button looks like:

Output for the second Button looks like:

Output for the third Button looks like: 

HostForLIFE.eu Silverlight 5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



European Cloud Silverlight 5 Hosting – HostForLIFE.eu :: How to Set Focus Control in Silverlight 5

clock September 1, 2014 12:42 by author Onit

In this article I will going to show you about focusing any element in Silverlight, Silverlight 5 is an application framework for writing and running rich Internet applications, with features and purposes similar to those of Adobe Flash. Just supposed that we had a login panel as he very first screen after validation we will navigate to another page. So when I am talking about the login panel we will have two input fields (textboxes) to insert username and password and looking from thge user's point of view we want that the username textbox field is to be focused.

 


Create a Silverlight Application

Before we jump more into the content about focus control first we should create a Silverlight application, just named it (for example: "FocusingControlInSilverlightApplication", use one textbox, passwordbox and button for the login interface.

It will looked like below:

Set Focus to the username textbox

So as we know we have a function something like Focus() to make it focused but it is not going to work for the very first time. Here is the reason, when we will run the application the Silverlight Plugin is not yet focused. Unless until we focus that Plugin in we can't focus any control in Silverlight application. To make it happen we have to simply add a single line of code on the loaded event which will look like and focus the Plugin

public MainPage()
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            //First focus the silverlight plogin and than focus the control.
            HtmlPage.Plugin.Focus(); (1)
            userNameTextBox.Focus();(2)
        }

Line one is focusing the Silverlight Plugin.
Focus that element.
But we need to add the following to the namespace import section.


using System.Windows.Browser;


Now run the application and you will find the control focused.

Once the Silverlight Plugin is focused, the simple Focus() function will work. Suppose we want to set the focus to the passwordbox; now after the Silverlight Plugin is focused so any event let say we add a focus button beside the login button and on click event of that button let's add the following

void focusButton_Click(object sender, RoutedEventArgs e)
        {
            //After Silverlight Plug in is focused
            passwordTextBox.Focus();
        }

And the screen will look like:

Click on the focus button and your passwordTextBox will be focused; the reason being is we have already focused the Plugin.

I just want to point to that since our login page is the very first page so we need to focus it using code behind. If suppose you have already clicked any of the Silverlight controls or the page itself, we have gotten the Plugin focused; after that if we want to focus any control, we can simply use the control.Focus() method.

Alternative

We do have an alternative to focus the Plugin at the very first moment of page load. As we know for every Silverlight application we get a .aspx and .html page created automatically.

This page has got the .xap file integrated in them which looks like:

<body>

    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object id="focusingControlInSilverlightApplicationTestPageXaml"  data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
                     <param name="source" value="ClientBin/FocusingControlInSilverlightApplication.xap"/>
                     <param name="onError" value="onSilverlightError" />
                     <param name="background" value="white" />
                     <param name="minRuntimeVersion" value="4.0.50826.0" />
                     <param name="autoUpgrade" value="true" />
                     <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
                               <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
                     </a>
              </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>


Including some JavaScript. So let's include the id attribute for the object tag and give some name; in my case it is "focusingControlInSilverlightApplicationTestPageXaml" and add the following function to the JavaScript section:


function FocusPlugin() {

            document.getElementById('focusingControlInSilverlightApplicationTestPageXaml').focus();
}

And on the body part of HTML add the following:


<body onload="FocusPlugin()">


This will do the work; you don't need to write anything in the code behind. At the very first moment when the .aspx or .html (test pages) loads it will focus the corresponding Plugin and there after only control.focus() method will focus the control.



European Silverlight 5 Hosting – HostForLIFE.eu :: Tips - The Easiest way to Reading URL-Parameters in Silverlight

clock August 15, 2014 08:38 by author Onit

In this guide we will showed you how to read the URL-Parameters in Silverlight this article will showed you the easiest way to read it. In CRM there is a setting that you can “pass-param”. If you are on a CRM Form you get keys like “typename” and “id”.

Below is the Complete list of CRM:

Parameter

Name

Description

typename

Entity Name

Name of the entity

type

Entity Type Code

Integer that uniquely identifies the entity in a specific organization

id

Object GUID

GUID that represents a record.

orgname

Organization Name

Unique name of the organization.

userlcid

User Language Code

Language code identifier that is being used by the current user.

orglcid

Organization Language Code

Language code identifier that represents the base language for the organization.


For Example is like

[something].aspx?id=%7bB2232821-A775-DF11-8DD1-00155DBA3809%7d&orglcid=1033&orgname=adventureworkscycle&type=1&typename=account&userlcid=1033

If you have the Silverlight in the Sitemap you don’t get (of course), typename, type and id. You can read them in your Silverlight:

IDictionary<string, string> QueryString = HtmlPage.Document.QueryString;
 string orgname, entityname;

 if (QueryString.ContainsKey("orgname"))
     orgname = QueryString["orgname"];

 if (QueryString.ContainsKey("typename"))
     entityname = QueryString["typename"];

 



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in