public ConnectionSettingsEditor(
     ConnectionSettingsBase settings,
     Action <ConnectionSettingsBase> saveSettings,
     ConnectionSettingsEditor parent)
 {
     this.settings     = settings;
     this.saveSettings = saveSettings;
     this.parent       = parent;
 }
 public void SaveConnectionSettings(ConnectionSettingsBase settings)
 {
     if (settings is ProjectConnectionSettings projectSettings)
     {
         this.repository.SetProjectSettings(projectSettings);
     }
     else if (settings is ZoneConnectionSettings zoneSettings)
     {
         this.repository.SetZoneSettings(zoneSettings);
     }
     else if (settings is VmInstanceConnectionSettings instanceSettings)
     {
         this.repository.SetVmInstanceSettings(instanceSettings);
     }
     else
     {
         throw new ArgumentException("Unsupported settings type: " + settings.GetType().Name);
     }
 }
示例#3
0
        protected static void ApplyOverlay <T>(
            T prototype,
            ConnectionSettingsBase baseSettings,
            ConnectionSettingsBase overlaySettings)
            where T : ConnectionSettingsBase
        {
            prototype.Username = (RegistryStringSetting)
                                 baseSettings.Username.OverlayBy(overlaySettings.Username);
            prototype.Password = (RegistrySecureStringSetting)
                                 baseSettings.Password.OverlayBy(overlaySettings.Password);
            prototype.Domain = (RegistryStringSetting)
                               baseSettings.Domain.OverlayBy(overlaySettings.Domain);
            prototype.ConnectionBar = (RegistryEnumSetting <RdpConnectionBarState>)
                                      baseSettings.ConnectionBar.OverlayBy(overlaySettings.ConnectionBar);
            prototype.DesktopSize = (RegistryEnumSetting <RdpDesktopSize>)
                                    baseSettings.DesktopSize.OverlayBy(overlaySettings.DesktopSize);
            prototype.AuthenticationLevel = (RegistryEnumSetting <RdpAuthenticationLevel>)
                                            baseSettings.AuthenticationLevel.OverlayBy(overlaySettings.AuthenticationLevel);
            prototype.ColorDepth = (RegistryEnumSetting <RdpColorDepth>)
                                   baseSettings.ColorDepth.OverlayBy(overlaySettings.ColorDepth);
            prototype.AudioMode = (RegistryEnumSetting <RdpAudioMode>)
                                  baseSettings.AudioMode.OverlayBy(overlaySettings.AudioMode);
            prototype.RedirectClipboard = (RegistryEnumSetting <RdpRedirectClipboard>)
                                          baseSettings.RedirectClipboard.OverlayBy(overlaySettings.RedirectClipboard);
            prototype.UserAuthenticationBehavior = (RegistryEnumSetting <RdpUserAuthenticationBehavior>)
                                                   baseSettings.UserAuthenticationBehavior.OverlayBy(overlaySettings.UserAuthenticationBehavior);
            prototype.BitmapPersistence = (RegistryEnumSetting <RdpBitmapPersistence>)
                                          baseSettings.BitmapPersistence.OverlayBy(overlaySettings.BitmapPersistence);
            prototype.ConnectionTimeout = (RegistryDwordSetting)
                                          baseSettings.ConnectionTimeout.OverlayBy(overlaySettings.ConnectionTimeout);
            prototype.CredentialGenerationBehavior = (RegistryEnumSetting <RdpCredentialGenerationBehavior>)
                                                     baseSettings.CredentialGenerationBehavior.OverlayBy(overlaySettings.CredentialGenerationBehavior);
            prototype.RdpPort = (RegistryDwordSetting)
                                baseSettings.RdpPort.OverlayBy(overlaySettings.RdpPort);

            Debug.Assert(baseSettings.Settings.All(s => s != null));
        }