//ビューとの関連付け変更 public void AttachView(IPoderosaView view) { _lastAttachedView = view; _currentView = view; IViewFactory vf = WindowManagerPlugin.Instance.ViewFactoryManager.GetViewFactoryByDoc(_document.GetType()); IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView)); IPoderosaView internalview = rv == null ? view : rv.AssureViewClass(vf.GetViewType()); //ContentReplaceableViewのときは中身を使用 Debug.Assert(vf.GetViewType() == internalview.GetType()); _sessionHost.Session.InternalAttachView(_document, internalview); }
private static string ViewName(IPoderosaView view) { if (view == null) { return("null"); } else { IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView)); if (rv != null) { return(rv.GetCurrentContent().GetType().Name); } else { return(view.GetType().Name); } } }
public IPoderosaView AssureViewClass(Type viewclass) { if (viewclass == _content.GetType()) { return(_content); //ダイナミックな置換は不要、OK! } IContentReplaceableViewSite site = (IContentReplaceableViewSite)_content.GetAdapter(typeof(IContentReplaceableViewSite)); Control p = _content.AsControl().Parent; p.SuspendLayout(); if (site != null) { site.CurrentContentReplaceableView = null; //IContentReplaceableViewSiteが取れるかどうかはオプショナル } Debug.WriteLineIf(DebugOpt.ViewManagement, String.Format("Replace ViewClass {0} => {1}", _content.GetType().Name, viewclass.Name)); IPoderosaView newview = CreateView(viewclass); UIUtil.ReplaceControl(p, _content.AsControl(), newview.AsControl()); //旧コントロールにドキュメントがくっついていたら、それを外さないと不整合生じる if (_content.Document != null) { SessionManagerPlugin.Instance.FindDocumentHost(_content.Document).DetachView(); } _content.AsControl().Dispose(); _content = newview; site = (IContentReplaceableViewSite)newview.GetAdapter(typeof(IContentReplaceableViewSite)); if (site != null) { site.CurrentContentReplaceableView = this; } p.ResumeLayout(true); return(newview); }
private static string ViewName(IPoderosaView view) { if (view == null) return "null"; else { IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView)); if (rv != null) return rv.GetCurrentContent().GetType().Name; else return view.GetType().Name; } }