protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Shared.MainActivity = this; #region Components Define BtnClear = FindViewById <Button>(Resource.Id.BtnClean); BtnGenerate = FindViewById <Button>(Resource.Id.BtnGenerate); BtnRandom = FindViewById <Button>(Resource.Id.BtnRandom); BtnSave = FindViewById <Button>(Resource.Id.BtnSave); BtnSettings = FindViewById <Button>(Resource.Id.BtnSettings); EdtMasterKey = FindViewById <EditText>(Resource.Id.EdtMasterKey); EdtPassword = FindViewById <EditText>(Resource.Id.EdtPassword); EdtEnhanceField = FindViewById <EditText>(Resource.Id.EdtEnhanceField); SkbLength = FindViewById <SeekBar>(Resource.Id.SeekBar); TxvPasswdLength = FindViewById <TextView>(Resource.Id.TxvPasswdLength); CkbIsCharRequired = FindViewById <CheckBox>(Resource.Id.CkbIsCharRequired); ChkIsWeakPasswd = FindViewById <CheckBox>(Resource.Id.ChkIsWeakPasswd); TxvVersion = FindViewById <TextView>(Resource.Id.TxvVersion); #endregion #region initialise UI value TxvVersion.Text = $"{ProjectInfo.AppName}({ProjectInfo.AppVersion})\n" + $"{Copyright}"; ConfigHelper.ParseConfigString(ConfigHelper.GetConfigString()); EdtMasterKey.Text = Shared.Config.MasterKey; EdtPassword.Text = Shared.Config.Password; EdtEnhanceField.Text = Shared.Config.Enhance; ChkIsWeakPasswd.Checked = Shared.Config.IsWeakPasswd; CkbIsCharRequired.Checked = Shared.Config.IsCharRequired; SkbLength.Max = PasswordLengthHelper.GetMax(Shared.Config.IsWeakPasswd); SkbLength.Progress = Shared.Config.PasswordLengthIndex; #endregion FlashTxvPasswdLength(); #region Evt SkbLength.ProgressChanged += SkbLength_ProgressChanged; ChkIsWeakPasswd.CheckedChange += ChkIsWeakPasswd_CheckedChange; CkbIsCharRequired.CheckedChange += CkbIsCharRequired_CheckedChange; BtnClear.Click += BtnClear_Click; BtnGenerate.Click += BtnGenerate_Click; BtnRandom.Click += BtnRandom_Click; BtnSave.Click += BtnSave_Click; BtnSettings.Click += BtnSettings_Click; EdtEnhanceField.AfterTextChanged += EdtEnhanceField_AfterTextChanged; EdtMasterKey.AfterTextChanged += EdtMasterKey_AfterTextChanged; EdtPassword.AfterTextChanged += EdtPassword_AfterTextChanged; #endregion }
private void SetSeekBar() { SkbLength.Max = PasswordLengthHelper.GetMax(ChkIsWeakPasswd.Checked); Shared.Config.PasswordLengthIndex = SkbLength.Progress; // FIXME: Is necessary? }