Windows Phone Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 27 June 2008

Making Silverlight Run As an EXE

Posted on 07:01 by Unknown
well sort of.

So I've seen a few things like this: http://www.codeplex.com/SilverlightDesktop and thought I would see how easy it was... turns out to be 'super' simple...

Silverlight is designed to work inside a web browser. That being the case it is also not a ‘desktop’ or exe application. This ‘hack’ then allows us to take Silverlight applications and make them into exe’s. It works great however there are a few issues to keep in mind. One issue is that as shown here the exe won’t run on a 64 bit machine unless you get the 32bit IE engine running in the context of the control we will show. Also Silverlight still needs to be installed on the box and the one small detail about this only working on a windows machine but otherwise works well. The other major down sides is that a lot of things dependent on script injection or cross domain issues will in fact be ‘issues’ but you can work around that.

To start we just need to create a new project in Visual Studio. From the new project window we want to select a Windows Forms Application under windows (under the language of your choice). Once we do this we should get a blank Form 1. You can change the setting or set other values as you like. To get our Silverlight application running we need to add a folder that contains an HTML page and XAP that works from any local path. For example in our first project we could copy the output from our debug folder and call it good.

Once you drag a Silverlight application folder into our project we need to select on each item such as the HTML page and XAP files. In the properties pain of Visual Studio for each item there is a setting called ‘Copy to Output Directory.’ We need to change this setting for everything our Silverlight application depends on to ‘Copy always’.

Now that all the resources are present we need to start adding to the ‘Form’. Basically what we are going to do is add a web browser control that hosts the IE rendering engine that will load our Silverlight application in a web page running locally in an exe. In the tool box on the left side of visual studio under the tap ‘Common Controls’ drag the control onto the form on the design surface. Then resize the form and set any other properties you might want to set (ie: add an icon, or change title etc).

Right click on the form and select ‘View Code’ and add the following code:

string MyPath = Application.StartupPath + "\\[folder of Silverlight App]\\[Some Page].html";

webBrowser1.Navigate(MyPath);

The first line gets the path to our page that has the code to load the XAP for our application. Now then we pass this value into a call to the Navigate method on the web browser control. If you rename it the control name will be different but the sample above is the default. Compile and run the application and you will get your Silverlight application running in a win 32 window. If you wanted to be industrious you get build this in a VB 6 or C++ app doing the same kind of thing and even embed all the resources into the exe or build a custom installer etc and have this running on just about any windows platform with Silverlight even without .NET.
Read More
Posted in beta 2, c#, hack, hacking, Hacking Silverlight, silverlight, silverlight 2 | No comments

Thursday, 26 June 2008

Control Library on Codeplex

Posted on 12:53 by Unknown
I started a code plex project on code plex... dah... that has a Silverlight control library solution with items from the forth coming book. right now I only did unit tests for 7 of the controls namely multi panel and some of the other panels and then mouse wheel support and browser history control etc. Robby's animating panel base (notstatic.com) from Mike H's blog (blogs.msdn.com/mharsh/). download the dll free at:

http://www.codeplex.com/HackingSilverlight
Read More
Posted in Animating Panel Base, c#, controls, hack, hacking, Hacking Silverlight, radial panel, random panel, robby, silverlight 2, wrappanel, xaml | No comments

Wednesday, 18 June 2008

google command line...

Posted on 12:44 by Unknown
ok so this one isnt' exactly a silverlight related posted but it is very cool. :) some one with clearly to much time on their hands implemented a web page that behaves like a console app (command line shell sort of thing) ... check it out at:

http://goosh.org/
Read More
Posted in google, hack, HTML | No comments

Tuesday, 17 June 2008

Hacking Silverlight 2 on Amazon

Posted on 13:25 by Unknown
Available for pre order on Amazon.

http://www.amazon.com/Hacking-Silverlight-2-David-Kelley/dp/1933988576/ref=sr_1_1?ie=UTF8&s=books&qid=1213734172&sr=8-1
Read More
Posted in Hacking Silverlight, manning, silverlight 2 | No comments

Thursday, 12 June 2008

Another Radial Panel

Posted on 09:04 by Unknown
A few weeks back I did a post(s) on panels using Robby's animating panel base including a Radial panel. Jobi a friend of mine did a post on his radial panel he wrote so I thought I would share that with everyone. Jobi's post gets more into explaining the math where I just showed so I thought it would be interesting if your into Silverlight Panels.

http://jobijoy.blogspot.com/2008/04/simple-radial-panel-for-wpf-and.html
Read More
Posted in identitymine, jobi, panels, radial panel, robby, silverlight 2 | No comments

Wednesday, 11 June 2008

DR. WPF on Pixel8

Posted on 12:33 by Unknown
for those that know dr. WPF. good guy I might add not that I know is super secret identity or anything... check out the pod cast at:

http://pixel8.infragistics.com/#Episode:9035
Read More
Posted in Dr WPF, WPF | No comments

Beta 2 and Hacking the DOM

Posted on 12:25 by Unknown
So Beta 2 is live now. finally :) and life is good. I did have a few issues getting it running but thats what happens when you use daily builds between releases... I'm building this 'video showcase app' in silverlight for a here to be annouced group at MS and need to interact with all their old bits they build around flash... One of the issues is that they pass the data and a collection of objects and instead of passing the base JSONthey map the data and process it into this collection to pass into the 'showcase'. At first I went down the JSON road and since they wouldn't pass in the JSON or lest me call the service directly this turned out to be problematic. Using ScriptObject I could get to values and properties but how do you work with a collection in javascript from silverlight...

As intensely intuitive as it seems besides using GetProperty off of an instance of ScriptObject for properties I can also use it to grab collection items so that means something like this works:

(ScriptObject)SomeChild = (ScriptObject)foobar.getProperty("0");

basically I can pass in an indexer as if it was a property and actually get a reference to that element. Personally I have mixed feelings about this but it works. And I don't have to do script injection or some other weird ness to make it work.
Read More
Posted in hack, javascript, json, silverlight 2 | No comments

Monday, 9 June 2008

Silverlight 2 Beta 2 Live

Posted on 08:55 by Unknown
with much ado

http://www.microsoft.com/silverlight/resources/install.aspx?v=2.0
Read More
Posted in silverlight 2, teched | No comments

Tuesday, 3 June 2008

Crossfader At TechEd

Posted on 07:05 by Unknown
Aw My lifes work is imortalized for 5 minutes in Bill G's teched presentation.

check out the pictures at:

http://www.facebook.com/album.php?aid=38501&l=1b348&id=721326429


off the web:

http://www.microsoft.com/techedonline/default.aspx

Live Tech·Ed NA Developers Keynote delivered by Bill Gates Tuesday, June 3, 2008, 8:30–10:00am EST What better way to kick off this year’s first premier technical education conference, Microsoft Tech·Ed North America 2008 Developers, than with Bill Gates, Microsoft Chairman. Join us to hear and learn about the vision of the IT industry in the years to come. High Medium Low
Read More
Posted in beta 2, crossfader, keynote, silverlight 2, teched | No comments

Monday, 2 June 2008

More on Panels

Posted on 23:04 by Unknown
I was playing around and made a few more panels. Lets start with a random panel. This panel builds on what we learned about the animating panel base and allows us to layout everything out randomly on screen. This is especially interesting for doing graphics randomly placed around the UI and is more for effect then what you would use in a real business application. A logical use for this might be a portfolio or other like function or just for fun. If we start with the Animating Wrap Panel we need to redo the arrange method starting with replacing the variables at the top with the following:

double Width = 0;
double Height = 0;
Random ThisNum = new Random();

Like the Wrap Panel we still need to run through all the panel children. Our loop should have its internal code replaced with the following:

Width = element.DesiredSize.Width;
Height = element.DesiredSize.Height;

double NewX = double.Parse(ThisNum.Next(
int.Parse(this.Width.ToString())).ToString());
double NewY = double.Parse(ThisNum.Next(
int.Parse(this.Height.ToString())).ToString());

if (MyFirstTime)
{
SetElementLocation(element, new
Rect(NewX, 1500, Width, Height), false);
}
else
{
SetElementLocation(element, new Rect(NewX, NewY, Width, Height));
}

In this case we see that we are creating new Random X,Y values so that our layout is unique every single time. We then like the other panels call the SetElementLocation in like manner. Other wise this panel is much the same as the others.

This panel allows us more interesting possibilities now we will address one more common panel that you might want to use and animate

Animating Radial Panel

So starting with the radial panel we need to do a little more math then the others. Building this panel we add 3 variables to the class itself like this listing:
protected void GetListOfPoints(int pointCount, double Width)
{
double x = Width / 2;

Radius = x;

double y = 0;

double theta = (2 * Math.PI) / pointCount;

for (int i = 0; i < pointCount; i++)
{
if (i > 0)
{
x = (Radius * (Math.Cos((i) * theta)));
y = (Radius * (Math.Sin((i) * theta)));
}

XList.Add(x + Radius);
YList.Add(y + Radius);
}
}

With out getting into great detail this method basically gives the points we need to layout our children on. Now we can alter the arrange override and we are good. In the arrange we start with variables like this:

double Width = 0;
double Height = 0;

GetListOfPoints(this.Children.Count, this.Width );
int Count = 0;

Width = element.DesiredSize.Width;
Height = element.DesiredSize.Height;

if (MyFirstTime)
{
SetElementLocation(element, new
Rect(XList[Count], 1500, Width, Height), false);
}
else
{
SetElementLocation(element, new
Rect(XList[Count], YList[Count], Width, Height));
}

Count++;The rest of the method is the same once we drop out of the loop like the wrap panel. In this case the biggest difference in the loop is having to track our position so we can get the right X/Y values for the layout.

By default like the other panels we did using the animating panel base we start be animating the children from off the screen below. All of these panels are included in the panel factory download off of HackingSilverlight.net. With that you can do all the hot panels you like.

http://www.hackingsilverlight.net/samples/PanelFactory.zip
Read More
Posted in panels, radial panel, random panel, silverlight 2 | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • Silverlight Streaming in 5 minutes or less
    Microsoft as part of the whole Silverlight ‘thing’ has provided a service to allow people to upload videos and get those video streamed alon...
  • Silverlight Applications Taking All the Available Realestate
    Karim sent me this. It is a simple way make sure you Silverlight Application uses all the available realestate using just CSS: /*...
  • Silverlight TV Episode 3: Multi-Touch 101 with Silverlight
    John interviews Silverlight MVP David Kelley (thats me) about developing multi-touch applications in Silverlight. I discuss the types of mul...
  • Dependency Injection Made Easy
    Part of the whole fun with doing 'ard'd samples is just the fun of doing something not quit PC but the bottom line really is doing c...
  • Silverlight Preloader animation is the answer
    I got this email today: Hi! In our project we call a function which retrieves a data from a webservice. This function takes some time 1-3 se...
  • Silverlight 2 Event bindings
    So in the process of working on this presentation for dev teach and the article and the book I got in a long discussion with alot of the ubb...
  • Windows Phone 7 Development Using Visual Studio 2010
    with David Kelley and AppDev Windows Phone 7 is a new step for Microsoft for the mobile platform. This course will introduce the mobile OS a...
  • Dictionary Definition of Xaml (verb and noun)
    A friend 'Ariel' from www.facingblend.com did a short post about Xaml being a verb. I've heard this a few times and thought th...
  • More on Panels
    I was playing around and made a few more panels. Lets start with a random panel. This panel builds on what we learned about the animating ...
  • No Soap for you! - The No Silverlight Experience
    So I'm collecting hacks for my upcoming book, and I must say, here is a simple one, but one of my favorites... LOL! On my HackingSilver...

Categories

  • .net
  • 3D
  • adam
  • adcontrol
  • adobe
  • agile
  • algorithms
  • analytics
  • andrew
  • android
  • Animating Panel Base
  • animation
  • apache
  • apphub
  • apple
  • apps
  • architecture
  • ariel
  • article
  • ASP.NET
  • balder
  • bar camp
  • behavior
  • best practices
  • beta 1
  • beta 2
  • bi
  • bitmap effect
  • blend
  • blendables
  • blog
  • book
  • book review
  • bookreview
  • browser
  • brush
  • build
  • c#
  • channel9
  • cmm
  • codebrowser
  • codemagazine
  • codemash
  • codeplex
  • color
  • com
  • command
  • composite
  • controls
  • Craig
  • crossfader
  • csharp
  • CSS
  • custom event
  • Dan
  • data
  • datagrid
  • davidjkelley
  • davidkelley
  • ddj
  • Deep Zoom
  • dependencyproperty
  • design
  • design patterns
  • designers
  • devconnections
  • developer
  • developers
  • devin
  • DevTeach
  • dispatcher
  • dotnetslackers
  • dp
  • Dr WPF
  • easy
  • eclipse
  • ecma
  • education
  • einari
  • ET
  • event
  • exchange
  • expression
  • facebook
  • facing blend
  • Faisal
  • firestarter
  • flash
  • flex
  • font
  • free
  • fun
  • futures
  • gadget
  • game
  • games
  • gesture
  • google
  • Grid
  • hack
  • hacking
  • hacking phone 7
  • Hacking Silverlight
  • hard
  • hero
  • holst
  • howto
  • hta
  • HTML
  • html5
  • HTMLAppHostFramework
  • htmlapplication
  • ia
  • identitymine
  • IE
  • IE 8
  • iis
  • images
  • indexability
  • INETA
  • Infragistics
  • Integrator
  • interact
  • iphone
  • isolatedstorage
  • issues
  • itemscontrol
  • ixda
  • jared
  • jason cook
  • javascript
  • jeremiah
  • jobi
  • jobs
  • johnpapa
  • jordan
  • josh
  • jscript
  • json
  • Karim
  • kaxaml
  • kellywhite
  • keynote
  • KimSchmidt
  • law of
  • layout
  • linux
  • listbox
  • LOB
  • mac
  • mango
  • manning
  • marketing
  • marketplace
  • math
  • media element
  • media encoder
  • methodology
  • microsoft
  • MIX
  • MIXer
  • mobile
  • monitization
  • monitizationmodels
  • movie link
  • MSDN
  • msdnbytes
  • msdnradio
  • msretail
  • mstag
  • multitouch
  • MVP
  • MVVM
  • Netflix
  • nike
  • nui
  • object oriented
  • OOB
  • out of browser
  • packt
  • panels
  • parchment
  • parchment apps
  • paths
  • PDC
  • peter
  • phone7
  • phone7unleashed
  • phones
  • php
  • Pixel8
  • pixelshader
  • player
  • popfly
  • prediction
  • preemptive
  • preloader
  • presentations
  • radial panel
  • random panel
  • reference
  • requirements
  • retail
  • review
  • ria
  • robby
  • ROI
  • RPS
  • ryan
  • sajiv thomas
  • SCRUM
  • SD2IG
  • Sea Dragon
  • searchability
  • seattle
  • seattlesilverlight
  • seattleslug
  • sebastian
  • services
  • sharepoint
  • sharepoint2010
  • sic
  • side bar gadget
  • Silver Dragon
  • silverlight
  • silverlight 1
  • silverlight 2
  • silverlight 2.0
  • silverlight 3
  • silverlight 4
  • silverlight insiders
  • silverlight show
  • silverlight4
  • silverlight5
  • Silverlight5
  • silverlightconnections
  • silverlightcream
  • silverlighttv
  • simon
  • simonsaid
  • simple
  • SMART
  • snack
  • stackpanel
  • stevejobs
  • streaming
  • stuartcelarier
  • surface
  • symbian
  • tard
  • teched
  • TED
  • testing
  • textbox
  • TFS
  • threading
  • tim
  • tip
  • tiredallover
  • tool
  • touch
  • touchtag
  • training
  • twitter
  • ui
  • uml
  • usergroup
  • UX
  • uxdesign
  • vagas
  • victor
  • video
  • videos
  • vista
  • visual studio
  • volta
  • VS
  • vsm
  • WCF
  • win8
  • Windows7
  • windows8
  • windowsphone
  • windowsphone7
  • wirestone
  • workflow
  • wp7
  • wp7dev
  • WPF
  • wrappanel
  • wrox
  • xaml
  • xap
  • XML
  • xna
  • zen
  • zphone

Blog Archive

  • ►  2012 (5)
    • ►  May (1)
    • ►  April (2)
    • ►  March (1)
    • ►  February (1)
  • ►  2011 (29)
    • ►  December (2)
    • ►  November (2)
    • ►  October (3)
    • ►  September (1)
    • ►  August (5)
    • ►  June (5)
    • ►  May (2)
    • ►  March (1)
    • ►  February (5)
    • ►  January (3)
  • ►  2010 (51)
    • ►  December (5)
    • ►  November (4)
    • ►  October (3)
    • ►  September (5)
    • ►  August (3)
    • ►  June (3)
    • ►  May (6)
    • ►  April (3)
    • ►  March (9)
    • ►  February (3)
    • ►  January (7)
  • ►  2009 (75)
    • ►  December (3)
    • ►  November (2)
    • ►  October (3)
    • ►  September (7)
    • ►  August (4)
    • ►  July (7)
    • ►  June (9)
    • ►  May (12)
    • ►  April (13)
    • ►  March (8)
    • ►  February (2)
    • ►  January (5)
  • ▼  2008 (119)
    • ►  December (8)
    • ►  November (10)
    • ►  October (12)
    • ►  September (10)
    • ►  August (11)
    • ►  July (4)
    • ▼  June (10)
      • Making Silverlight Run As an EXE
      • Control Library on Codeplex
      • google command line...
      • Hacking Silverlight 2 on Amazon
      • Another Radial Panel
      • DR. WPF on Pixel8
      • Beta 2 and Hacking the DOM
      • Silverlight 2 Beta 2 Live
      • Crossfader At TechEd
      • More on Panels
    • ►  May (5)
    • ►  April (3)
    • ►  March (11)
    • ►  February (8)
    • ►  January (27)
  • ►  2007 (34)
    • ►  December (6)
    • ►  November (11)
    • ►  October (17)
Powered by Blogger.

About Me

Unknown
View my complete profile