// HELP: This method has some setup code that may interest you. #region reconfigure_Click private void reconfigure_Click(object sender, RoutedEventArgs e) { Uri defaultProxyServer = null; if (!String.IsNullOrWhiteSpace(defaultProxyServerUri.Text)) { defaultProxyServer = new Uri(defaultProxyServerUri.Text); } // HELP: This is for demo purposes only. We are clearing all known data in the authentication managers by doing this. winFormsAuthMgr = new RestApiAuthMgrWinforms(applicationToken, encryptionKey, encryptionUtilities); wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities); UpdateAuthenticationResults(RallyRestApi.AuthenticationResult.NotAuthorized, null); // HELP: Configure labels for UI. These are global and used by both authentication managers to build their UI. // If this is not called, the default labels will be used. ApiAuthManager.Configure(loginWindowServerLabelText: "My Updated Server Label", loginWindowDefaultServer: new Uri("http://onprem.rally.url")); Uri defaultServer = null; if (!String.IsNullOrWhiteSpace(defaultServerUri.Text)) { defaultServer = new Uri(defaultServerUri.Text); } ApiAuthManager.Configure(windowTitleLabel.Text, headerLabel.Text, credentialsTabLabel.Text, usernameLabel.Text, passwordLabel.Text, serverTabLabel.Text, String.Empty, serverLabel.Text, String.Empty, defaultServer, proxyTabLabel.Text, proxyServerLabel.Text, proxyUsernameLabel.Text, proxyPasswordLabel.Text, defaultProxyServer, loginWindowSsoInProgressLabel.Text, loginButtonLabel.Text, logoutButtonLabel.Text, cancelButtonLabel.Text); // HELP: If you need to use custom controls (Ex: from a third party vendor), you can set them using this code snippet. // This triggers a global change for the next time a window is created. if ((useCustomControls.IsChecked.HasValue) && (useCustomControls.IsChecked.Value)) { RestApiAuthMgrWpf.SetCustomControlType(CustomWpfControlType.Buttons, typeof(CustomButton)); RestApiAuthMgrWpf.SetCustomControlType(CustomWpfControlType.TabControl, typeof(CustomTabControl)); RestApiAuthMgrWpf.SetCustomControlType(CustomWpfControlType.TabItem, typeof(CustomTabItem)); } }
public MainWindow() { InitializeComponent(); headerLabel.Text = "Login Window Example"; // HELP: Instantiate authorization managers winFormsAuthMgr = new RestApiAuthMgrWinforms(applicationToken, encryptionKey, encryptionUtilities); wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities); // Help: Set logos. Any use of Rally's Logo is governed by your agreements with Rally. RestApiAuthMgrWinforms.SetLogo(ImageResources.RallyLogo40x40); RestApiAuthMgrWpf.SetLogo(GetImageSource(ImageResources.RallyLogo40x40), GetImageSource(ImageResources.RallyLogo40x40)); // Help: You can auto-authenticate if you want. We do not have it enabled for this application. // wpfAuthMgr.AutoAuthenticate(true); UpdateAuthenticationResults(RallyRestApi.AuthenticationResult.NotAuthorized, null); }