Ejemplo n.º 1
0
 static int Main(string[] args)
 {
     app_path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/pn_document_opener";
     if (System.IO.Directory.Exists(app_path))
     {
         RemoveDirectory(app_path);
     }
     if (System.IO.Directory.Exists(app_path))
     {
         return(1);
     }
     for (int i = 0; i < 10 && !System.IO.Directory.Exists(app_path); ++i)
     {
         try
         {
             System.IO.Directory.CreateDirectory(app_path);
         }
         catch (Exception)
         {
         }
     }
     if (!System.IO.Directory.Exists(app_path))
     {
         System.Windows.Forms.MessageBox.Show("Unable to create directory " + app_path, "PN Document Opener - Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly);
         return(1);
     }
     op_mutex      = new System.Threading.Mutex();
     server        = new WebServer();
     op_win        = new OperationWindow();
     op_win.Size   = new System.Drawing.Size(0, 0);
     op_win.Shown += startWin;
     app_ctx       = new System.Windows.Forms.ApplicationContext(op_win);
     System.Windows.Forms.Application.Run(app_ctx);
     return(0);
 }
 static int Main(string[] args)
 {
     app_path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"/pn_document_opener";
     if (System.IO.Directory.Exists(app_path))
         RemoveDirectory(app_path);
     if (System.IO.Directory.Exists(app_path)) return 1;
     for (int i = 0; i < 10 && !System.IO.Directory.Exists(app_path); ++i)
     {
         try
         {
             System.IO.Directory.CreateDirectory(app_path);
         }
         catch (Exception)
         {
         }
     }
     if (!System.IO.Directory.Exists(app_path))
     {
         System.Windows.Forms.MessageBox.Show("Unable to create directory " + app_path, "PN Document Opener - Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly);
         return 1;
     }
     op_mutex = new System.Threading.Mutex();
     server = new WebServer();
     op_win = new OperationWindow();
     op_win.Size = new System.Drawing.Size(0,0);
     op_win.Shown += startWin;
     app_ctx = new System.Windows.Forms.ApplicationContext(op_win);
     System.Windows.Forms.Application.Run(app_ctx);
     return 0;
 }