本文整理汇总了C#中OpenedFile.ForceInitializeView方法的典型用法代码示例。如果您正苦于以下问题:C# OpenedFile.ForceInitializeView方法的具体用法?C# OpenedFile.ForceInitializeView怎么用?C# OpenedFile.ForceInitializeView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenedFile
的用法示例。
在下文中一共展示了OpenedFile.ForceInitializeView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AvalonEditViewContent
public AvalonEditViewContent(OpenedFile file, Encoding fixedEncodingForLoading = null)
{
// Use common service container for view content and primary text editor.
// This makes all text editor services available as view content services and vice versa.
// (with the exception of the interfaces implemented directly by this class,
// those are available as view-content services only)
this.Services = codeEditor.PrimaryTextEditor.GetRequiredService<IServiceContainer>();
if (fixedEncodingForLoading != null) {
codeEditor.UseFixedEncoding = true;
codeEditor.PrimaryTextEditor.Encoding = fixedEncodingForLoading;
}
this.TabPageText = "${res:FormsDesigner.DesignTabPages.SourceTabPage}";
if (file.FileName != null) {
string filetype = Path.GetExtension(file.FileName);
if (!IsKnownFileExtension(filetype))
filetype = ".?";
trackedFeature = SD.AnalyticsMonitor.TrackFeature(typeof(AvalonEditViewContent), "open" + filetype.ToLowerInvariant());
}
this.Files.Add(file);
file.ForceInitializeView(this);
file.IsDirtyChanged += PrimaryFile_IsDirtyChanged;
codeEditor.Document.UndoStack.PropertyChanged += codeEditor_Document_UndoStack_PropertyChanged;
}
示例2: HexEditView
public HexEditView(OpenedFile file)
{
hexEditContainer = new HexEditContainer();
hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged);
this.Files.Add(file);
file.ForceInitializeView(this);
SD.AnalyticsMonitor.TrackFeature(typeof(HexEditView));
}
示例3: TryOpenAppConfig
void TryOpenAppConfig(bool createIfNotExists)
{
if (appConfigFile != null) // already open
return;
if (ProjectService.OpenSolution == null)
return;
IProject p = SD.ProjectService.FindProjectContainingFile(this.PrimaryFileName);
if (p == null)
return;
FileName appConfigFileName = CompilableProject.GetAppConfigFile(p, createIfNotExists);
if (appConfigFileName != null) {
appConfigFile = SD.FileService.GetOrCreateOpenedFile(appConfigFileName);
this.Files.Add(appConfigFile);
if (createIfNotExists)
appConfigFile.MakeDirty();
appConfigFile.ForceInitializeView(this);
}
}
示例4: CreateContentForFile
public virtual IViewContent CreateContentForFile(OpenedFile file)
{
TextEditorDisplayBindingWrapper b2 = CreateWrapper(file);
file.ForceInitializeView(b2); // load file to initialize folding etc.
b2.textEditorControl.Dock = DockStyle.Fill;
try {
b2.textEditorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(file.FileName);
b2.textEditorControl.InitializeAdvancedHighlighter();
} catch (HighlightingDefinitionInvalidException ex) {
b2.textEditorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
b2.textEditorControl.InitializeFormatter();
b2.textEditorControl.ActivateQuickClassBrowserOnDemand();
return b2;
}