예제 #1
0
 private void LoadSettings()
 {
     if (_loginOptions == null)
     {
         if (File.Exists("LogInOptions.xml"))
         {
             using (var stream = File.OpenRead("LogInOptions.xml"))
             {
                 var serializer = new XmlSerializer(typeof(SavedLogInOptions));
                 _loginOptions = serializer.Deserialize(stream) as SavedLogInOptions;
             }
             UserName         = _loginOptions.UserName;
             Password         = _loginOptions.Password;
             RememberPassword = _loginOptions.RememberPassword;
             IpAddress        = _loginOptions.IpAddress;
             PortNumber       = _loginOptions.PortNumber;
             if (!RememberPassword)
             {
                 Password = null;
             }
         }
         else
         {
             UserName         = null;
             Password         = null;
             RememberPassword = false;
             IpAddress        = "127.0.0.1";
             PortNumber       = 8500;
         }
     }
 }
예제 #2
0
        private void SaveSettings()
        {
            SavedLogInOptions loginOptions = new SavedLogInOptions()
            {
                UserName         = userName,
                Password         = password,
                RememberPassword = rememberPassword,
                IpAddress        = ipAddress,
                PortNumber       = portNumber
            };

            using (var stream = File.Open("LogInOptions.xml", FileMode.Create))
            {
                var serializer = new XmlSerializer(typeof(SavedLogInOptions));
                serializer.Serialize(stream, loginOptions);
            }
        }
예제 #3
0
 private void SaveSettings()
 {
     SavedLogInOptions loginOptions = new SavedLogInOptions()
     {
         UserName = userName,
         Password = password,
         RememberPassword = rememberPassword,
         IpAddress = ipAddress,
         PortNumber = portNumber
     };
     using (var stream = File.Open("LogInOptions.xml", FileMode.Create))
     {
         var serializer = new XmlSerializer(typeof(SavedLogInOptions));
         serializer.Serialize(stream, loginOptions);
     }
 }
예제 #4
0
 private void LoadSettings()
 {
     if (_loginOptions == null)
     {
         if (File.Exists("LogInOptions.xml"))
         {
             using (var stream = File.OpenRead("LogInOptions.xml"))
             {
                 var serializer = new XmlSerializer(typeof(SavedLogInOptions));
                 _loginOptions = serializer.Deserialize(stream) as SavedLogInOptions;
             }
             UserName = _loginOptions.UserName;
             Password = _loginOptions.Password;
             RememberPassword = _loginOptions.RememberPassword;
             IpAddress = _loginOptions.IpAddress;
             PortNumber = _loginOptions.PortNumber;
             if (!RememberPassword)
             {
                 Password = null;
             }
         }
         else
         {
             UserName = null;
             Password = null;
             RememberPassword = false;
             IpAddress = "127.0.0.1";
             PortNumber = 8500;
         }
     }
 }