Example #1
0
        static void Main(string[] args)
        {
            Logger.EnableLogger(true);
            try
            {
                string fileName = GetFileName(args);

                HydrometInfoUtility.SetDefaultHydrometServer();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.ThreadExit      += new EventHandler(Application_ThreadExit);
                Application.ApplicationExit += new EventHandler(Application_ApplicationExit);


                piscesForm1 = new PiscesForm(fileName);

                piscesForm1.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed);

                Application.Run(piscesForm1);

                PostgreSQL.ClearAllPools();
                FileUtility.CleanTempPath();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Logger.EnableLogger(true);
            var x = HdbPoet.Hdb.Instance; // force this assembly to load.

            try
            {
                string fileName = "";
                if (args.Length == 1)
                {
                    fileName = args[0];
                    if (!File.Exists(fileName))
                    {
                        MessageBox.Show("Could not open file '" + fileName + "'");
                        return;
                    }
                }

                else if (UserPreference.Lookup("fileName") != "" &&
                         File.Exists(UserPreference.Lookup("fileName")) &&
                         Path.GetExtension(UserPreference.Lookup("fileName")) != ".sdf")
                {
                    fileName = UserPreference.Lookup("fileName");
                }
                else
                {// open default database
                    fileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\tsdatabase.pdb";
                }

                if (!File.Exists(fileName))
                {
                    SQLiteServer.CreateNewDatabase(fileName);
                }

                HydrometInfoUtility.SetDefaultHydrometServer();


                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.ThreadExit      += new EventHandler(Application_ThreadExit);
                Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
                //Application.Idle += new EventHandler(Application_Idle);
                //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);


                explorer = new PiscesSettings(new ExplorerView());
                // explorer.Database

                explorer.Open(fileName);
                db = explorer.Database;

                piscesForm1 = new PiscesForm(explorer);



                piscesForm1.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed);
                //Pisces2 p2 = new Pisces2(explorer);
                //p2.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed);

                Application.Run(piscesForm1);
                explorer.Database.SaveSettingsToDatabase(explorer.TimeWindow);
                //db.SaveSettingsToDatabase(explorer.TimeWindow);

                PostgreSQL.ClearAllPools();

                FileUtility.CleanTempPath();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }
        }