本文整理汇总了C#中OpenedFile类的典型用法代码示例。如果您正苦于以下问题:C# OpenedFile类的具体用法?C# OpenedFile怎么用?C# OpenedFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpenedFile类属于命名空间,在下文中一共展示了OpenedFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: if
void IViewContent.Save(OpenedFile file, Stream stream)
{
if (document != null)
document.Save(stream, SaveOptions.DisableFormatting);
else if (fileData != null)
stream.Write(fileData, 0, fileData.Length);
}
示例2: AddProjectDlls
public void AddProjectDlls(OpenedFile file)
{
var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
foreach (var reference in compilation.ReferencedAssemblies) {
string f = reference.GetReferenceAssemblyLocation();
if (f != null && !addedAssemblys.Contains(f)) {
try {
var assembly = Assembly.LoadFrom(f);
SideTab sideTab = new SideTab(sideBar, assembly.FullName.Split(new[] {','})[0]);
sideTab.DisplayName = StringParser.Parse(sideTab.Name);
sideTab.CanBeDeleted = false;
sideTab.ChoosedItemChanged += OnChoosedItemChanged;
sideTab.Items.Add(new WpfSideTabItem());
foreach (var t in assembly.GetExportedTypes())
{
if (IsControl(t))
{
sideTab.Items.Add(new WpfSideTabItem(t));
}
}
if (sideTab.Items.Count > 1)
sideBar.Tabs.Add(sideTab);
addedAssemblys.Add(f);
} catch (Exception ex) {
WpfViewContent.DllLoadErrors.Add(new SDTask(new BuildError(f, ex.Message)));
}
}
}
}
示例3: LoadInternal
protected override void LoadInternal(OpenedFile file, Stream stream)
{
if (file == this.PrimaryFile) {
// The FormsDesignerViewContent normally operates independently of any
// text editor. The following statements connect the forms designer
// directly to the underlying XML text editor so that the caret positioning
// and text selection operations done by the WiX designer actually
// become visible in the text editor.
if (!this.SourceCodeStorage.ContainsFile(file)) {
ITextEditor editor = this.PrimaryViewContent.GetService<ITextEditor>();
this.SourceCodeStorage.AddFile(file, editor.Document, SD.FileService.DefaultFileEncoding, true);
}
try {
if (!ignoreDialogIdSelectedInTextEditor) {
string dialogId = GetDialogIdSelectedInTextEditor();
if (dialogId == null) {
dialogId = GetFirstDialogIdInTextEditor();
JumpToDialogElement(dialogId);
}
DialogId = dialogId;
}
wixProject = GetProject();
} catch (XmlException ex) {
// Let the Wix designer loader try to load the XML and generate
// an error message.
DialogId = "InvalidXML";
AddToErrorList(ex);
}
}
base.LoadInternal(file, stream);
}
示例4: 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;
}
示例5: SupportsSwitchToThisWithoutSaveLoad
public override bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
{
if (file == this.PrimaryFile)
return oldView.SupportsSwitchToThisWithoutSaveLoad(file, primaryViewContent);
else
return base.SupportsSwitchFromThisWithoutSaveLoad(file, oldView);
}
示例6: SwitchFromThisWithoutSaveLoad
public override void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
{
if (file == this.PrimaryFile && this != newView) {
SaveToPrimary();
primaryViewContent.SwitchFromThisWithoutSaveLoad(file, newView);
}
}
示例7: Save
public override void Save(OpenedFile file, Stream stream)
{
if (file != this.PrimaryFile)
throw new ArgumentException("file must be the primary file of the primary view content, override Save() to handle other files");
SaveToPrimary();
primaryViewContent.Save(file, stream);
}
示例8: SwitchToThisWithoutSaveLoad
public override void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
{
if (file == this.PrimaryFile && oldView != this) {
primaryViewContent.SwitchToThisWithoutSaveLoad(file, oldView);
LoadFromPrimary();
}
}
示例9: Save
public override void Save(OpenedFile file, Stream stream)
{
SD.AnalyticsMonitor.TrackFeature(typeof(HexEditView), "Save");
this.hexEditContainer.SaveFile(file, stream);
this.TitleName = Path.GetFileName(file.FileName);
this.TabPageText = this.TitleName;
}
示例10: ResourceEditWrapper
public ResourceEditWrapper(OpenedFile file)
{
this.TabPageText = "Resource editor";
base.UserContent = resourceEditor;
resourceEditor.ResourceList.Changed += new EventHandler(SetDirty);
this.Files.Add(file);
}
示例11: SetupDesigner
/*
public static ReportDesignerView SetupDesigner ()
{
throw new NotImplementedException("SetupDesigner");
ReportModel model = ReportModel.Create();
var reportStructure = new ReportStructure()
{
ReportLayout = GlobalEnums.ReportLayout.ListLayout;
}
IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
generator.GenerateReport();
// OpenedFile file = FileService.CreateUntitledOpenedFile(GlobalValues.PlainFileName,new byte[0]);
// file.SetData(generator.Generated.ToArray());
// return SetupDesigner(file);
return SetupDesigner(null);
}
*/
public static ReportDesignerView SetupDesigner (OpenedFile file)
{
if (file == null) {
throw new ArgumentNullException("file");
}
IDesignerGenerator generator = new ReportDesignerGenerator();
return new ReportDesignerView(file, generator);
}
示例12: CreateContentForFile
public IViewContent CreateContentForFile(OpenedFile file)
{
try {
return new EDMDesignerViewContent(file);
} catch (WizardCancelledException) {
return null;
}
}
示例13: ResourceEditWrapper
public ResourceEditWrapper(OpenedFile file)
{
this.TabPageText = "Resource editor";
UserContent = resourceEditor;
resourceEditor.ResourceList.Changed += SetDirty;
resourceEditor.ResourceList.ItemSelectionChanged += (sender, e) => SD.WinForms.InvalidateCommands();
this.Files.Add(file);
}
示例14: WpfViewContent
public WpfViewContent(OpenedFile file) : base(file)
{
SharpDevelopTranslations.Init();
BasicMetadata.Register();
this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}";
this.IsActiveViewContentChanged += OnIsActiveViewContentChanged;
}
示例15: 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));
}