• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OpenedFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中OpenedFile的典型用法代码示例。如果您正苦于以下问题:C# OpenedFile类的具体用法?C# OpenedFile怎么用?C# OpenedFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpenedFile类属于命名空间,在下文中一共展示了OpenedFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:7,代码来源:FakeXmlViewContent.cs


示例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)));
					}
				}
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:35,代码来源:WpfToolbox.cs


示例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);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:32,代码来源:WixDialogDesigner.cs


示例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;
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:26,代码来源:AvalonEditViewContent.cs


示例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);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:AbstractSecondaryViewContent.cs


示例6: SwitchFromThisWithoutSaveLoad

		public override void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
		{
			if (file == this.PrimaryFile && this != newView) {
				SaveToPrimary();
				primaryViewContent.SwitchFromThisWithoutSaveLoad(file, newView);
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:AbstractSecondaryViewContent.cs


示例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);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:AbstractSecondaryViewContent.cs


示例8: SwitchToThisWithoutSaveLoad

		public override void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
		{
			if (file == this.PrimaryFile && oldView != this) {
				primaryViewContent.SwitchToThisWithoutSaveLoad(file, oldView);
				LoadFromPrimary();
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:AbstractSecondaryViewContent.cs


示例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;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:7,代码来源:HexEditView.cs


示例10: ResourceEditWrapper

		public ResourceEditWrapper(OpenedFile file)
		{
			this.TabPageText = "Resource editor";
			base.UserContent = resourceEditor;
			resourceEditor.ResourceList.Changed += new EventHandler(SetDirty);
			this.Files.Add(file);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:DisplayDefinition.cs


示例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);
		}
开发者ID:asiazhang,项目名称:SharpDevelop,代码行数:28,代码来源:ViewCommands.cs


示例12: CreateContentForFile

		public IViewContent CreateContentForFile(OpenedFile file)
		{
			try {
				return new EDMDesignerViewContent(file);
			} catch (WizardCancelledException) {
				return null;
			}
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:8,代码来源:EDMDesignerDisplayBinding.cs


示例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);
		}
开发者ID:linquize,项目名称:SharpDevelop,代码行数:8,代码来源:ResourceEditorDisplayBinding.cs


示例14: WpfViewContent

		public WpfViewContent(OpenedFile file) : base(file)
		{
			SharpDevelopTranslations.Init();
			
			BasicMetadata.Register();
			
			this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}";
			this.IsActiveViewContentChanged += OnIsActiveViewContentChanged;
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:9,代码来源:WpfViewContent.cs


示例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));
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:11,代码来源:HexEditView.cs


示例16: CreateContentForFile

		public IViewContent CreateContentForFile(OpenedFile file)
		{
			string fileName = file.FileName;
			
			BrowserPane browserPane = new BrowserPane();
			if (fileName.StartsWith("browser://")) {
				browserPane.Navigate(fileName.Substring("browser://".Length));
			} else {
				browserPane.Navigate(fileName);
			}
			return browserPane;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:12,代码来源:BrowserDisplayBinding.cs


示例17: CreateContentForFile

		public IViewContent CreateContentForFile(OpenedFile file)
		{
			if (file.IsDirty) {
				ReportWizardCommand cmd = new ReportWizardCommand(file);
				cmd.Run();
				if (cmd.Canceled) {
					return null;
				}
				file.SetData(cmd.GeneratedReport.ToArray());
			}
			ReportDesignerView view = ICSharpCode.Reports.Addin.Commands.StartViewCommand.SetupDesigner(file);
			return view;
		}
开发者ID:RHE24,项目名称:SharpDevelop,代码行数:13,代码来源:ReportDesignerDisplayBinding.cs


示例18: WpfViewContent

		public WpfViewContent(OpenedFile file) : base(file)
		{
			SharpDevelopTranslations.Init();
			
			BasicMetadata.Register();
			
			this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}";
			this.IsActiveViewContentChanged += OnIsActiveViewContentChanged;
			
			var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
			_path = Path.GetDirectoryName(compilation.MainAssembly.UnresolvedAssembly.Location);
			AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
		}
开发者ID:Erguotou,项目名称:SharpDevelop,代码行数:13,代码来源:WpfViewContent.cs


示例19: WpfViewContent

		public WpfViewContent(OpenedFile file) : base(file)
		{
			SharpDevelopTranslations.Init();
			
			BasicMetadata.Register();
			
			WpfToolbox.Instance.AddProjectDlls(file);

			ProjectService.ProjectItemAdded += ProjectService_ProjectItemAdded;
			
			this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}";
			this.IsActiveViewContentChanged += OnIsActiveViewContentChanged;
		}
开发者ID:RHE24,项目名称:SharpDevelop,代码行数:13,代码来源:WpfViewContent.cs


示例20: LoadInternal

		protected override void LoadInternal(OpenedFile file, System.IO.Stream stream)
		{
			wasChangedInDesigner = false;
			Debug.Assert(file == this.PrimaryFile);
			SD.AnalyticsMonitor.TrackFeature(typeof(WpfViewContent), "Load");
			
			_stream = new MemoryStream();
			stream.CopyTo(_stream);
			stream.Position = 0;
			
			if (designer == null) {
				// initialize designer on first load
				designer = new DesignSurface();
				this.UserContent = designer;
				InitPropertyEditor();
				InitWpfToolbox();
			}
			this.UserContent = designer;
			if (outline != null) {
				outline.Root = null;
			}
			using (XmlTextReader r = new XmlTextReader(stream)) {
				XamlLoadSettings settings = new XamlLoadSettings();
				settings.DesignerAssemblies.Add(typeof(WpfViewContent).Assembly);
				settings.CustomServiceRegisterFunctions.Add(
					delegate(XamlDesignContext context) {
						context.Services.AddService(typeof(IUriContext), new FileUriContext(this.PrimaryFile));
						context.Services.AddService(typeof(IPropertyDescriptionService), new PropertyDescriptionService(this.PrimaryFile));
						context.Services.AddService(typeof(IEventHandlerService), new SharpDevelopEventHandlerService(this));
						context.Services.AddService(typeof(ITopLevelWindowService), new WpfAndWinFormsTopLevelWindowService());
						context.Services.AddService(typeof(ChooseClassServiceBase), new IdeChooseClassService());
					});
				settings.TypeFinder = MyTypeFinder.Create(this.PrimaryFile);
				try {
					settings.ReportErrors = UpdateTasks;
					designer.LoadDesigner(r, settings);
					
					designer.ContextMenuOpening += (sender, e) => MenuService.ShowContextMenu(e.OriginalSource as UIElement, designer, "/AddIns/WpfDesign/Designer/ContextMenu");
					
					if (outline != null && designer.DesignContext != null && designer.DesignContext.RootItem != null) {
						outline.Root = OutlineNode.Create(designer.DesignContext.RootItem);
					}
					
					propertyGridView.PropertyGrid.SelectedItems = null;
					designer.DesignContext.Services.Selection.SelectionChanged += OnSelectionChanged;
					designer.DesignContext.Services.GetService<UndoService>().UndoStackChanged += OnUndoStackChanged;
				} catch (Exception e) {
					this.UserContent = new WpfDocumentError(e);
				}
			}
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:51,代码来源:WpfViewContent.cs



注:本文中的OpenedFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Operand类代码示例发布时间:2022-05-24
下一篇:
C# OpenXmlPart类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap