Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:33:13+00:00 2026-06-14T09:33:13+00:00

I have an Silverlight app that makes a communication with my webcam to take

  • 0

I have an Silverlight app that makes a communication with my webcam to take photos.

Silverlight Code

protected void photoButton_Click(object sender, RoutedEventArgs e)
{
    this.src.CaptureImageCompleted += (s, a) =>
    {
        this.lastSnapshot = a.Result;
        this.snapshot.Visibility = Visibility.Visible;
        this.snapshot.Source = this.lastSnapshot;
        HtmlPage.Window.Invoke("SalvaFoto");                
        this.src.Stop();
    };

    src.CaptureImageAsync();
}

ASPX Where I call my Silverlight Application

            var htmlEmbedSilverlight = "<div id='silverlightControlHost'> "
                    + "<object data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='550px' height='250px'> "
                    + "<param name='source' value='../../ClientBin/FotoEmprestimoChave.xap'/> "
                    + "<param name='onError' value='onSilverlightError' /> "
                    + "<param name='background' value='white' /> "
                    + "<param name='minRuntimeVersion' value='4.0.60310.0' /> "
                    + "<param name='autoUpgrade' value='true' /> "
                    + "<param name='InitParams' value='chave_id=" + data + "' /> "
                    + "<a href='http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.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>";
            $("#tiraFotoSilverlight").html(htmlEmbedSilverlight);

Problem

When I try execute an Javascript in the current ASPX page with HtmlPage.Windows.Invoke("javascript_method"); doesn’t work.

I’m doing something wrong ?

I’ve also try the following code but without success

protected void photoButton_Click(object sender, RoutedEventArgs e)
{
    this.src.CaptureImageCompleted += (s, a) =>
    {
        this.lastSnapshot = a.Result;
        this.snapshot.Visibility = Visibility.Visible;
        this.snapshot.Source = this.lastSnapshot;

        HtmlElement Script = HtmlPage.Document.CreateElement("script");
        Script.SetAttribute("type", "text/javascript");
        Script.SetProperty("text", "$(document).ready(function () { alert('hi'); });");

        this.src.Stop();
    };

    src.CaptureImageAsync();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:33:14+00:00Added an answer on June 14, 2026 at 9:33 am

    I am new Silverlight/Javascript, but where I have done this, I needed to use Dispatcher.BeginInvoke:

    Dispatcher.BeginInvoke(() =>
        {
            HtmlPage.Window.Invoke("SalvaFoto");
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Phone 7.5/Silverlight app. I have some code that I duplicate
I have a Silverlight app that makes multiple (often concurrent) asynchronous calls to an
I have a silverlight app that will be installed OOB with full trust and
I have a Silverlight app that has to load an image dynamically, depending on
In my Silverlight app I have an event handler that dynamically creates a new
I have a WCF web-service and a Silverlight app displaying data from that service.
I have a silverlight application that needs to talk to a rails app to
I have a poker blind timer Silverlight app that is losing time (after running
I'm developing a Silverlight app that makes multiple async requests to a number of
I have little Silverlight app that needs to make queries to server, is it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.