//============================================================ // <T>加载设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); // 加载属性 _dataName = xconfig.Get("data_name"); _dataType = REnum.ToValue <EDataType>(xconfig.Get("data_type")); _dataKey = xconfig.GetBoolean("data_key"); _dataRequire = xconfig.GetBoolean("data_require"); _dataValue = xconfig.Get("data_value"); _dataDefault = xconfig.Get("data_default"); _dataOrder = xconfig.Get("data_order"); _queryAble = xconfig.GetBoolean("query_able"); _insertAble = xconfig.GetBoolean("insert_able"); _updateAble = xconfig.GetBoolean("update_able"); _deleteAble = xconfig.GetBoolean("delete_able"); _displaySearch = xconfig.GetBoolean("display_search"); _displayPicker = xconfig.GetBoolean("display_picker"); _displayZoom = xconfig.GetBoolean("display_zoom"); _editInsert = xconfig.GetBoolean("edit_insert"); _editUpdate = xconfig.GetBoolean("edit_update"); _editDelete = xconfig.GetBoolean("edit_delete"); _validInsert = xconfig.GetBoolean("valid_insert"); _validUpdate = xconfig.GetBoolean("valid_update"); _validDelete = xconfig.GetBoolean("valid_delete"); _searchAble = xconfig.GetBoolean("search_able"); _searchValue = xconfig.Get("search_value"); _searchTypeCd = REnum.ToValue <EDataSearch>(xconfig.Get("search_type_cd")); _searchLabel = xconfig.Get("search_label"); }
//============================================================ // <T>保存资源。</T> //============================================================ public void SaveResource() { _resource.Code = RInt.Parse(txtCode.Text); _resource.AlignCd = REnum.ToValue <ERcPictureAlign>(cboAlignCd.Text); _resource.Location.Parse(txtLocation.Text); _resource.Padding.Parse(txtPadding.Text); }
//============================================================ // <T>加载资源。</T> // // @param resource 资源 //============================================================ public void LoadResource(FRcObject resource) { // 检查参数 _resource = resource as FRcControl; if (_resource == null) { return; } // 属性设置 chkOptionEnable.Checked = _resource.OptionEnable; chkOptionVisible.Checked = _resource.OptionVisible; cbxDockCd.Text = REnum.ToString <ERcDock>(_resource.DockCd); txtLocation.Text = _resource.Location.ToString(); txtSize.Text = _resource.Size.ToString(); txtMargin.Text = _resource.Margin.ToString(); txtPadding.Text = _resource.Padding.ToString(); qcpForeColor.SelectColorValue = _resource.ForeColor; qpeForeResource.LoadResource(_resource.ForeResource); qcpBackColor.SelectColorValue = _resource.BackColor; qpeBackResource.LoadResource(_resource.BackResourceId); qUiInnerBorderProperty.LoadResource(_resource.BorderInner); qUiOuterBorderProperty.LoadResource(_resource.BorderOuter); // 事件设置 txtClick.Text = _resource.OnClick; txtDoubleClick.Text = _resource.OnDoubleClick; txtMouseDown.Text = _resource.OnMouseDown; txtMouseUp.Text = _resource.OnMouseUp; txtMouseMove.Text = _resource.OnMouseMove; txtMouseEnter.Text = _resource.OnMouseEnter; txtMouseLeave.Text = _resource.OnMouseLeave; }
//============================================================ // <T>保存资源。</T> //============================================================ public void SaveResource() { // 检查参数 if (_resource == null) { return; } // 保存属性 _resource.OptionEnable = chkOptionEnable.Checked; _resource.OptionVisible = chkOptionVisible.Checked; _resource.DockCd = REnum.ToValue <ERcDock>(cbxDockCd.Text); _resource.Margin.Parse(txtMargin.Text); _resource.Padding.Parse(txtPadding.Text); _resource.ForeColor = qcpForeColor.SelectColorValue; qpeForeResource.SaveResource(); _resource.BackColor = qcpBackColor.SelectColorValue; qpeBackResource.SaveResource(); qUiInnerBorderProperty.SaveResource(); qUiOuterBorderProperty.SaveResource(); // 保存事件 _resource.OnClick = txtClick.Text; _resource.OnDoubleClick = txtDoubleClick.Text; _resource.OnMouseDown = txtMouseDown.Text; _resource.OnMouseUp = txtMouseUp.Text; _resource.OnMouseMove = txtMouseMove.Text; _resource.OnMouseEnter = txtMouseEnter.Text; _resource.OnMouseLeave = txtMouseLeave.Text; }
public override void LoadConfig(FXmlNode config) { base.LoadConfig(config); // Load type string type = config[PTY_TYPE]; if (!RString.IsEmpty(type)) { _dataType = REnum.ToValue <EAopParameterType>(type); } // Load component if (config.HasNode()) { FXmlNode node = config.Nodes[0]; if (node.IsName(XAopComponent.TAG)) { _dataType = EAopParameterType.Component; } } // Load value if (_dataType == EAopParameterType.String) { _dataValue = config.Text; } }
//============================================================ // <T>存储设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnSaveConfig(FXmlNode xconfig) { base.OnSaveConfig(xconfig); // 存储配置 xconfig.SetNvl("option_visible", _optionVisible); xconfig.SetNvl("option_enable", _optionEnable); // 保存属性 if (_dockCd != ERcDock.None) { xconfig.SetNvl("dock_cd", REnum.ToString(typeof(ERcDock), _dockCd)); } // 存储位置 if (!_location.IsEmpty()) { xconfig.Set("location", _location.ToString()); } // 存储尺寸 if (!_size.IsEmpty()) { xconfig.SetNvl("size", _size.ToString()); } // 加载空白 if (!_margin.IsEmpty()) { xconfig.SetNvl("margin", _margin.ToString()); } if (!_padding.IsEmpty()) { xconfig.SetNvl("padding", _padding.ToString()); } // 存储边框 if (_propertyBorderInner == null || (_propertyBorderInner != null && !_borderInner.EqualsStyleProperty(_propertyBorderInner))) { _borderInner.SaveConfig(xconfig, "border_inner"); } if (_propertyBorderOuter == null || (_propertyBorderOuter != null && !_borderOuter.EqualsStyleProperty(_propertyBorderOuter))) { _borderOuter.SaveConfig(xconfig, "border_outer"); } // 保存前景资源 if ((_propertyForeColor == null) || (_propertyForeColor != null && _foreColor != _propertyForeColor.GetHex())) { xconfig.Set("fore_color", RColor.FormatHtml(_foreColor)); } _foreResource.SaveConfig(xconfig, "fore"); // 保存后景资源 if ((_propertyBackColor == null) || (_propertyBackColor != null && _backColor != _propertyBackColor.GetHex())) { xconfig.Set("back_color", RColor.FormatHtml(_backColor)); } _backResource.SaveConfig(xconfig, "back"); // 存储事件 xconfig.SetNvl("on_click", _onClick); xconfig.SetNvl("on_double_click", _onDoubleClick); xconfig.SetNvl("on_mouse_down", _onMouseDown); xconfig.SetNvl("on_mouse_up", _onMouseUp); xconfig.SetNvl("on_mouse_enter", _onMouseEnter); xconfig.SetNvl("on_mouse_move", _onMouseMove); xconfig.SetNvl("on_mouse_leave", _onMouseLeave); }
//============================================================ // <T>加载资源。</T> // // @param resource 资源 //============================================================ public void LoadResource(FRcPicture resource) { _resource = resource; txtCode.Text = _resource.Code.ToString(); cboAlignCd.Text = REnum.ToString <ERcPictureAlign>(_resource.AlignCd); txtLocation.Text = _resource.Location.ToString(); txtPadding.Text = _resource.Padding.ToString(); }
//============================================================ // <T>设置处理。</T> //============================================================ public override void Setup() { FontWeight fontWeight = (FontWeight)REnum.ToValue(typeof(FontWeight), _fontWeight); FontStyle fontStyle = (FontStyle)REnum.ToValue(typeof(FontStyle), _fontStyle); FontStretch fontStretch = (FontStretch)REnum.ToValue(typeof(FontStretch), _fontStretch); _native = _device.WriteFactory.CreateTextFormat(_fontFamilyName, fontWeight, fontStyle, fontStretch, _fontSize, _localName); }
//============================================================ // <T>确定按钮事件处理。</T> //============================================================ private void btnAccept_Click(object sender, System.EventArgs e) { _layer.ScrollCd = REnum.ToValue <EMapLayerScroll>(cbxScrollCd.Text); _layer.TypeCd = REnum.ToValue <EMapLayerType>(cbxTypeCd.Text); _layer.ScrollSpeed = RFloat.Parse(txtSpeed.Text); _layer.WrapCd = REnum.ToValue <EMapLayerWrap>(cbxWrapCd.Text); Close(); }
//============================================================ // <T>加载设置信息。</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); if (xconfig.Contains("text_align_cd")) { _textAlignCd = (ERcTextAlign)REnum.ToValue(typeof(ERcTextAlign), xconfig.Get("text_align_cd")); } _font.LoadConfig(xconfig, "font"); _text = xconfig.Get("text", _text); }
//============================================================ // <T>加载设置信息。</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); _designItemCount = xconfig.GetInteger("design_item_count", 1); _spreadCd = (ERcSpread)REnum.ToValue(typeof(ERcSpread), xconfig.Get("spread_cd", "None")); _horizontalCount = xconfig.GetInteger("horizontal_count", 1); _horizontalSpace = xconfig.GetInteger("horizontal_space", 0); _verticalCount = xconfig.GetInteger("vertical_count", 1); _verticalSpace = xconfig.GetInteger("vertical_space", 0); _initialCount = xconfig.GetInteger("initial_count", 0); }
//============================================================ // <T>构造窗体。</T> //============================================================ public QMapLayerDesignForm() { InitializeComponent(); // 初始化下拉列表 cbxScrollCd.Items.Clear(); cbxTypeCd.Items.Clear(); cbxWrapCd.Items.Clear(); cbxScrollCd.Items.AddRange(REnum.ToStringLines <EMapLayerScroll>()); cbxTypeCd.Items.AddRange(REnum.ToStringLines <EMapLayerType>()); cbxWrapCd.Items.AddRange(REnum.ToStringLines <EMapLayerWrap>()); }
public override void LoadConfig(FXmlNode config) { // Id _id = config[PTY_ID]; // Face _faceName = config[PTY_FACE]; // Type _typeName = config[PTY_TYPE]; // Scope string scope = config[PTY_SCOPE]; if (!RString.IsEmpty(scope)) { _scope = REnum.ToValue <EScope>(scope); } // Load config if (config.HasNode()) { foreach (FXmlNode node in config.Nodes) { if (node.IsName(XAopConstructor.TAG)) { // Constructor if (_constructor != null) { throw new FFatalException("Constructor can't be duplicate.\n{1}", config.Dump()); } _constructor = new XAopConstructor(); _constructor.LoadConfig(node); } else if (node.IsName(XAopProperty.TAG)) { // Properties XAopProperty property = new XAopProperty(); property.LoadConfig(node); _properties.Push(property); } else if (node.IsName(XAopInitialize.TAG)) { // Initializes XAopInitialize method = new XAopInitialize(); method.LoadConfig(node); _initializes.Push(method); } else if (node.IsName(XAopRelease.TAG)) { // Releases XAopRelease method = new XAopRelease(); method.LoadConfig(node); _releases.Push(method); } } } }
//============================================================ // <T>存储设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnSaveConfig(FXmlNode xconfig) { base.OnSaveConfig(xconfig); // 存储配置 xconfig.SetNvl("option_scroll_auto", _optionScrollAuto); //xconfig.SetNvl("option_scroll_horizontal", _optionScrollHorizontal); //xconfig.SetNvl("option_scroll_vertical", _optionScrollVertical); // 保存类型 xconfig.SetNvl("scroll_style_cd", REnum.ToString(typeof(ERcScrollStyle), _scrollStyleCd)); xconfig.SetNvl("horizontal_dock", REnum.ToString(typeof(ERcHorizontalDock), _horizontalDockCd)); xconfig.SetNvl("vertical_dock", REnum.ToString(typeof(ERcVerticalDock), _verticalDockCd)); }
//============================================================ // <T>加载配置文件。</T> //============================================================ public void LoadConfig(FXmlNode config) { if (config.Contains("cell_count")) { _cellCount.Parse(config.Get("cell_count")); } if (config.Contains("cell_size")) { _cellSize.Parse(config.Get("cell_size")); } if (config.Contains("type_cd")) { _typeCd = REnum.ToValue <EMapLayerType>(config.Get("type_cd")); } if (config.Contains("scroll_cd")) { _scrollCd = REnum.ToValue <EMapLayerScroll>(config.Get("scroll_cd")); } if (config.Contains("wrap_cd")) { _wrapCd = REnum.ToValue <EMapLayerWrap>(config.Get("wrap_cd")); } if (config.Contains("scroll_speed")) { _scrollSpeed = config.GetFloat("scroll_speed"); } _tileNode = config.Find("Tiles"); if (null == _tileNode) { return; } // 创建所有格子 for (int m = 0; m < _cellCount.Height; m++) { for (int n = 0; n < _cellCount.Width; n++) { FMbMapCell cell = new FMbMapCell(); cell.Index = new SIntPoint2(n, m); _mapCell.Push(cell); } } // 加载格子资源图片编号 foreach (FXmlNode cellNode in _tileNode.Nodes) { FDsMapCell cell = new FDsMapCell(); cell.Resource.LoadConfig(cellNode); SIntPoint2 cellIndex = cell.Resource.Index; FMbMapCell c = FingCellByIndex(cellIndex.X, cellIndex.Y); c.ResourceId = cell.Resource.ResourceId; } }
//============================================================ // <T>构造窗体。</T> //============================================================ public QUiBorderPropertyForm() { InitializeComponent(); // 初始化下拉框 cbxLStyle.Items.Clear(); cbxTStyle.Items.Clear(); cbxRStyle.Items.Clear(); cbxBStyle.Items.Clear(); cbxLStyle.Items.AddRange(REnum.ToStringLines <EUiLineStyle>()); cbxTStyle.Items.AddRange(REnum.ToStringLines <EUiLineStyle>()); cbxRStyle.Items.AddRange(REnum.ToStringLines <EUiLineStyle>()); cbxBStyle.Items.AddRange(REnum.ToStringLines <EUiLineStyle>()); }
//============================================================ // <T>序列化内容到输出流。</T> // // @param output 输出流 //============================================================ public virtual void OnSerialize(IOutput output) { int flags = MakeSerializeFlags(); output.WriteInt16((short)REnum.ToValue <ERcComponent>(_typeName)); output.WriteString(_className); output.WriteUint32((uint)flags); output.WriteString(_name); output.WriteWideString(_label); // 保存属性 //if(!_properties.IsEmpty()) { // _properties.Serialize(output); //} }
//============================================================ // <T>存储设置信息。</T> // // @param xconfig 设置信息 //============================================================ public override void OnSaveConfig(FXmlNode xconfig) { base.OnSaveConfig(xconfig); xconfig.SetNvl("design_item_count", _designItemCount); if (_spreadCd != ERcSpread.None) { xconfig.SetNvl("spread_cd", REnum.ToString(typeof(ERcSpread), _spreadCd)); } xconfig.SetNvl("horizontal_count", _horizontalCount); xconfig.SetNvl("horizontal_space", _horizontalSpace); xconfig.SetNvl("vertical_count", _verticalCount); xconfig.SetNvl("vertical_space", _verticalSpace); xconfig.SetNvl("initial_count", _initialCount); }
public virtual void LoadConfig(FXmlNode config) { if (config.Contains(PTY_TYPE)) { _type = REnum.ToValue <EScheduleConditionType>(config[PTY_TYPE]); } if (config.Contains(PTY_VALID)) { _valid = config.GetBoolean(PTY_VALID); } if (config.Contains(PTY_FILE)) { _fileName = config[PTY_FILE]; } }
//============================================================ // <T>加载设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); // 加载配置 _optionVisible = xconfig.GetBoolean("option_visible", _optionVisible); _optionEnable = xconfig.GetBoolean("option_enable", _optionEnable); // 加载属性 if (xconfig.Contains("dock_cd")) { _dockCd = (ERcDock)REnum.ToValue(typeof(ERcDock), xconfig.Get("dock_cd")); } // 加载位置 if (xconfig.Contains("location")) { _location.Parse(xconfig.Get("location")); } // 加载尺寸 if (xconfig.Contains("size")) { _size.Parse(xconfig.Get("size")); } // 加载空白 if (xconfig.Contains("margin")) { _margin.Parse(xconfig.Get("margin")); } if (xconfig.Contains("padding")) { _padding.Parse(xconfig.Get("padding")); } // 加载边框 _borderInner.LoadConfig(xconfig, "border_inner"); _borderOuter.LoadConfig(xconfig, "border_outer"); // 加载前景 _foreColor = xconfig.GetHex("fore_color", _foreColor); _foreResource.LoadConfig(xconfig, "fore"); // 加载后景 _backColor = xconfig.GetHex("back_color", _backColor); _backResource.LoadConfig(xconfig, "back"); // 加载事件 _onClick = xconfig.Get("on_click", null); _onDoubleClick = xconfig.Get("on_double_click", null); _onMouseDown = xconfig.Get("on_mouse_down", null); _onMouseUp = xconfig.Get("on_mouse_up", null); _onMouseEnter = xconfig.Get("on_mouse_enter", null); _onMouseMove = xconfig.Get("on_mouse_move", null); _onMouseLeave = xconfig.Get("on_mouse_leave", null); }
public void LoadConfig(FXmlNode config) { _config = config; // get type string type = config[PTY_TYPE]; _type = (ECsvWorkType)REnum.ToValue(typeof(ECsvWorkType), type); // get validator string formator = config[PTY_CLASS]; try { //_formator = (IFormator)RClass.CreateInstance(formator); } catch (Exception e) { throw new FFatalException(e, "Create formator class failure. (class={0})", formator); } }
//============================================================ // <T>加载设置信息。</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); // 读取数据 _optionHand = xconfig.GetBoolean("option_hand", _optionHand); _validInterval = xconfig.GetInteger("valid_interval", _validInterval); if (xconfig.Contains("text_align_cd")) { _textAlignCd = (ERcTextAlign)REnum.ToValue(typeof(ERcTextAlign), xconfig.Get("text_align_cd")); } _font.LoadConfig(xconfig, "font"); _text = xconfig.Get("text", _text); _groundResource.LoadConfig(xconfig, "ground"); // 读取事件 _onClickControl = xconfig.Get("on_click_control", _onClickControl); }
//============================================================ // <T>解析字符串内容。</T> // // @param value 字符串内容 //============================================================ public bool Parse(string value) { // 获得编号 int index = value.IndexOf(","); if (index == -1) { return(false); } _code = RInt.Parse(value.Substring(0, index)); value = value.Substring(index + 1); // 获得对齐方式 index = value.IndexOf(","); if (index == -1) { return(false); } _alignCd = REnum.ToValue <ERcPictureAlign>(value.Substring(0, index)); value = value.Substring(index + 1); // 获得位置 int start = value.IndexOf('('); int end = value.IndexOf(')'); if ((start == -1) || (end == -1)) { return(false); } if (!_location.Parse(value.Substring(start + 1, end - start - 1))) { return(false); } value = value.Substring(end + 1); // 获得空白 start = value.IndexOf('('); end = value.IndexOf(')'); if ((start == -1) || (end == -1)) { return(false); } if (!_padding.Parse(value.Substring(start + 1, end - start - 1))) { return(false); } return(true); }
//============================================================ // <T>加载边框信息。</T> //============================================================ public void LoadBorder() { // 左边线 qcpLColor.SelectColorValue = _border.Left.Color; txtLWidth.Text = _border.Left.Width.ToString(); cbxLStyle.Text = REnum.ToString <EUiLineStyle>(_border.Left.Style); // 上边线 qcpTColor.SelectColorValue = _border.Top.Color; txtTWidth.Text = _border.Top.Width.ToString(); cbxTStyle.Text = REnum.ToString <EUiLineStyle>(_border.Top.Style); // 右边线 qcpRColor.SelectColorValue = _border.Right.Color; txtRWidth.Text = _border.Right.Width.ToString(); cbxRStyle.Text = REnum.ToString <EUiLineStyle>(_border.Right.Style); // 下边线 qcpBColor.SelectColorValue = _border.Bottom.Color; txtBWidth.Text = _border.Bottom.Width.ToString(); cbxBStyle.Text = REnum.ToString <EUiLineStyle>(_border.Bottom.Style); }
//============================================================ // <T>确定按钮事件处理。</T> //============================================================ private void btnAccept_Click(object sender, System.EventArgs e) { // 左 _border.Left.Color = qcpLColor.SelectColorValue; _border.Left.Width = RInt.Parse(txtLWidth.Text); _border.Left.Style = REnum.ToValue <ERcLineStyle>(cbxLStyle.Text); // 上 _border.Top.Color = qcpTColor.SelectColorValue; _border.Top.Width = RInt.Parse(txtTWidth.Text); _border.Top.Style = REnum.ToValue <ERcLineStyle>(cbxTStyle.Text); // 右 _border.Right.Color = qcpRColor.SelectColorValue; _border.Right.Width = RInt.Parse(txtRWidth.Text); _border.Right.Style = REnum.ToValue <ERcLineStyle>(cbxRStyle.Text); // 下 _border.Bottom.Color = qcpBColor.SelectColorValue; _border.Bottom.Width = RInt.Parse(txtBWidth.Text); _border.Bottom.Style = REnum.ToValue <ERcLineStyle>(cbxBStyle.Text); // 完成后隐藏窗体 Hide(); }
//============================================================ // <T>加载设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnLoadConfig(FXmlNode xconfig) { base.OnLoadConfig(xconfig); // 加载配置 _optionScrollAuto = xconfig.GetBoolean("option_scroll_auto", _optionScrollAuto); //_optionScrollHorizontal = xconfig.GetBoolean("option_scroll_horizontal", _optionScrollHorizontal); //_optionScrollVertical = xconfig.GetBoolean("option_scroll_vertical", _optionScrollVertical); // 加载类型 if (xconfig.Contains("scroll_style_cd")) { _scrollStyleCd = (ERcScrollStyle)REnum.ToValue(typeof(ERcScrollStyle), xconfig.Get("scroll_style_cd")); } if (xconfig.Contains("horizontal_dock")) { _horizontalDockCd = (ERcHorizontalDock)REnum.ToValue(typeof(ERcHorizontalDock), xconfig.Get("horizontal_dock")); } if (xconfig.Contains("vertical_dock")) { _verticalDockCd = (ERcVerticalDock)REnum.ToValue(typeof(ERcVerticalDock), xconfig.Get("vertical_dock")); } }
//============================================================ // <T>构造控件。</T> //============================================================ public FRcCalendar(FRcFrameConsole console = null) : base(console) { _typeName = REnum.ToString <ERcComponent>(ERcComponent.Calendar); }
//============================================================ // <T>构造控件。</T> //============================================================ public FRcStaticLabel(FRcFrameConsole console = null) : base(console) { _typeName = REnum.ToString <ERcComponent>(ERcComponent.StaticLabel); }
//============================================================ // <T>构造控件。</T> //============================================================ public FRcPictureBox(FRcFrameConsole console = null) : base(console) { _typeName = REnum.ToString <ERcComponent>(ERcComponent.PictureBox); }
//============================================================ // <T>构造控件。</T> //============================================================ public FRcTable(FRcFrameConsole console = null) : base(console) { _typeName = REnum.ToString <ERcComponent>(ERcComponent.Table); }