예제 #1
0
        static void Main()
        {
            if (!Proceed())
            {
                MessageBox.Show("Unlicensed Product. \nCall on : 9879539134 to get valid license", "Unlicensed Product", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            try
            {
                string GUID = Assembly.GetExecutingAssembly().GetType().GUID.ToString();
                using (Mutex mutex = new Mutex(false, @"Global\" + GUID))
                {
                    if (!mutex.WaitOne(0, false))
                    {
                        MessageBox.Show("GST Billing Software is already running.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    GC.Collect();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    SqliteDb objSqlLite = new SqliteDb();
                    objSqlLite.CreateDatabase();

                    Application.Run(new Login());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("An unexpected error occured. Please restart the application.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }