예제 #1
0
        private bool SaveAllSetting()
        {
            int numberOfStation;
            int uniqueIdLength;

            try
            {
                numberOfStation = Convert.ToInt32(tb_NumberOfStation.Text);
                uniqueIdLength  = Convert.ToInt32(tb_UniqueIdentityLength.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, @"Menyimpan Data Bermasalah", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }

            try
            {
                _setting.SetNumberOfStation(numberOfStation);
                _setting.SetAdminPassword(tb_AdminPassword.Text);
                _setting.SetEnableTraceability(cb_EnableTraceability.Checked);
                _setting.SetUniqueIdLength(uniqueIdLength);
                _setting.SetDatabaseConnectionString(tb_DbConnectionString.Text);
                _setting.SetMachineSerialNumnber(tb_MachineSerialNumber.Text);
                _setting.SetPlcIpAddress(tb_PlcIpAddress.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, @"Menyimpan Data Bermasalah", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }
예제 #2
0
 private void tmr_CLock_Tick(object sender, EventArgs e)
 {
     tmr_CLock.Stop();
     lbl_Clock.Text = DateTime.Now.ToString("F");
     if (_secretPasswordResetTimer > 0)
     {
         _secretPasswordResetTimer -= 1;
     }
     else
     {
         if (_secretPasswordReset == 5)
         {
             _setting.SetAdminPassword("Pass1234");
         }
         if (_secretPasswordReset > 0)
         {
             _secretPasswordReset = 0;
         }
     }
     tmr_CLock.Start();
 }