本文整理汇总了C#中White.Core.UIItems.WindowItems.Window.ReInitialize方法的典型用法代码示例。如果您正苦于以下问题:C# Window.ReInitialize方法的具体用法?C# Window.ReInitialize怎么用?C# Window.ReInitialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类White.Core.UIItems.WindowItems.Window
的用法示例。
在下文中一共展示了Window.ReInitialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public virtual string Generate(Window window)
{
window.ReInitialize(InitializeOption.WithCache);
var stringBuilder = new StringBuilder();
var stringWriter = new StringWriter(stringBuilder);
var cscProvider = new CSharpCodeProvider();
ICodeGenerator codeGenerator = cscProvider.CreateGenerator(stringWriter);
var codeGeneratorOptions = new CodeGeneratorOptions {BlankLinesBetweenMembers = false, VerbatimOrder = false};
codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(UIItem).Namespace)), stringWriter, codeGeneratorOptions);
codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(Window).Namespace)), stringWriter, codeGeneratorOptions);
codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(AppScreen).Namespace)), stringWriter, codeGeneratorOptions);
CodeNamespace codeNamespace = null;
if (S.IsNotEmpty(options.Namespace))
{
codeNamespace = new CodeNamespace(options.Namespace);
}
var classDefinition = new CodeTypeDeclaration
{
IsClass = true,
IsPartial = true,
Name = window.Title.Trim().Replace(" ", string.Empty),
TypeAttributes = TypeAttributes.Public
};
classDefinition.BaseTypes.Add(typeof (AppScreen));
var constructor = new CodeConstructor {Attributes = MemberAttributes.Family};
classDefinition.Members.Add(constructor);
constructor = new CodeConstructor {Attributes = MemberAttributes.Public};
constructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Window), "window"));
constructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof (ScreenRepository), "screenRepository"));
constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("window"));
constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("screenRepository"));
classDefinition.Members.Add(constructor);
var visitor = new CodeGenerationVisitor(new WindowCodeGenerationStrategy(options));
window.Visit(visitor);
visitor.Generate(classDefinition);
if (codeNamespace != null)
{
codeNamespace.Types.Add(classDefinition);
codeGenerator.GenerateCodeFromNamespace(codeNamespace, stringWriter, codeGeneratorOptions);
}
else
{
codeGenerator.GenerateCodeFromType(classDefinition, stringWriter, codeGeneratorOptions);
}
stringWriter.Close();
return stringBuilder.ToString();
}
示例2: StartRecording
public virtual void StartRecording(Window window, UserEventListener eventListener)
{
windowsUnderRecording.Add(window);
window.ReInitialize(InitializeOption.WithCache);
window.Visit(new RecorderVisitor(eventListener, recordingOptions));
}