wx.SampleLauncher.MiddleHtmlWindow Class Reference

List of all members.

Public Member Functions

 MiddleHtmlWindow (LauncherFrame parent)
override void OnLinkClicked (wx.Html.HtmlLinkInfo link)


Detailed Description

Definition at line 109 of file Launcher.cs.


Constructor & Destructor Documentation

wx.SampleLauncher.MiddleHtmlWindow.MiddleHtmlWindow ( LauncherFrame  parent  ) 

Definition at line 115 of file Launcher.cs.

00116                         : base( parent )
00117                 {
00118                         this.parent = parent;
00119                 
00120                         LoadPage( "../Samples/Launcher/wx.NETSamplesLauncher.html" );
00121                 }


Member Function Documentation

override void wx.SampleLauncher.MiddleHtmlWindow.OnLinkClicked ( wx.Html.HtmlLinkInfo  link  ) 

Definition at line 125 of file Launcher.cs.

References File.

00126                 {
00127                         string app = link.Href;
00128             string args = "";
00129             if (app.Contains("?"))
00130             {
00131                 int indexQM=app.IndexOf('?');
00132                 args = app.Substring(indexQM + 1);
00133                 app = app.Substring(0, indexQM);
00134             }
00135                         
00136                         if ( System.IO.File.Exists( app + ".exe" ) )
00137                         {
00138                                 string launch_command = "";
00139 
00140                 // If we are on a Linux platform, use wxnet-run script to
00141                 // launch samples. This is not used to pick up environment
00142                 // as this gets inherited. The script ensures we use the
00143                 // .NET runtime the user has selected.
00144                 if (File.Exists("wxnet-run"))
00145                     launch_command = "./wxnet-run " + app + ".exe";
00146 
00147                 // On MacOS we need to launch the appropriate bundle
00148                 else if (Directory.Exists("../MacBundles"))
00149                     launch_command = "open ../MacBundles/" + app + ".app";
00150 
00151                 else if (Environment.OSVersion.Platform == PlatformID.Unix
00152                     || Environment.OSVersion.Platform == PlatformID.MacOSX)
00153                 {
00154                     // platform is UNIX / LINUX. try mono
00155                     launch_command = "mono";
00156                     if (args == null)
00157                         args = "";
00158                     args = string.Format("{0}.exe {1}", app, args);
00159                 }
00160                 else
00161                     // Everything else (Windows for now) just execute the assembly
00162                     launch_command = app + ".exe";
00163 
00164                                 try
00165                                 {
00166                     string statusText = "Executing " + launch_command;
00167                     if (args != null)
00168                         statusText += " " + args;
00169                     parent.StatusText = statusText;
00170                                         Process.Start( launch_command, args );
00171                                 }
00172                                 catch (Exception ex)
00173                                 {
00174                                         TellError("Error running command '" + launch_command + "': " +
00175                                                 ex.Message);
00176                                 }
00177                         }
00178                         else
00179                         {
00180                                 TellError("The sample " + app + " could not be found in the 'Bin' directory. The sample may not be available on your operating system or it could not be built because of missing development libraries.");
00181                         }
00182                 }


Manual of the wx.NET   (c) 2003-2010 the wx.NET project