Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Tuesday, November 3, 2015

Silverlight 4.0 feature #1: Right click Mouse events [Context Menu]

 Here is some code for get a right-click mouse event to work in silverlight!



Silverlight 4.0 feature #1: Right click Mouse events [Context Menu]

A C1 Visual Style aware Message Box - Our ComponentOne

Here ware two artcles about how to use the component one Message Box control for Silverlight.  The message box the comes with Silverlight is really limiting. It only allows users to send "OK" and "Cancel" as responses. the Component One version gives a lot more options but the problem is it does not return any values so instead you have to do the following:




C1MessageBox.Show("Do you want to delete?", "The question", C1MessageBoxButton.YesNoCancel, C1MessageBoxIcon.Question,
                new System.Action<MessageBoxResult>((result) =>
                {
                    switch (result)
                    {
                        case MessageBoxResult.Yes:
                            MessageBox.Show("You Pressed Yes");
                            break;
                        case MessageBoxResult.No:
                            MessageBox.Show("You Pressed No");
                            break;
                        case MessageBoxResult.Cancel:
                            MessageBox.Show("Are you sure you want to cancel");
                            break;
                    }
                }));




A C1 Visual Style aware Message Box - Our ComponentOne



and



http://our.componentone.com/groups/topic/c1messageboxresult/

Monday, February 16, 2015

Friday, August 22, 2014

Using Powershells Scripts in Software Solutions

I've been working on a project that will require being able to run Powershell scripts from a Silverlight application. What we want is to give users the option of running their own scripts to do calculations that our app does not already do. Fortunately, one of my co-workers has already figured out how to add add a routine to run Powershell scripts. All we need to do is to pass it the script as a text string. He used two articles to write the service we are using:

http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C
http://www.codeproject.com/Articles/18409/Asynchronously-Execute-PowerShell-Scripts-from-C

In addition there are three things that came up in trying to write Powersehell scripts. 1. The set-excutionpolicy cmdlet must be set on the computer that will run the scripts. A good link for understanding what your options is: http://technet.microsoft.com/en-us/library/ee176961.aspx
You should choose the option that is best for your situation. Because our app will be on a webserver, we will need to use high security like the policy "allsigned" because then only signed scripts will be allowed to run.

2. This choice means that I  had to figure out how to digitally sign my scripts. One easy way would have been to buy a digital certificate from Globalsign or Verisign. Problem is that this can be expensive, so I opted for self-signing. Searching the internet kept turning up a solution such as:

http://powershellscripts.com/article3_powershell_script_signing.html

The problem with this is that I could not install the sdk so I could run MakeCert.exe This means that I could not create a certificate let alone sign my scripts. But I found a Powershell scripts that creates a certificate for free and when I tired to use the certificate, it worked! You can find the script at:

http://itproguru.com/expert/2013/10/how-to-create-a-self-signed-computer-certificate-using-powershell-step-by-step-much-easier-than-makecert-exe/

The following article explains what to do with the certificate after generating it. One important thing to remember is that when the script is signed, it is important to export the certificate because if you wanna run the script on a different computer than the one you wrote the script on, you have to install your certificate on that computer.

http://www.hanselman.com/blog/SigningPowerShellScripts.aspx

I did find a problem. Sometimes you may get an error when you try to run:

PS C:\> Set-AuthenticodeSignature c:\foo.ps1 @(Get-ChildItem cert:\CurrentUser\My -codesign)[0]

where C:\foo.ps1 is the name of the script you are signing. The error is an "Unknown Error". Here is a link that explains how to fix it. I just opened the script in notepad and then resaved it and the error went away just like the article said it would

http://blogs.msdn.com/b/vijay/archive/2010/07/13/quot-set-authenticodesignature-quot-returns-unknown-error-while-registering-the-script-with-a-certificate.aspx

3. The other issue is that some scripts require administrative permissions to run properly. It would be best if the program could elevate itself rather than be ran from a prompt with administrative permission. This is very important for me too because I'm calling the script from Silverlight not from a command prompt. But this article saved me.

http://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator

All in all,putting these three things together will mean being able to write powershell scripts in any Windows environment.



Sunday, March 30, 2014

Monday, December 2, 2013

Split a XAP file up

Sometimes a silverlight file (*.xap) gets to be large. The larger the file, the longer it takes to load in your browser. One of my co-workers suggested splitting it up into smaller modules and loading them as needed to make the wait time in the initial load shorter.  The following link tells how to do that!

Split a XAP file up

Monday, November 25, 2013

timer - creating a delay on silverlight - Stack Overflow

 Here is some non-blocking coding solutions to using timers in a Silverlight Web App.

timer - creating a delay on silverlight - Stack Overflow

Thursday, June 27, 2013

How to Get Full File Path in Silverlight - CodeProject

Silverlight Logo
Silverlight Logo (Photo credit: Wikipedia)
I have been looking for the option to make Silverlight return the full file path of a file for years! Here is article with a solution with the following limitations:

This solution will perfectly work on Internet Explorer, will only show file name on Firefox and won't work on Chrome, because of Input element implementation... :@ 

Better than nothing!

How to Get Full File Path in Silverlight - CodeProject
Enhanced by Zemanta

Tuesday, June 18, 2013

A Silverlight Resizable TextBlock (and other resizable things) | Colin Eberhardt's Technology Adventures

For several months i have been looking for Silverlight code to make it possible to make the elements on a form resizeable. This code does it. I can even get the example to work. Now I just have to add it to my project.

A Silverlight Resizable TextBlock (and other resizable things) | Colin Eberhardt's Technology Adventures

Monday, November 5, 2012

Mister Goodcat | Silverlight 5 Tidbits–Trusted applications

Image representing Microsoft Silverlight as de...
Image via CrunchBase
Here is a good article about how to make and deploy a Silverlight 5 program so that it can work as an in-browser trusted application.

Mister Goodcat | Silverlight 5 Tidbits–Trusted applications
Enhanced by Zemanta

Thursday, September 20, 2012

Tuesday, June 12, 2012

Silverlight 5 – Elevated Trust In-Browser « xamlgeek

Image representing Microsoft Silverlight as de...
Image via CrunchBase
 This will be useful
In Silverlight 5 it is possible to enable applications to run with elevated permissions in-browser.
The code snippet below will open Notepad.exe using the AutomationFactory in Silverlight. Using the AutomationFactory requires elevated permissions.

clip_image001
To run the snippet in Silverlight 4 the application must run with elevated permissions and in out-of-browser. In Silverlight 5 it is possible to run the snippet in-browser and with elevated permissions.


Silverlight 5 – Elevated Trust In-Browser « xamlgeek
Enhanced by Zemanta

Friday, April 20, 2012

Rename Visual Studio Projects and Resolve Related Issues for a Silverlight Application - CodeProject®

Introduction

The Visual Studio allows us to creating a custom project template for adding a new project based on the settings and references in an existing one. Developers can use this approach to rename a project with related assembly and default namespace when adding a new project. For existing projects in the solution, however, manually changing those names seems more practical and straightforward. The manual renaming tasks are not so hard for an ASP.NET, WPF, or Windows application whereas some special cares are needed for Silverlight web applications. This article provides a guide for how to rename Silverlight projects, reset links between projects due to name changes, and resolve some related issues so that the application will not crash after even extensive name changes.


Rename Visual Studio Projects and Resolve Related Issues for a Silverlight Application - CodeProject®

Tuesday, April 17, 2012

Working with Media in HTML5 - CodeProject®

Deutsch: HTML5 Logo English: HTML5 official lo...
Deutsch: HTML5 Logo English: HTML5 official logo (official since 1 April 2011, see FAQ) Français : Logo HTML5 ‪中文(简体)‬: HTML5标志 ‪中文(繁體)‬: HTML5標識 (Photo credit: Wikipedia)
Introduction to article
HTML5 it is poised to reshape the rich Internet application landscape. It’s set to be the new standard way of playing media on a Web page without a browser plug-in - required with Silverlight, the current accepted alternative to Flash. Here are tips for working with media in HTML5.
Working with Media in HTML5 - CodeProject®
Enhanced by Zemanta

Thursday, March 29, 2012

Popup MessageBox Using Silverlight4.0 - CodeProject®

Abstract for Artitcle
Simple but presentable message boxes for Silverlight developers. Designed for ease of integration with existing projects

Popup MessageBox Using Silverlight4.0 - CodeProject®

Thursday, March 8, 2012

Plotting Circular Relationship Graphs with Silverlight - CodeProject®

Silverlight Logo
Image via Wikipedia
Introduction to Bookmarkable Article
This article describes the creation of a circular relationship graph, which plots a network of interconnected nodes as a circle.

Plotting Circular Relationship Graphs with Silverlight - CodeProject®
Enhanced by Zemanta

Tuesday, February 21, 2012

Silverlight Tip of the Day #30 – Sending Email from Silverlight | Everything Silverlight

Here is a great blog post giving a tip about how to add a web service for sending e-mail from Silverlight. It makes the solution extremely easy but we must installations on the server. And unlike many tutorials on the Internet, this article explains what needs to be done and not just post the code.


Silverlight Tip of the Day #30 – Sending Email from Silverlight | Everything Silverlight

Tuesday, February 7, 2012

Silverlight web comic - CodeProject®

Image representing Microsoft Silverlight as de...
Image via CrunchBase
Introduction to Article by apis3445

When the Visual Studio 2010 was still on beta I participate on a Microsoft competition from Mexico to develop an application with the new .NET framework 4.0 new the prize was a laptop. So because I like to learn new technologies (like ajax, wpf, linq, sdk of kinect, apis for google maps, google docs, Verifones TPV, fingerprints, a csc, xcode, develop for android etc). I wanted learn about silverlight because I didn't know silverlight and I like draw and I wanted my own page to create a simple comic. I ressearched if there was an existing page for create comics, but I found only a few pages, so I decide to learn silverlight and submit a silverlight application to create a webcomic for the competition.


Silverlight web comic - CodeProject®
Enhanced by Zemanta

Configure Silverlight 3 Applications using the Web.config File from ASP.NET - CodeProject®

Image representing Microsoft Silverlight as de...
Image via CrunchBase
 Here is a good tutorial for trying to  pass information from a server to Silverlight.

Configure Silverlight 3 Applications using the Web.config File from ASP.NET - CodeProject®
Enhanced by Zemanta