Beispiel #1
0
 public SettingsView()
 {
     InitializeComponent();
     this.Loaded += (s, ea) =>
         {
             if (LoadingDefaultSettings != null)
             {
                 var potentialOverride = new LoadingDefaultSettingsEventArgs();
                 LoadingDefaultSettings(this, potentialOverride);
                 this.Username = potentialOverride.Username;
                 this.Password = potentialOverride.Password;
                 this.Hostname = potentialOverride.Hostname;
                 this.Port = potentialOverride.Port;
             }
         };
 }
        private void OnLoadingDefaultSettings(LoadingDefaultSettingsEventArgs overridableSettings)
        {
            if (credentials["Username"] != null)
            {
                overridableSettings.Username = (string)credentials["Username"];
            }

            if (credentials["Password"] != null)
            {
                overridableSettings.Password = (string)credentials["Password"];
            }

            if (credentials["Hostname"] != null)
            {
                overridableSettings.Hostname = (string)credentials["Hostname"];
            }

            if (credentials["Port"] != null)
            {
                overridableSettings.Port = (string)credentials["Port"];
            }
        }