Ejemplo n.º 1
0
        private void Btn_save_Click(object sender, EventArgs e)
        {
            Configure configure = new Configure();

            try
            {
                configure.Database          = cmb_database.SelectedItem.ToString();
                configure.Timer             = (int)nmr_timer.Value;
                configure.IsStartWithWindow = cb_Startup.Checked;
                if (cb_Startup.Checked == true)
                {
                    StartUpWindow.RegistrationStartUp();
                }
                else
                {
                    StartUpWindow.DeleteStartUp();
                }
                SaveObject.Save_data(path + @"\Configure.ini", configure);
                configure = null;

                MessageBox.Show("Save configure Sucessful ", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Save configure fail: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            SettingClass = new Model.SettingClass();
            SettingClass.OfflineServer       = txt_serverOffline.Text.Trim();
            SettingClass.userOffline         = txt_userOffline.Text.Trim();
            SettingClass.password            = passwordBox.Password;
            SettingClass.usingOfftlineServer = (bool)cb_serveroffline.IsChecked;
            SettingClass.IsStartupWindow     = (bool)cb_StartupWindow.IsChecked;
            SettingClass.PathListProduct     = txt_listproductPath.Text.Trim();

            try
            {
                SettingClass.timmer = int.Parse(txt_timer.Text.Trim());
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "convert str to int fail", ex.Message);
                SettingClass.timmer = 30000;
            }
            try
            {
                SettingClass.PLCTimeOut = int.Parse(txt_PLCTimeOut.Text.Trim());
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "convert timeout to int fail", ex.Message);
                SettingClass.timmer = 3000;
            }
            if ((bool)cb_StartupWindow.IsChecked)
            {
                StartUpWindow.RegistrationStartUp();
            }
            else
            {
                StartUpWindow.DeleteStartUp();
            }

            Algorithm.SaveObject.Save_data(Algorithm.SaveObject.Pathsave, SettingClass);
        }