Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Wed Nov 22, 2017 5:37 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri May 27, 2011 7:28 am 
Offline

Joined: Wed May 25, 2011 10:49 am
Posts: 8
Is there a way to detect the application is in simulation mode? My C# code currently connects to an external device no matter what. It would be nice if I could programatically detect actual or simulation mode and load the appropriate classes.


Top
 Profile  
 
PostPosted: Wed Jun 01, 2011 7:40 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
When simulate is running the following will be true:

Code:
if (Environment.CommandLine.Contains("/DataSourceSimulation"))


So if you put it in your opened event of your start screen:

Code:
 public partial class Screen1
    {
            void Screen1_Opened(System.Object sender, System.EventArgs e)
            {
                  if (Environment.CommandLine.Contains
("/DataSourceSimulation"))
                        MessageBox.Show("Simulation only!!!");
                  else
                        MessageBox.Show("Comm drivers active");
            }
    }


This will give a popup that shows if comms are active or if simulation mode
is active.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group