예제 #1
0
파일: Program.cs 프로젝트: jramshur/SRD_GUI
 static void Main()
 {
     try
     {
         m_logger.Info("VERSION", Assembly.GetExecutingAssembly().GetName().Version);
         m_logger.Info("OS", Environment.OSVersion);
         m_logger.Info("Path",Application.StartupPath);
         bool createdNew = true;
         //Global Mutex for SIngle instance application
         using (Mutex mutex = new Mutex(true, "PSoC Data Logger", out createdNew))
         {
             //Check if mutex obtained
             if (createdNew)
             {
                 Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 communicator = new VOManager.DASCommunicator();
                 MainScreen = new FrmMain();//Start Application from Main form
                 Application.Run(MainScreen);
             }
             else//Display message that the appliocation is running
             {
                 Process current = Process.GetCurrentProcess();
                 foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                 {
                     if (process.Id != current.Id)
                     {
                         MessageBox.Show("The application is already open", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         break;
                     }
                 }
             }
         }
     }
     catch(Exception ex)
     {
         m_logger.Error(ex);
     }
     try
     {
         MainScreen.Stop();
     }
     catch (Exception)
     {
     }
 }
예제 #2
0
 public FrmPopUpBrowser(Form callingForm)
 {
     mainfrm = callingForm as FrmMain;
     InitializeComponent();
 }