Install silverlight application on button click - javascript

I am looking for a solution to install Silver light application in to user system, if he click on (install button ) in web browser.
I know how to do Out of browser but here requirement is not right click and install , it needs to install from HTML5 web page button click event.
I know can achieve from Silver light button click but I want to achieve this from HTML5 button Click event
private void Button_Click(object sender, RoutedEventArgs e)
{
if (Application.Current.HasElevatedPermissions && System.Windows.Interop.ComAutomationFactory.IsAvailable)
{
string run = "\"%ProgramFiles%\\Microsoft Silverlight\\sllauncher.exe\" /emulate:Silverface.xap /origin:\"http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap\" /overwrite";
dynamic cmd = ComAutomationFactory.CreateObject("WScript.Shell");
cmd.Run(run, 1, true);
}
}
Thanks,
ineffablep

If your silverligt application is loaded on page, you may call silverlight's install method from javascript.
Walkthrough: Calling Managed Code from JavaScript

I have found the answer , to handle this I need to use HTA File
http://www.silverlightshow.net/items/How-to-distribute-a-Silverlight-OOB-Application.aspx

Related

How to hide/remove Cordova Windows 10 app back button?

The windows 10 app generated by cordova shows a back button on extreme top left, when I run the app in desktop. When user taps the button, the application behaves like a web. This option is really annoying.
Is there anyway that I can hide or remove the back button? Looking for solution preferably in Javascript, C# can be optional.
Is there anyway that I can hide or remove the back button? Looking for solution preferably in Javascript, C# can be optional.
If you are refering to the back button on Title bar, you can use the following codes in cordova to disable the back button:
if (cordova.platformId = "windows")
{
var currentView = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
currentView.appViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
}

How do I close a tab in Eclipse using Javascript?

I am currently modernising some plugin modules from version 2.x to the OSGi-based 4.x. This project uses the Eclipse application and takes advantage of its view & perspective architecture to serve as a tabbed browser.
Studying the old code and running the Eclipse application, this is what I understand to be the expected behaviour of one particular functionality:
Clicking a link opens a panel in a new tab, which displays a HTML file containing Javascript in it.
The HTML page contains a form culminating in a Submit & Cancel button.
Clicking either button should close the tab. The submit button will, of course, first submit the form data.
Most of the above works as intended, however instead of closing just that one tab, clicking either button causes the entire Eclipse application to attempt to terminate (I received a confirmation prompt asking if I want to exit Eclipse). The submit button did successfully update submitted info into the database before attempting to terminate the Eclipse application.
This is what the offending part of the code looks like:
function onSubmit() {
//processForm();
if (opener) {
opener.newAddressValue(newToAddress);
window.close();
} else if (parent.parent) {
parent.parent.newAddressValue(newToAddress);
parent.parent.closeUsrFrame();
} else {
parent.newAddressValue(newToAddress);
parent.closeUsrFrame();
}
}
function onCancel() {
if (opener) {
window.close();
} else {
parent.closeUsrFrame();
}
}
I suspect the expected behaviour is for program flow to reach window.close() at which point the tab containing the opened panel should close, but instead it is causing the entire Eclipse application to terminate. What is the correct way to exit the current tab in Eclipse 4.x using JavaScript?
If the program display a HTML file using SWT Browser widget, you can use Browser.addCloseWindowListener(CloseWindowListener listener) to hook the event that triggered by javascript window.close.
If your program do prompt about exiting Eclipse, you shall search class that implement CloseWindowListener interface. Modify its behavior as you wished.

PhoneGap Android back button needs to be pressed twice

When I navigate to a second page and try to go back using the default back button that every android device has, it seems as though the first time I tap it, nothing happens. I have to tap it a second time. Anyone have any idea why this happens?
I'm not sure what more information I need to provide. If you need more info please request specifically what you need and I will try to edit the question.
Edit: my main activity extends DroidGap and only has the one method
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
I think I'm narrowing down on the problem. On the second page, there are a list of anchor tags that perform a css animation when clicked.
This jsfiddle isn't doing the animation for whatever reason but here is the relevant markup, css and javascript
http://jsfiddle.net/7fdQu/
I am not sure what is going on in background but there is a definite for it ....
you can program the back button in Android there is a code for it. The phonegap fires a event "backbutton" in Android.
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
window.location.href = 'URL';
}
Ref:
Should I use window.navigate or document.location in JavaScript?
http://docs.phonegap.com/en/1.0.0/phonegap_events_events.md.html#backbutton

Full screen Silverlight through javascript

Ok this is the problem. I have a basic web site, which has buttons. those buttons are run through javascript and then the code goes in C# and then it does various things with the Silverlight gantt control.
For example if I want to ZOOM IN the gantt control I go like this:
<button id="zoomIn" onclick="SlZoomIn()">Zoom In</button>
then in javascript:
function SlZoomIn() {
var control = document.getElementById("SilverlightPlugIn");
control.Content.SilverPlan.JsZoomIn();
}
then in C#:
[ScriptableMember]
public void JsZoomIn()
{
try
{
gantt.ZoomBySteps(1);
}
catch (Exception e)
{
MessageBox.Show("Zoom In does not work.");
}
}
This all works fine, but when I want to do things with the gantt that require Events, this is a problem. For example, if I want to print or fullscreen my gantt control. How can I do this?
In C# the code for this is:
private void fullScreen(object sender, RoutedEventArgs e)
{
Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
}
But what do I have to do in javascript to trigger this method? when the user clicks on the button fullscreen?
There would be no difference in calling this code from JavaScript compared to your previous example, except that the Silverlight plug-in imposes security restrictions for several things, including full-screen mode, print and file dialogs. These mean that these actions have to be initiated by the user clicking or typing something. Explained here at MSDN.
Therefore you cannot do this from JavaScript, even when the user presses a button outside of the Silverlight plugin - the user will have to click something within the Silverlight plugin, for example a button which raises an event which you handle in your C# code, and take an action directly.
In the case of full-screen, you will find if you are mixing HTML/JavaScript content with Silverlight that the Silverlight full-screen very likely does not at all do what you want - the Silverlight content will be full screen, and the HTML content will not be visible. You also can't use keyboard input (mostly). I'd recommend resizing the Silverlight object within the HTML page (possibly combined with maximising the browser window).

Browser tab close detect in gwt

I am developing a gwt application and I am going to support only for ie7. Now I have a requirement to detect browser tab close event.I have tried Window.addWindowClosingHandler(...) . But this is getting fired when we click any url in the page or refresh. I just want to detect only browser close event. I dont want to capture any other event like browser refresh, url click. Is there any way to detect only that.
it should work
Window.addCloseHandler(new CloseHandler<Window>() {
#Override
public void onClose(CloseEvent<Window> event) {
Window.alert("bye bye beautiful");
}
});
[EDIT]
or maybe you search onBrowserEvent(); and detect which event user do
public void onBrowserEvent(Event event)
{
switch (DOM.eventGetType(event))
Event.onClick
Event.onPaste
Event.onLoad
JavaScript doesn't expose what caused the page to get closed, so GWT unfortunately cannot expose this information.
The underlying JavaScript event is the onbeforeunload event.
You could use session cookies, as described in the selected answer of this question:
GWT WindowClosingHandler firing on Browser refresh too

Categories

Resources