Example #1
0
        static void Main()
        {
            if (ApplicationRunningHelper.AlreadyRunning())
            {
                return;
            }

            SetMinimizeMemory();

            try
            {
                //DevExpress.UserSkins.OfficeSkins.Register();
                //DevExpress.UserSkins.BonusSkins.Register();
                //DevExpress.Skins.SkinManager.EnableFormSkins();
                //DevExpress.Skins.SkinManager.EnableFormSkinsIfNotVista();
                //DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();

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

                string appSkin = UiUtility.ApplicationStyle;

                if (!string.IsNullOrEmpty(appSkin))
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(appSkin);
                }
                else
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle();
                }



                StartApplication();

                //Cursor.Current = Cursors.WaitCursor;

                //Process objProcess = Process.GetCurrentProcess();
                //string currAppName = objProcess.ProcessName;

                //if (Process.GetProcessesByName(currAppName).Length > 1)
                //{
                //    Cursor.Current = Cursors.Default;
                //    XtraMessageBox.Show("Print Partial Opened", "Please Check", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    Application.ExitThread();
                //    Application.Exit();
                //}
                //else
                //{
                //    Cursor.Current = Cursors.Default;
                //    StartApplication();
                //}
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                XtraMessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (ApplicationRunningHelper.AlreadyRunning())
            {
                Shutdown();
            }

            DispatcherUnhandledException += OnUnhandledException;
        }
 static void Main()
 {
     if (ApplicationRunningHelper.AlreadyRunning())
     {
         return;
     }
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new MainForm());
 }
Example #4
0
        //System.Windows.Forms.Application.EnableVisualStyles();
        // System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                base.OnStartup(e);
                if (ApplicationRunningHelper.AlreadyRunning())
                {
                    System.Windows.Application.Current.Shutdown();
                    return;
                }
                SoftwareLocker.TrialMaker t = new SoftwareLocker.TrialMaker("ZebecLoadMasterGasCommerce", System.IO.Directory.GetCurrentDirectory() + "\\RegFile.reg",
                                                                            Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\1L2O3D4I5C6A7T8O9R2.dbf",
                                                                            "",
                                                                            20, "745");
                byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                    4,   54, 87, 56, 123, 10,   3, 62,
                                    7,    9, 20, 36,  37, 21, 101, 57 };

                t.TripleDESKey = MyOwnKey;
                //TrialMaker.RunTypes Rt=
                TrialMaker.RunTypes RT = t.ShowDialog();
                //bool is_trial;
                if (RT != TrialMaker.RunTypes.Expired)
                {
                    //if (RT == TrialMaker.RunTypes.Full)
                    //    is_trial = false;
                    //else
                    //    is_trial = true;

                    //System.Windows.Application.Run(new MainWindow(is_trial))
                    //if (is_trial == true)
                    //{

                    System.Windows.Application.Current.StartupUri = new Uri("/ZebecLoadMaster;component/MainWindow.xaml",
                                                                            UriKind.Relative);
                    //}
                    //else
                    //{
                    //    System.Windows.Application.Current.Shutdown();
                    //}
                    //LoginDialog dlg = new LoginDialog();
                    //if (dlg.ShowDialog() != true)
                    //    return;

                    //switch (dlg.ChoiceApp)
                    //{
                    //    case ChoiceApp.CustomerEntry:
                    //        StartupUri = new Uri("/MyApp;component/Forms/CustomerEntry.xaml",
                    //            UriKind.Relative);
                    //        break;
                    //    case ChoiceApp.VendorEntry:
                    //        StartupUri = new Uri("/MyApp;component/Forms/VendorEntry.xaml",
                    //            UriKind.Relative);
                    //        break;
                    //}
                }
                else if (RT == TrialMaker.RunTypes.Expired)
                {
                    //System.Windows.MessageBox.Show("Trial Period of this Application Has Expired.Please Contact Administrator");
                    System.Windows.Application.Current.Shutdown();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message + "Error");
            }
        }
Example #5
0
        static void Main()
        {
            if (ApplicationRunningHelper.AlreadyRunning())
            {
                XtraMessageBox.Show("FG-TRACKING Opened", "Please Check", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();
                //DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();

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


                //check folder permission
                bool isP = IsPermissionFolder();
                if (!isP)
                {
                    AllowFolderPermission();
                }


                string appSkin = UiUtility.ApplicationStyle;

                if (!string.IsNullOrEmpty(appSkin))
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(appSkin);
                }
                else
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle();
                }



                Cursor.Current = Cursors.WaitCursor;

                //Process objProcess = Process.GetCurrentProcess();
                //string currAppName = objProcess.ProcessName;

                //if (Process.GetProcessesByName(currAppName).Length > 1)
                //{
                //    Cursor.Current = Cursors.Default;

                //    Application.ExitThread();
                //    Application.Exit();
                //}
                //else
                //{
                if (UiUtility.IsAutoCheckVersion)
                {
                    bool    isClearGrid = false;
                    Version curVersion  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                    Version newVersion  = UiUtility.CheckVersion(false, out isClearGrid);//NewVersion();

                    if (curVersion.CompareTo(newVersion) != 0)
                    {
                        Cursor.Current = Cursors.Default;

                        XtraMessageBox.Show("THE SYSTEM DETECTED NEW VERSION!!", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        string fileUpdate = string.Format("{0}\\{1}", Application.StartupPath, ConfigurationManager.AppSettings["AppUpdate"]);
                        if (File.Exists(fileUpdate))
                        {
                            //Check Clear Grid
                            if (isClearGrid)
                            {
                                ClearGridHistory();
                            }

                            using (Process proc = new Process())
                            {
                                proc.StartInfo.FileName  = fileUpdate;
                                proc.StartInfo.Arguments = string.Format("\"{0}\"", Application.StartupPath);
                                proc.Start();
                            }

                            GC.Collect();
                            GC.WaitForPendingFinalizers();

                            Application.Exit();
                        }
                        else
                        {
                            StartApplication();
                        }
                    }
                    else
                    {
                        Cursor.Current = Cursors.Default;
                        StartApplication();
                    }
                }
                else
                {
                    Cursor.Current = Cursors.Default;
                    StartApplication();
                }

                //}
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                XtraMessageBox.Show(ex.Message);
            }
        }