Esempio n. 1
0
        /// <summary>
        /// This method store the information into registry
        /// </summary>
        /// <param name="regPath"></param>
        /// <returns></returns>
        private Boolean SaveValuesToPath(String regPath)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(regPath);

            if (key == null)
            {
                return(false);
            }
            else
            {
                // convert to regsz
                String strCheckForUpdate  = CheckForUpdate.ToString();
                String strLastCheckTime   = LastCheckTime.ToString();
                String strSkipThisVersion = SkipThisVersion.ToString();
                String strDidRunOnc       = DidRunOnce.ToString();
                String strProfileTime     = LastProfileUpdate.ToString();

                // set the values
                key.SetValue("CheckForUpdate", strCheckForUpdate, RegistryValueKind.String);
                key.SetValue("LastCheckTime", strLastCheckTime, RegistryValueKind.String);
                key.SetValue("SkipThisVersion", strSkipThisVersion, RegistryValueKind.String);
                key.SetValue("DidRunOnce", strDidRunOnc, RegistryValueKind.String);
                key.SetValue("LastProfileUpdate", strProfileTime, RegistryValueKind.String);

                return(true);
            }
        }
Esempio n. 2
0
        public MainWindow()
        {
            var kernel = KernelConstructor.GetKernel();

            _main         = kernel.Get <Main.Main>();
            _main.Output += Main_Output;
            _main.ExposureTimeCalculated += _main_ExposureTimeCalculated;

            Arguments = new ApplicationArguments
            {
                MeasurementsNrOfRows    = 7,
                MeasurementsNrOfColumns = 12,
                High                 = byte.MaxValue,
                Low                  = 175,
                LcdWidth             = 2560,
                LcdHeight            = 1440,
                DesiredResistance    = 8820,
                FileType             = ImageFileType.Png.ToString(),
                OriginalExposureTime = 8000
            };

            InitializeComponent();

            var releaseManager = kernel.Get <IReleaseManager>();

            CheckForUpdateComponent = new CheckForUpdate(releaseManager, this);
            CheckForUpdateComponent.PropertyChanged += CheckForUpdateComponent_PropertyChanged;

            Loaded += (sender, args) => CheckForUpdateComponent.Check();
        }
Esempio n. 3
0
        private void Login_Load(object sender, System.EventArgs e)
        {
            //初始化部门
            //getAllDept
            if (CheckForUpdate.IsUpdate())
            {
                //this.Close();
                Application.Exit();
                Process.Start("AutoUpdate.exe");
                return;
            }
            //this.Visible = false;

            if (File.Exists(Application.StartupPath + @"\BatchScript.bat") && File.Exists(Application.StartupPath + @"\Script.sql"))
            {
                Process.Start("BatchScript.bat");
            }
            if (File.Exists(Application.StartupPath + @"\AutoUpdate.exe.delete"))
            {
                //Process.Start("BatchScript.bat");
                File.Delete(Application.StartupPath + @"\AutoUpdate.exe.delete");
            }

            try
            {
                SecurityManage security = new SecurityManage();
                DataTable      dtDept   = security.getAllDept();
                cmbDept.DataSource    = dtDept;
                cmbDept.DisplayMember = "部门名称";
                cmbDept.ValueMember   = "部门ID";
                cmbDept.DataBind();
                cmbDept.SelectedIndex = 0;
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.txtOperName.Focus();
                //isLogin = false;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                //this.btnLogin.DialogResult = DialogResult.Cancel;
            }
        }
        /// <summary>
        /// This method store the information into registry
        /// </summary>
        /// <param name="regPath">the registry path</param>
        /// <returns><c>true</c> if the values were saved to the registry</returns>
        private void SaveValuesToPath(string regPath)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(regPath);

            if (key == null)
            {
                return;
            }
            // convert to regsz
            String strCheckForUpdate  = CheckForUpdate.ToString();
            String strLastCheckTime   = LastCheckTime.ToString(CultureInfo.InvariantCulture);
            String strSkipThisVersion = SkipThisVersion;
            String strDidRunOnc       = DidRunOnce.ToString();
            String strProfileTime     = LastProfileUpdate.ToString(CultureInfo.InvariantCulture);

            // set the values
            key.SetValue("CheckForUpdate", strCheckForUpdate, RegistryValueKind.String);
            key.SetValue("LastCheckTime", strLastCheckTime, RegistryValueKind.String);
            key.SetValue("SkipThisVersion", strSkipThisVersion, RegistryValueKind.String);
            key.SetValue("DidRunOnce", strDidRunOnc, RegistryValueKind.String);
            key.SetValue("LastProfileUpdate", strProfileTime, RegistryValueKind.String);
        }
Esempio n. 5
0
    static HydrogenStartup()
    {
        string lastChecked = EditorPrefs.GetString("HydrogenFramework_LastChecked");

        // Have we ever checked for an update?
        if (string.IsNullOrEmpty(lastChecked))
        {
            CheckForUpdate.CheckUpdate();
        }
        else
        {
            // Parse out times to determine duration
            DateTime lastTime = DateTime.Parse(lastChecked);
            TimeSpan span     = DateTime.Now - lastTime;

            // Every 48 hours
            if (span.TotalHours > 48)
            {
                CheckForUpdate.CheckUpdate();
            }
        }
    }
Esempio n. 6
0
 private void MenuCheckForUpdate_Click(object sender, EventArgs e)
 {
     CheckForUpdate.CheckUpdate();
 }
Esempio n. 7
0
        /// <summary>
        /// Verifies the update.
        /// </summary>
        public static void VerifyUpdate(Boolean infoIfVersionUpdated = true)
        {
            string url = Argon.Windows.Forms.Properties.Settings.Default.CheckLastVersionUrl;

            CheckForUpdate.Verify(url, infoIfVersionUpdated);
        }
Esempio n. 8
0
 public void CheckUpdate()
 {
     StartCoroutine(CheckForUpdate.Check(updateText, updateButton));
 }