当前位置: 首页>>代码示例>>C#>>正文


C# Altaxo.BeginReading方法代码示例

本文整理汇总了C#中Altaxo.BeginReading方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.BeginReading方法的具体用法?C# Altaxo.BeginReading怎么用?C# Altaxo.BeginReading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Altaxo的用法示例。


在下文中一共展示了Altaxo.BeginReading方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreWindowStateFromZippedFile

    /// <summary>
    /// Restores the state of the main window from a zipped Altaxo project file.
    /// </summary>
    /// <param name="zipFile">The zip file where the state file can be found into.</param>
    /// <param name="info">The deserialization info used to retrieve the data.</param>
    /// <param name="restoredDoc">The previously (also from the zip file!) restored Altaxo document.</param>
    public void RestoreWindowStateFromZippedFile(ZipFile zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info, AltaxoDocument restoredDoc)
    {
      System.Collections.ArrayList restoredControllers = new System.Collections.ArrayList();
      foreach (ZipEntry zipEntry in zipFile)
      {
        if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("Workbench/Views/"))
        {
          System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
          info.BeginReading(zipinpstream);
          object readedobject = info.GetValue("Table", this);
          if (readedobject is ICSharpCode.SharpDevelop.Gui.IViewContent)
            restoredControllers.Add(readedobject);
          info.EndReading();
        }
      }

      info.AnnounceDeserializationEnd(restoredDoc);
      info.AnnounceDeserializationEnd(this);

      // now give all restored controllers a view and show them in the Main view

      foreach (IViewContent viewcontent in restoredControllers)
      {
        IMVCControllerWrapper wrapper = viewcontent as IMVCControllerWrapper;
        if (wrapper != null && wrapper.MVCController.ViewObject==null)
          Current.Gui.FindAndAttachControlTo(wrapper.MVCController);

        if (viewcontent.Control != null)
        {
          Current.Workbench.ShowView(viewcontent);
        }
      }

    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:40,代码来源:ProjectService.cs

示例2: RestoreWindowStateFromZippedFile

		/// <summary>
		/// Restores the state of the main window from a zipped Altaxo project file.
		/// </summary>
		/// <param name="zipFile">The zip file where the state file can be found into.</param>
		/// <param name="info">The deserialization info used to retrieve the data.</param>
		/// <param name="restoredDoc">The previously (also from the zip file!) restored Altaxo document.</param>
		public void RestoreWindowStateFromZippedFile(ZipFile zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info, AltaxoDocument restoredDoc)
		{
			System.Collections.ArrayList restoredControllers = new System.Collections.ArrayList();
			foreach (ZipEntry zipEntry in zipFile)
			{
				if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("Workbench/Views/"))
				{
					System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
					info.BeginReading(zipinpstream);
					object readedobject = info.GetValue("Table", null);
					if (readedobject is ICSharpCode.SharpDevelop.Gui.IViewContent)
						restoredControllers.Add(readedobject);
					else if (readedobject is GraphViewLayout)
						restoredControllers.Add(readedobject);
					else if (readedobject is Altaxo.Graph.Graph3D.GuiModels.GraphViewOptions)
						restoredControllers.Add(readedobject);
					else if (readedobject is Altaxo.Worksheet.WorksheetViewLayout)
						restoredControllers.Add(readedobject);
					info.EndReading();
				}
			}

			info.AnnounceDeserializationEnd(restoredDoc, false);
			info.AnnounceDeserializationEnd(restoredDoc, false);

			// now give all restored controllers a view and show them in the Main view

			foreach (object o in restoredControllers)
			{
				if (o is GraphViewLayout)
				{
					var ctrl = new GraphControllerWpf();
					ctrl.InitializeDocument(o as GraphViewLayout);
					Current.Gui.FindAndAttachControlTo(ctrl);
					Current.Workbench.ShowView(new Altaxo.Gui.SharpDevelop.SDGraphViewContent(ctrl));
				}
				else if (o is Altaxo.Graph.Graph3D.GuiModels.GraphViewOptions)
				{
					var so = (o as Altaxo.Graph.Graph3D.GuiModels.GraphViewOptions);
					if (so.GraphDocument != null)
					{
						var viewContent = this.OpenOrCreateViewContentForDocument(so.GraphDocument) as IMVCANController;
						if (null != viewContent)
							viewContent.InitializeDocument(so);
					}
				}
				else if (o is Altaxo.Worksheet.WorksheetViewLayout)
				{
					var wksViewLayout = (Altaxo.Worksheet.WorksheetViewLayout)o;
					if (null != wksViewLayout.WorksheetLayout && null != wksViewLayout.WorksheetLayout.DataTable)
					{
						var ctrl = new Altaxo.Gui.Worksheet.Viewing.WorksheetControllerWpf();
						ctrl.InitializeDocument(wksViewLayout);
						Current.Gui.FindAndAttachControlTo(ctrl);
						Current.Workbench.ShowView(new Altaxo.Gui.SharpDevelop.SDWorksheetViewContent(ctrl));
					}
				}
				else if (o is IViewContent)
				{
					var viewcontent = o as IViewContent;
					IMVCControllerWrapper wrapper = viewcontent as IMVCControllerWrapper;
					if (wrapper != null && wrapper.MVCController.ViewObject == null)
						Current.Gui.FindAndAttachControlTo(wrapper.MVCController);

					if (viewcontent.Control != null)
					{
						Current.Workbench.ShowView(viewcontent);
					}
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:77,代码来源:ProjectService.cs


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