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


C# Diagram.Associate方法代码示例

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


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

示例1: ActivateDiagram

		/// <summary>
		/// Activate the specified <paramref name="diagram"/>
		/// </summary>
		/// <param name="diagram">The <see cref="Diagram"/> to activate</param>
		/// <returns>true if the diagram is successfully activated</returns>
		public bool ActivateDiagram(Diagram diagram)
		{
			if (diagram != null) // Sanity check
			{
				bool calledShow = false;
				Store spyOnStore = myStore;
				Store testStore = diagram.Store;
				if (spyOnStore == null)
				{
					// Either the window has never been shown, or it is not currently
					// active. Pre-check the store against the current selection to
					// see if showing the window will actually initialize to the correct store.
					IMonitorSelectionService selectionService;
					ModelingDocData docData;
					if (null != (selectionService = (IMonitorSelectionService)ExternalServiceProvider.GetService(typeof(IMonitorSelectionService))) &&
						null != (docData = selectionService.CurrentDocument as ModelingDocData) &&
						testStore == (spyOnStore = docData.Store))
					{
						calledShow = true;
						Show();
						spyOnStore = myStore; // Sanity check in case something went wrong
					}
					else
					{
						return false;
					}
				}
				if (testStore == spyOnStore)
				{
					DiagramView diagramView = myDiagramView;
					Diagram oldDiagram = diagramView.Diagram;
					bool reselectOldDiagram = false;
					if (oldDiagram != null)
					{
						reselectOldDiagram = oldDiagram == diagram;
						if (!reselectOldDiagram)
						{
							myDisassociating = true;
							try
							{
								oldDiagram.Disassociate(diagramView);
							}
							finally
							{
								myDisassociating = false;
							}
						}
					}
					if (!reselectOldDiagram)
					{
						MultiDiagramDocView.DeactivateMouseActions(diagram.ActiveDiagramView);
						diagram.Associate(diagramView);
					}
					AdjustVisibility(true, false);
					if (!calledShow)
					{
						calledShow = true;
						Show();
					}
					if (reselectOldDiagram && diagramView.Selection.PrimaryItem != null)
					{
						OnSelectionChanging(EventArgs.Empty);
						OnSelectionChanged(EventArgs.Empty);
					}
					else
					{
						SetSelectedComponents(new object[] { diagram });
					}
					DiagramClientView clientView;
					if (calledShow &&
						!(clientView = diagramView.DiagramClientView).Focused)
					{
						clientView.Focus();
					}
					return true;
				}
			}
			return false;
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:84,代码来源:ORMDiagramSpy.cs

示例2: AddDiagram

		/// <summary>
		/// Adds the <see cref="Diagram"/> specified by <paramref name="diagram"/> to this <see cref="MultiDiagramDocView"/>.
		/// </summary>
		/// <param name="diagram">The <see cref="Diagram"/> to be added to this <see cref="MultiDiagramDocView"/>.</param>
		/// <param name="selectAsCurrent">Indicates whether focus should be given to the new <see cref="Diagram"/>.</param>
		public void AddDiagram(Diagram diagram, bool selectAsCurrent)
		{
			if (diagram == null)
			{
				throw new ArgumentNullException("diagram");
			}
			DiagramView designer = CreateDiagramView();
			diagram.Associate(designer);
			AddDesigner(designer, selectAsCurrent);
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:15,代码来源:MultiDiagramDocView.cs


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