本文整理汇总了C#中Configuration.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.Initialize方法的具体用法?C# Configuration.Initialize怎么用?C# Configuration.Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureNHibernateValidator
private static void ConfigureNHibernateValidator(Configuration configuration)
{
INHVConfiguration nhvc = (INHVConfiguration)new NHibernate.Validator.Cfg.Loquacious.FluentConfiguration()
.SetDefaultValidatorMode(ValidatorMode.UseAttribute);
var validator = new ValidatorEngine();
validator.Configure(nhvc);
configuration.Initialize(validator);
}
示例2: MainWindow
public MainWindow()
{
bool initializeWithDefaults = false;
bool loadConfigurationFile = true;
m_Configuration = new Configuration();
if (!m_Configuration.ConfigFileExists())
{
MessageBoxResult mbr = MessageBox.Show(
Strings.MessageConfigNotFound,
App.GetName(),
MessageBoxButton.YesNo,
MessageBoxImage.Question
);
if (mbr == MessageBoxResult.Yes)
initializeWithDefaults = true;
else
loadConfigurationFile = false;
}
try
{
m_Configuration.Initialize(initializeWithDefaults, loadConfigurationFile);
}
catch (InvalidOperationException)
{
MessageBox.Show(
String.Format(Strings.MessageConfigCorrupt, m_Configuration.GetConfigFile()),
App.GetName(),
MessageBoxButton.OK,
MessageBoxImage.Error
);
m_Configuration.Initialize(initializeWithDefaults, false);
}
DataContext = m_Configuration;
if (App.GetArgs().Length == 0)
{
InitializeComponent();
new UpdateChecker(this).RunWorkerAsync();
}
else
{
try
{
new UriHandler(m_Configuration, App.GetArgs()[0]).Handle();
}
catch (InvalidUriException)
{
MessageBox.Show(
Strings.MessageIncorrectURIFormat,
App.GetName(),
MessageBoxButton.OK,
MessageBoxImage.Error
);
}
catch (ProtocolNotSupportedException exc)
{
MessageBox.Show(
String.Format(Strings.MessageProtocolNotSupported, exc.m_Protocol),
App.GetName(),
MessageBoxButton.OK,
MessageBoxImage.Error
);
}
catch (ProgramStartFailedException exc)
{
MessageBox.Show(
String.Format(Strings.MessageFailedToStartProgram, exc.m_Program),
App.GetName(),
MessageBoxButton.OK,
MessageBoxImage.Error
);
}
this.Close();
}
}
示例3: ConfigureNHibernateValidator
private static void ConfigureNHibernateValidator(Configuration cfg, string validatorCfgFile)
{
var engine = new ValidatorEngine();
if (string.IsNullOrEmpty(validatorCfgFile))
{
engine.Configure();
}
else
{
engine.Configure(validatorCfgFile);
}
// Register validation listeners with the current NHib configuration
cfg.Initialize(engine);
ValidatorEngine = engine;
}