コード例 #1
0
		private void SetCredentials(ServerCredentials credentials = null)
		{
			var serverCredentials = credentials ?? new ServerCredentials();

			SettingsPanel.Login = serverCredentials.Login;
			SettingsPanel.Password = serverCredentials.Password;
		}
コード例 #2
0
        /// <summary>
        /// Save the credentials to <see cref="StockSharpFolder"/>.
        /// </summary>
        /// <param name="credentials">The class that contains a login and password to access the services http://stocksharp.com .</param>
        public static void SaveCredentials(this ServerCredentials credentials)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException(nameof(credentials));
            }

            credentials.SaveCredentials(credentials.AutoLogon);
        }
コード例 #3
0
		public static void SetCredentials(this IPersistableService service, ServerCredentials credentials)
		{
			if (service == null)
				throw new ArgumentNullException("service");

			if (credentials == null)
				throw new ArgumentNullException("credentials");

			service.SetValue("StockSharpCredentials", credentials);
		}
コード例 #4
0
        /// <summary>
        /// Save the credentials to <see cref="StockSharpFolder"/>.
        /// </summary>
        /// <param name="credentials">The class that contains a login and password to access the services http://stocksharp.com .</param>
        public static void SaveCredentials(this ServerCredentials credentials)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException(nameof(credentials));
            }

            var file = Path.Combine(StockSharpFolder, _credentialsFile);

            new XmlSerializer <SettingsStorage>().Serialize(credentials.Save(), file);
        }
コード例 #5
0
        /// <summary>
        /// Try load credentials from <see cref="StockSharpFolder"/>.
        /// </summary>
        /// <param name="credentials">The class that contains a login and password to access the services http://stocksharp.com .</param>
        /// <returns><see langword="true"/> if the specified credentials was loaded successfully, otherwise, <see langword="false"/>.</returns>
        public static bool TryLoadCredentials(this ServerCredentials credentials)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException(nameof(credentials));
            }

            var file = Path.Combine(StockSharpFolder, _credentialsFile);

            if (!File.Exists(file))
            {
                return(false);
            }

            credentials.Load(new XmlSerializer <SettingsStorage>().Deserialize(file));
            return(true);
        }
コード例 #6
0
		private void SetCredentials(bool isStockSharpStorage, ServerCredentials credentials = null)
		{
			//SettingsPanel.IsCredentialsEnabled = !isStockSharpStorage;

			//var serverCredentials = !isStockSharpStorage
			//	? (credentials ?? new ServerCredentials())
			//	: ConfigManager
			//		.GetService<IPersistableService>()
			//		.GetCredentials();

			var serverCredentials = credentials ?? new ServerCredentials();

			SettingsPanel.Login = serverCredentials.Login;
			SettingsPanel.Password = serverCredentials.Password;
		}
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthenticationClient"/>.
 /// </summary>
 /// <param name="address">Service address.</param>
 public AuthenticationClient(Uri address)
     : base(address, "authentication")
 {
     Credentials = new ServerCredentials();
 }