/// <summary> /// 释放资源 /// </summary> public void Dispose() { dr.MouseMove -= dr_MouseMove; dr.MouseLeftButtonDown -= dr_MouseLeftButtonDown; dr.MouseLeftButtonUp -= dr_MouseLeftButtonUp; dr.MouseLeftUp -= dr_MouseLeftUp; dr.ResizeChanged -= dr_ResizeChanged; Loaded -= PageDesign_Loaded; SizeChanged -= PageDesign_SizeChanged; KeyDown -= PageDesign_KeyDown; KeyUp -= PageDesign_KeyUp; this._IDesigntime = null; this._maxLeft = 0; this._maxTop = 0; foreach (var v in this.cvsPanle.Children) { FrameworkElement fe = v as FrameworkElement; if (null == fe) { continue; } fe.MouseEnter -= fe_MouseEnter; } this.cvsPanle.Children.Clear(); }
/// <summary> /// 构造函数 /// </summary> /// <param name="iDesignFramework">设置时接口</param> /// <param name="control">控件</param> public XtnChildWindow(IPageDesignFramework iDesignFramework, FrameworkElement control) : this() { CurrentAddChildControl = control; this.IDesignFramework = iDesignFramework; if (!Double.IsNaN(control.Height)) { this.Height = control.Height + 100; this.Width = control.Width + 50; } if (control is IUserControl && null != iDesignFramework) { (control as IUserControl).IDesignFramework = iDesignFramework; } if (control is IPlatformClientChildWindow) { var _ipc = control as IPlatformClientChildWindow; this._IsFullscreen = _ipc.IsFullscreen; if (_IsFullscreen) { this.HorizontalAlignment = HorizontalAlignment.Stretch; this.VerticalAlignment = VerticalAlignment.Stretch; } } this.gControl.Children.Add(control); }
/// <summary> /// 释放资源 /// </summary> public override void Dispose() { DesignPage.Dispose(); DesignPage.ControlPosition -= PageDesign_ControlPosition; DesignPage.ControlDelete -= DesignPage_ControlDelete; txtXaml.LostFocus -= txtXaml_LostFocus; txtXml.LostFocus -= txtXml_LostFocus; this._IDesignFramework = null; }
/// <summary> /// 打开页面 /// </summary> /// <param name="iPage"></param> /// <param name="e"></param> internal void OpenPageInfo(OpenPageInfoEventArgs e, IPageDesignFramework iPage) { _IsOpenPage = true; this._IDesignFramework = iPage; this.PageInfo = e.PageDirectorySub; this.DesignPage.SetDesigntimeInterface(iPage); //-->判断 this.PageInfo.PageContent 是否为空。 //-->如果不为空说就把里面的信息分开,然后分别放到 txtXaml,txtXml控件里去 this.txtXaml.Text = string.Empty; this.txtXml.Text = string.Empty; if (this.PageInfo.PageContent.IsNullOrEmpty()) { this.IsUpdate = true; //-->说明刚创建的一个新的页面。 CreateNewPageInfo(e); return; } XElement _xe_page = XElement.Parse(this.PageInfo.PageContent.Trim()); if (null == _xe_page) { return; } XElement _xe_xaml = _xe_page.Element("xaml"); XElement _xe_xml = _xe_page.Element("xml"); string xaml = _xe_xaml != null && _xe_xaml.FirstNode != null?_xe_xaml.FirstNode.ToString() : ""; // _xe_xaml.GetElementValue("xaml"); string xml = _xe_xml != null && _xe_xml.FirstNode != null?_xe_xml.FirstNode.ToString() : ""; //-->xml操作 DecodeXml(xml); //-->获取xaml Xaml_LostFocus("", xaml); DesignPage.Height = _XmlTemplate.BaseInfo.PageHeight; DesignPage.Width = _XmlTemplate.BaseInfo.PageWidth; UpdateControlTree(); _IsOpenPage = false; this.IsUpdate = false; }
/// <summary> /// 设计 /// </summary> /// <param name="iPage"></param> internal void SetDesigntimeInterface(IPageDesignFramework iPage) { _IDesigntime = iPage; cvsPanle.IPageDesignFramework = iPage; }
internal void ReadEvent(UIElement ui, IPageDesignFramework iPageDesignFramework) { this.IDesignFramework = iPageDesignFramework; this.ReadEvent(ui); }
/// <summary> /// 读取控件属性 /// </summary> /// <param name="ui"></param> /// <param name="iPageDesignFramework"></param> internal void ReadProperty(UIElement ui, IPageDesignFramework iPageDesignFramework) { this.IDesignFramework = iPageDesignFramework; ReadProperty(ui); }