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


C# IViewContent.SwitchToThisWithoutSaveLoad方法代码示例

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


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

示例1: SwitchedToView

		protected void SwitchedToView(IViewContent newView)
		{
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
			}
			if (currentView != null) {
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					currentView = newView;
					fileData = null;
					newView.Load(this, sourceStream);
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:30,代码来源:OpenedFile.cs

示例2: SwitchedToView

		public void SwitchedToView(IViewContent newView)
		{
			if (newView == null)
				throw new ArgumentNullException("newView");
			if (currentView == newView)
				return;
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					IViewContent oldView = currentView;
					bool success = false;
					try {
						currentView = newView;
						// don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
						if (this.IsUntitled == false)
							fileData = null;
						newView.Load(this, sourceStream);
						success = true;
					} finally {
						// Use finally instead of catch+rethrow so that the debugger
						// breaks at the original crash location.
						if (!success) {
							// stay with old view in case of exceptions
							currentView = oldView;
						}
					}
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:46,代码来源:OpenedFile.cs

示例3: SwitchedToView

		public void SwitchedToView(IViewContent newView)
		{
			if (newView == null)
				throw new ArgumentNullException("newView");
			if (currentView == newView)
				return;
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
			}
			if (currentView != null) {
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					currentView = newView;
					// don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
					if (this.IsUntitled == false)
						fileData = null;
					newView.Load(this, sourceStream);
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:36,代码来源:OpenedFile.cs


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