コード例 #1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Mandant m = (Mandant)comboBox1.SelectedItem;

            if (m == null)
            {
                return;
            }
            log.Debug($"Selected mandant changed to: " + JsonConvert.SerializeObject(m));
            this.settingsForm.saveLastMandantIndex(comboBox1.SelectedIndex);
            log.Debug($"Mandant latest_password_created: [{m.latest_password_created}], now is [{DateTime.Now}]");
            int    passwordAge = (DateTime.Now - m.latest_password_created).Days;
            string ptext       = String.Format(rm.GetString("Password_Age"), passwordAge);

            label2.Text = ptext;
            log.Debug($"Updated password age field with {passwordAge} days");
            this.comboBox2.SelectedItem = Settings.loadDefaultPackageMode();
            if (!String.IsNullOrEmpty(m.preferred_package_type))
            {
                Packer.PackerType mType = (Packer.PackerType)Enum.Parse(typeof(Packer.PackerType), m.preferred_package_type);
                if (Settings.isAllowedType(mType))
                {
                    this.comboBox2.SelectedItem = mType;
                    log.Debug($"Selected package mode [{mType}] as specified by mandat record in server");
                }
                else
                {
                    log.Warn($"Using default package mode, as the preferred package mode [{mType}] " +
                             $"of this mandant is not allowed on this client");
                }
            }
            this.comboBox2.Enabled = true;
        }
コード例 #2
0
 public static bool isAllowedType(Packer.PackerType type)
 {
     foreach (Packer.PackerType t in ALLOWED_TYPES)
     {
         if (type == t)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
 private static void saveDefaultPackageMode(Packer.PackerType type)
 {
     Registry.SetValue(keyName, DEFAULT_PACKAGE_MODE, type, RegistryValueKind.DWord);
 }