예제 #1
0
        static void Main()
        {
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new ThreadExceptionEventHandler(Form1_UIThreadException);

            // Set the unhandled exception mode to force all Windows Forms errors to go through
            // our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Forms.frmSplash frm = new Forms.frmSplash();
            Forms.frmTransparentSplash launch = new Forms.frmTransparentSplash();
            launch.Show();
            launch.Refresh();

            // Check for latest version
            Version vrs = new Version(Application.ProductVersion);
            //lblAppVersion.Caption = String.Format("Version: {0}.{1}.{2}", vrs.Major, vrs.Minor, vrs.Build);
            try
            {
                string latestversion;
                WebClient getversion = new WebClient();
                latestversion = getversion.DownloadString("http://www.smartsimtech.com/software/sstcp-latestversion.txt");
                Version latver = new Version(latestversion);
                getversion.Dispose();
                if (latver > vrs)
                {
                    Forms.frmAutoUpdate update = new Forms.frmAutoUpdate();
                    update.AppVersion = latestversion;
                    update.ShowDialog();
                    if (update.ApplyUpdate)
                        return;
                }
            }
            catch (Exception)
            {
                // No internet access to check for updates
            }

            launch.CheckDatabase();
            //MessageBox.Show(XpoDefault.Session.ConnectionString);
            //XpoDefault.Session.ConnectionString = "data source=localhost\\SQLEXPRESS;integrated security=true;initial catalog=SSTCP2;";
            //XpoDefault.Session.ConnectionString = String.Format("data source=tcp:{0}.database.windows.net;initial catalog={1};user id={2};password={3};", serverName, databaseName, userName, password);

            launch.CheckRegistration();
            XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration));
            view.AddProperty("Name", "Name");
            view.AddProperty("Company", "Company");
            bool registered = false;
            foreach (ViewRecord record in view)
            {
                registered = true;
            }

            if (!registered)
            {
                Forms.frmRegistrationDetails register = new Forms.frmRegistrationDetails();
                register.ShowDialog();
                register.Dispose();
            }

            launch.LaunchApplication();

            if (launch.RunApplication)
            {
                Forms.frmMain MainApp = new Forms.frmMain();
                MainApp.LaunchProcess = launch;
                Application.Run(MainApp);
            }
            else
            {
                launch.Dispose();
            }
        }
예제 #2
0
        private void bbtnRegisterSoftware_ItemClick(object sender, ItemClickEventArgs e)
        {
            frmRegistrationDetails frm = new frmRegistrationDetails();
            frm.ShowDialog();

            // Load Registration Details
            XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration));
            view.AddProperty("Name", "Name");
            view.AddProperty("Company", "Company");
            bool registered = false;
            foreach (ViewRecord record in view)
            {
                lblRegisteredName.Caption = "Registered To: " + (string)record["Name"];
                registered = true;
            }

            if (!registered)
                lblRegisteredName.Caption = "Registered To: Unregistered";
        }