本文整理汇总了C#中ClientConfiguration.Save方法的典型用法代码示例。如果您正苦于以下问题:C# ClientConfiguration.Save方法的具体用法?C# ClientConfiguration.Save怎么用?C# ClientConfiguration.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientConfiguration
的用法示例。
在下文中一共展示了ClientConfiguration.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldBeAbleToSaveTheConfigurationToFile
public void ShouldBeAbleToSaveTheConfigurationToFile()
{
ClientConfiguration configuration = new ClientConfiguration();
configuration.Save(configurationFileName);
Assert.IsTrue(File.Exists(configurationFileName));
File.Delete(configurationFileName);
}
示例2: ShouldBeAbleToLoadThePropertiesBackFromXml
public void ShouldBeAbleToLoadThePropertiesBackFromXml()
{
ClientConfiguration expected_configuration = new ClientConfiguration() { UserName = "user", Password = "password", Host = "smtp.google.com", Port = 445, Ssl = true };
expected_configuration.Save(configurationFileName);
ClientConfiguration configuration = ClientConfiguration.Create(configurationFileName);
Assert.AreEqual(expected_configuration.UserName, configuration.UserName);
Assert.AreEqual(expected_configuration.Password, configuration.Password);
Assert.AreEqual(expected_configuration.Host, configuration.Host);
Assert.AreEqual(expected_configuration.Port, configuration.Port);
Assert.AreEqual(expected_configuration.Ssl, configuration.Ssl);
File.Delete(configurationFileName);
}
示例3: Init
public static M3ClientInitializationStatus Init()
{
//Берём из реестра данные о соединении и сборке
configuration = new ClientConfiguration();
//Сохраняем в реестре новую версию сборки
configuration.Build = ClientConfiguration.DefaultBuild;
configuration.Save();
//Интернационализация
i8n.Init();
i8n.strings.SetLanguage(configuration.Language);
web = new RfidWebClient(configuration);
try
{
reader = new CAENRFIDReader();
reader.Connect(CAENRFIDPort.CAENRFID_RS232, "MOC1");
System.Threading.Thread.Sleep(500);
M3Client.source = M3Client.reader.GetSources()[0];
}
catch (CAENRFIDException e)
{
return M3ClientInitializationStatus.ReaderNotReady;
}
if (configuration.Server == String.Empty || configuration.DeviceKey == String.Empty)
{
return M3ClientInitializationStatus.ClientConfigurationMissing;
}
return M3ClientInitializationStatus.Ok;
}