Example #1
0
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement label = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(label.GetAttribute("ID"));
            }

            int x      = int.Parse(label.GetAttribute("X"));
            int y      = int.Parse(label.GetAttribute("Y"));
            int width  = int.Parse(label.GetAttribute("Width"));
            int height = int.Parse(label.GetAttribute("Height"));

            _attrib.Rect             = new Rectangle(x, y, width, height);
            _attrib.FrontColorground = Color.FromArgb(int.Parse(label.GetAttribute("Color")));
            _attrib.BackColorground  = Color.FromArgb(int.Parse(label.GetAttribute("Backcolor")));
            _attrib.Text             = label.GetAttribute("Text");
            _attrib.Align            = Byte.Parse(label.GetAttribute("TextAlign"));
            _attrib.Transparent      = Boolean.Parse(label.GetAttribute("Transparent"));
            String fontFamily = label.GetAttribute("Font");
            Single fontSize   = float.Parse(label.GetAttribute("FontSize"));

            _attrib.Font = new Font(fontFamily, fontSize);
        }
Example #2
0
        /// <summary>
        /// 从xml文件中加载当前按钮对象内容
        /// </summary>
        /// <param Name="xml">xml对象</param>
        /// <param Name="isCreate">true-创建新的ID号,false-表示使用文件中的ID</param>
        public override void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement button = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(button.GetAttribute("id"));
            }

            int x      = int.Parse(button.GetAttribute("x"));
            int y      = int.Parse(button.GetAttribute("y"));
            int width  = int.Parse(button.GetAttribute("width"));
            int height = int.Parse(button.GetAttribute("height"));

            _attrib.Rect = new Rectangle(x, y, width, height);

            ///遍历节点,循环读取图片文件数据
            XmlNodeList nls = button.ChildNodes;

            foreach (var tmp in nls)
            {
                XmlElement vElement = (XmlElement)tmp;
                SVBitmap   svBitmap = new SVBitmap();
                svBitmap.ShowName      = vElement.GetAttribute("Name");
                svBitmap.ImageFileName = vElement.GetAttribute("File");
                _attrib.BitMapArray.BitmapArray.Add(svBitmap);
            }
        }
Example #3
0
        override public void saveXML(SVXml xml)
        {
            XmlElement analog = xml.createNode(this.GetType().Name);

            analog.SetAttribute("ID", _attrib.ID.ToString());
            analog.SetAttribute("X", _attrib.Rect.X.ToString());
            analog.SetAttribute("Y", _attrib.Rect.Y.ToString());
            analog.SetAttribute("Width", _attrib.Rect.Width.ToString());
            analog.SetAttribute("Height", _attrib.Rect.Height.ToString());

            analog.SetAttribute("Variable", _attrib.Variable.VarName);
            analog.SetAttribute("VariableType", _attrib.Variable.VarBlockType.ToString());

            analog.SetAttribute("NormalColor", _attrib.NormalColor.ToArgb().ToString());
            analog.SetAttribute("OverMaxColor", _attrib.OverMaxColor.ToArgb().ToString());
            analog.SetAttribute("OverMinColor", _attrib.OverMinColor.ToArgb().ToString());
            analog.SetAttribute("NormalBackcolor", _attrib.NormalBgColor.ToArgb().ToString());
            analog.SetAttribute("OverMaxBgColor", _attrib.OverMaxBgColor.ToArgb().ToString());
            analog.SetAttribute("OverMinBgColor", _attrib.OverMinBgColor.ToArgb().ToString());
            analog.SetAttribute("ExceptionColor", _attrib.ExceptionColor.ToArgb().ToString());
            analog.SetAttribute("ExceptionBgColor", _attrib.ExceptionBgColor.ToArgb().ToString());
            analog.SetAttribute("DecNumber", _attrib.DecNum.ToString());
            analog.SetAttribute("IsExponent", _attrib.IsExponent.ToString());
            analog.SetAttribute("Font", _attrib.Font.Name.ToString());
            analog.SetAttribute("FontSize", _attrib.Font.Size.ToString());
            analog.SetAttribute("Max", _attrib.Max.ToString());
            analog.SetAttribute("Min", _attrib.Min.ToString());
        }
Example #4
0
        /// <summary>
        /// 从文件中加载数据
        /// </summary>
        /// <param Name="xml">xml文件对象</param>
        /// <param Name="isCreate"></param>
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement curve = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(curve.GetAttribute("ID"));
            }

            int x      = int.Parse(curve.GetAttribute("X"));
            int y      = int.Parse(curve.GetAttribute("Y"));
            int width  = int.Parse(curve.GetAttribute("Width"));
            int height = int.Parse(curve.GetAttribute("Height"));

            _attrib.Rect        = new Rectangle(x, y, width, height);
            _attrib.FrontColor  = Color.FromArgb(int.Parse(curve.GetAttribute("FrontColor")));
            _attrib.BackgdColor = Color.FromArgb(int.Parse(curve.GetAttribute("BackgdColor")));
            _attrib.Interval    = UInt16.Parse(curve.GetAttribute("Interval"));
            String fontFamily = curve.GetAttribute("Font");
            Single fontSize   = Single.Parse(curve.GetAttribute("FontSize"));

            _attrib.Font = new Font(fontFamily, fontSize);
            _attrib.Max  = Single.Parse(curve.GetAttribute("Max"));
            _attrib.Min  = Single.Parse(curve.GetAttribute("Min"));

            Int32 count = Int32.Parse(curve.GetAttribute("Count"));

            for (int i = 0; i < count; i++)
            {
                SVCurveProper proper = new SVCurveProper();

                XmlNodeList nls      = curve.GetElementsByTagName("VarName");
                XmlElement  vElement = (XmlElement)nls[i];
                proper.Var.VarName = vElement.GetAttribute("Value");

                XmlNodeList varType  = curve.GetElementsByTagName("VarType");
                XmlElement  tElement = (XmlElement)varType[i];
                proper.Var.VarBlockType = Byte.Parse(tElement.GetAttribute("Value"));

                XmlNodeList colorList = curve.GetElementsByTagName("VarColor");
                XmlElement  cElement  = (XmlElement)colorList[i];
                String      value     = cElement.GetAttribute("Value");
                proper.Color = Color.FromArgb(int.Parse(value));

                XmlNodeList enabledList = curve.GetElementsByTagName("varEnabled");
                XmlElement  eElement    = (XmlElement)enabledList[i];
                proper.Enabled = Boolean.Parse(eElement.GetAttribute("Value"));

                _attrib.Variable.Add(proper);
            }
        }
Example #5
0
        override public void saveXML(SVXml xml)
        {
            XmlElement icon = xml.createNode(this.GetType().Name);

            icon.SetAttribute("ID", _attrib.ID.ToString());
            icon.SetAttribute("X", _attrib.Rect.X.ToString());
            icon.SetAttribute("Y", _attrib.Rect.Y.ToString());
            icon.SetAttribute("Width", _attrib.Rect.Width.ToString());
            icon.SetAttribute("Height", _attrib.Rect.Height.ToString());
            icon.SetAttribute("ImageFile", _attrib.PicIconData.ImageFileName);
            icon.SetAttribute("ImageShowName", _attrib.PicIconData.ShowName);
        }
Example #6
0
        /// <summary>
        /// 保存线条控件数据到xml文件中
        /// </summary>
        /// <param Name="xml">xml对象</param>
        public override void saveXML(SVXml xml)
        {
            XmlElement lineXml = xml.createNode(this.GetType().Name);

            lineXml.SetAttribute("id", _attrib.ID.ToString());
            lineXml.SetAttribute("x", _attrib.start.X.ToString());
            lineXml.SetAttribute("y", _attrib.start.Y.ToString());
            lineXml.SetAttribute("width", _attrib.LineWidth.ToString());
            lineXml.SetAttribute("length", _attrib.LineLength.ToString());
            lineXml.SetAttribute("color", _attrib.LineColor.ToArgb().ToString());
            lineXml.SetAttribute("type", _attrib.ShowType.ToString());
        }
Example #7
0
        /// <summary>
        /// 保存当前页面数据到xml中
        /// </summary>
        public void saveSelf()
        {
            if (!_isModify)
            {
                return;
            }

            SVXml xml = new SVXml();

            xml.createRootEle("Page");
            saveXML(xml);
            xml.writeXml(pageFileName);
        }
Example #8
0
        public void saveXML(SVXml xml)
        {
            //保存后修改状态。
            IsModify = false;

            xml.setAttr("ID", _attrib.id.ToString());

            XmlElement width = xml.createNode("Width");

            width.InnerText = _attrib.Width.ToString();

            XmlElement height = xml.createNode("Height");

            height.InnerText = _attrib.Height.ToString();

            XmlElement back = xml.createNode("Backcolor");

            back.InnerText = _attrib.BackColor.ToArgb().ToString();

            XmlElement mainPage = xml.createNode("MainPage");

            mainPage.InnerText = _attrib.IsMainPage.ToString();

            XmlElement backGroundType = xml.createNode("BackGroundType");

            backGroundType.InnerText = _attrib.BackGroundType.ToString();

            XmlElement picShowName = xml.createNode("PicShowName");

            picShowName.InnerText = _attrib.PicIconData.ShowName;

            XmlElement picFile = xml.createNode("PicFile");

            picFile.InnerText = _attrib.PicIconData.ImageFileName;

            XmlElement alignMent = xml.createNode("alignment");

            alignMent.InnerText = _attrib.IsAlignment.ToString();

            //保存当前页面的所有子控件
            foreach (Control ctrl in this.Controls)
            {
                SVPanel svPanel = ctrl as SVPanel;
                if (svPanel == null)
                {
                    continue;
                }

                svPanel.saveXML(xml);
            }
        }
Example #9
0
        /// <summary>
        /// 从xml文件中加载当前按钮对象内容
        /// </summary>
        /// <param Name="xml">xml对象</param>
        /// <param Name="isCreate">true-创建新的ID号,false-表示使用文件中的ID</param>
        public override void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement button = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(button.GetAttribute("id"));
            }

            int x      = int.Parse(button.GetAttribute("x"));
            int y      = int.Parse(button.GetAttribute("y"));
            int width  = int.Parse(button.GetAttribute("width"));
            int height = int.Parse(button.GetAttribute("height"));

            _attrib.Rect                = new Rectangle(x, y, width, height);
            _attrib.FrontColorground    = Color.FromArgb(int.Parse(button.GetAttribute("color")));
            _attrib.BackColorground     = Color.FromArgb(int.Parse(button.GetAttribute("backcolor")));
            _attrib.BackColorgroundDown = Color.FromArgb(int.Parse(button.GetAttribute("backgdcolor")));
            _attrib.Text                = button.GetAttribute("text");
            _attrib.FText               = button.GetAttribute("falseText");

            String fontFamily = button.GetAttribute("font");
            Single fontSize   = float.Parse(button.GetAttribute("fontSize"));

            _attrib.Font    = new Font(fontFamily, fontSize);
            _attrib.Comfirm = Boolean.Parse(button.GetAttribute("Confirm"));

            _attrib.ButtonType          = Byte.Parse(button.GetAttribute("ButtonType"));
            _attrib.ButtonPage.PageID   = UInt16.Parse(button.GetAttribute("ButtonTypeID"));
            _attrib.ButtonPage.PageText = button.GetAttribute("ButtonTypeText");

            _attrib.BtnVarText.VarName      = button.GetAttribute("ButtonTypeVar");
            _attrib.BtnVarText.VarBlockType = Byte.Parse(button.GetAttribute("ButtonTypeVarType"));

            _attrib.EnVarText.VarName      = button.GetAttribute("EnabledVar");
            _attrib.EnVarText.VarBlockType = Byte.Parse(button.GetAttribute("EnabledVarType"));
            _attrib.BtnEnable = Boolean.Parse(button.GetAttribute("Enabled"));

            //按钮图片数据
            _attrib.IsShowPic = Boolean.Parse(button.GetAttribute("IsShowPicture"));
            _attrib.BtnDownPic.ImageFileName = button.GetAttribute("BtnDownPicFile");
            _attrib.BtnDownPic.ShowName      = button.GetAttribute("BtnDownPicShowName");
            _attrib.BtnUpPic.ImageFileName   = button.GetAttribute("BtnUpPicFile");
            _attrib.BtnUpPic.ShowName        = button.GetAttribute("BtnUpPicShowName");
            //读取趋势图关联
            _attrib.CurveObj = button.GetAttribute("CurveObj");
        }
Example #10
0
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement binary = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(binary.GetAttribute("ID"));
            }

            ///读取尺寸
            int x      = int.Parse(binary.GetAttribute("X"));
            int y      = int.Parse(binary.GetAttribute("Y"));
            int width  = int.Parse(binary.GetAttribute("Width"));
            int height = int.Parse(binary.GetAttribute("Height"));

            _attrib.Rect = new Rectangle(x, y, width, height);

            ///读取变量
            _attrib.Variable.VarName      = binary.GetAttribute("Variable");
            _attrib.Variable.VarBlockType = Byte.Parse(binary.GetAttribute("VarialeType"));

            ///读取自定义名称
            _attrib.CustomTrueText  = binary.GetAttribute("CustomTrueText");
            _attrib.CustomFlaseText = binary.GetAttribute("CustomFalseText");
            //_attrib.CustomExceptionText = binary.GetAttribute("CustomExText");

            ///图片
            _attrib.TruePicture.ImageFileName  = binary.GetAttribute("TImageFile");
            _attrib.TruePicture.ShowName       = binary.GetAttribute("TImageShowName");
            _attrib.FlasePicture.ImageFileName = binary.GetAttribute("FImageFile");
            _attrib.FlasePicture.ShowName      = binary.GetAttribute("FImageShowName");
            _attrib.ExPicture.ImageFileName    = binary.GetAttribute("EImageFile");
            _attrib.ExPicture.ShowName         = binary.GetAttribute("EImageShowName");

            _attrib.TrueColor        = Color.FromArgb(int.Parse(binary.GetAttribute("TrueColor")));
            _attrib.TrueBgColor      = Color.FromArgb(int.Parse(binary.GetAttribute("TrueBgColor")));
            _attrib.FalseColor       = Color.FromArgb(int.Parse(binary.GetAttribute("FalseColor")));
            _attrib.FalseBgColor     = Color.FromArgb(int.Parse(binary.GetAttribute("FalseBgColor")));
            _attrib.ExceptionColor   = Color.FromArgb(int.Parse(binary.GetAttribute("ExceptionColor")));
            _attrib.ExceptionBgColor = Color.FromArgb(int.Parse(binary.GetAttribute("ExceptionBgColor")));
            String fontFamily = binary.GetAttribute("Font");
            Single fontSize   = Single.Parse(binary.GetAttribute("FontSize"));

            _attrib.Font = new Font(fontFamily, fontSize);
            _attrib.Type = Byte.Parse(binary.GetAttribute("Type"));
        }
Example #11
0
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement gif = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(gif.GetAttribute("ID"));
            }

            int x      = int.Parse(gif.GetAttribute("X"));
            int y      = int.Parse(gif.GetAttribute("Y"));
            int width  = int.Parse(gif.GetAttribute("Width"));
            int height = int.Parse(gif.GetAttribute("Height"));

            _attrib.Rect = new Rectangle(x, y, width, height);

            ///读取错误图片数据
            _attrib.PicError.ImageFileName = gif.GetAttribute("ErrorFile");
            _attrib.PicError.ShowName      = gif.GetAttribute("ErrorShowName");

            XmlDocument docment = gif.OwnerDocument;

            ///读取背景图片数组
            XmlNodeList nls = gif.GetElementsByTagName("PIC");

            foreach (var tmp in nls)
            {
                XmlElement vElement = (XmlElement)tmp;
                SVBitmap   svBitmap = new SVBitmap();
                svBitmap.ShowName      = vElement.GetAttribute("Name");
                svBitmap.ImageFileName = vElement.GetAttribute("File");
                _attrib.Pic.BitmapArray.Add(svBitmap);
            }

            ///读取变量名列表
            nls = gif.GetElementsByTagName("VarName");
            foreach (var tmp in nls)
            {
                XmlElement vElement = (XmlElement)tmp;
                String     vName    = vElement.GetAttribute("VName");
                Byte       vType    = Byte.Parse(vElement.GetAttribute("VType"));
                _attrib.VarName.Add(vName);
                _attrib.VarType.Add(vType);
            }
        }
Example #12
0
        override public void saveXML(SVXml xml)
        {
            XmlElement label = xml.createNode(this.GetType().Name);

            label.SetAttribute("ID", _attrib.ID.ToString());
            label.SetAttribute("X", _attrib.Rect.X.ToString());
            label.SetAttribute("Y", _attrib.Rect.Y.ToString());
            label.SetAttribute("Width", _attrib.Rect.Width.ToString());
            label.SetAttribute("Height", _attrib.Rect.Height.ToString());
            label.SetAttribute("Color", _attrib.FrontColorground.ToArgb().ToString());
            label.SetAttribute("Backcolor", _attrib.BackColorground.ToArgb().ToString());
            label.SetAttribute("TextAlign", _attrib.Align.ToString());
            label.SetAttribute("Text", _attrib.Text);
            label.SetAttribute("Font", _attrib.Font.Name.ToString());
            label.SetAttribute("FontSize", _attrib.Font.Size.ToString());
            label.SetAttribute("Transparent", _attrib.Transparent.ToString());
        }
Example #13
0
        /// <summary>
        /// 页面控件加载数据
        /// bCreate - true: 创建新ID号
        ///          false: 使用文件中ID号
        /// </summary>
        /// <param Name="bCreate">是否创建新的ID号</param>
        public Boolean loadSelf(Boolean bCreate = false)
        {
            SVXml xml = new SVXml();

            if (!xml.loadXml(pageFileName))
            {
                return(false);
            }

            xml.initRootEle("Page");

            ///从xml文件中加载
            loadXML(xml, bCreate);
            ///将数据更新到界面显示
            refreshPropertyToPanel();

            return(true);
        }
Example #14
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        private void okBtn_Click(object sender, EventArgs e)
        {
            SVPageNode node = _svTreeView.SelectedNode as SVPageNode;

            if (node == null || node.Level != 2)
            {
                SVMessageBox msgBox = new SVMessageBox();
                msgBox.content(Resource.提示, Resource.请选择页面);
                msgBox.ShowDialog();
                return;
            }

            SVPageWidget widget = node.Addtionobj as SVPageWidget;
            ///模板文件
            String file = Path.Combine(SVProData.TemplatePath, node.Text);

            if (File.Exists(file))
            {
                SVMessageBox msgBox = new SVMessageBox();
                msgBox.content(Resource.提示, node.Text + " " + Resource.模板已经存在);
                msgBox.ShowDialog();
                return;
            }

            //保存文件
            SVXml pageXML = new SVXml();

            pageXML.createRootEle("Page");
            widget.saveXML(pageXML);
            pageXML.writeXml(file);

            //保存缩略图
            Bitmap ctlbitmap = new Bitmap(widget.Width, widget.Height);

            widget.DrawToBitmap(ctlbitmap, widget.ClientRectangle);
            ctlbitmap.Save(file + ".jpg");

            //记录日志
            SVLog.WinLog.Info(String.Format("模板{0}保存成功", node.Text));

            this.DialogResult = System.Windows.Forms.DialogResult.Yes;
        }
Example #15
0
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement analog = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(analog.GetAttribute("ID"));
            }

            int x      = int.Parse(analog.GetAttribute("X"));
            int y      = int.Parse(analog.GetAttribute("Y"));
            int width  = int.Parse(analog.GetAttribute("Width"));
            int height = int.Parse(analog.GetAttribute("Height"));

            _attrib.Variable.VarName      = analog.GetAttribute("Variable");
            _attrib.Variable.VarBlockType = Byte.Parse(analog.GetAttribute("VariableType"));

            _attrib.Rect             = new Rectangle(x, y, width, height);
            _attrib.NormalColor      = Color.FromArgb(int.Parse(analog.GetAttribute("NormalColor")));
            _attrib.OverMaxColor     = Color.FromArgb(int.Parse(analog.GetAttribute("OverMaxColor")));
            _attrib.OverMinColor     = Color.FromArgb(int.Parse(analog.GetAttribute("OverMinColor")));
            _attrib.NormalBgColor    = Color.FromArgb(int.Parse(analog.GetAttribute("NormalBackcolor")));
            _attrib.OverMaxBgColor   = Color.FromArgb(int.Parse(analog.GetAttribute("OverMaxBgColor")));
            _attrib.OverMinBgColor   = Color.FromArgb(int.Parse(analog.GetAttribute("OverMinBgColor")));
            _attrib.ExceptionColor   = Color.FromArgb(int.Parse(analog.GetAttribute("ExceptionColor")));
            _attrib.ExceptionBgColor = Color.FromArgb(int.Parse(analog.GetAttribute("ExceptionBgColor")));

            _attrib.DecNum     = Byte.Parse(analog.GetAttribute("DecNumber"));
            _attrib.IsExponent = Boolean.Parse(analog.GetAttribute("IsExponent"));
            String fontFamily = analog.GetAttribute("Font");
            Single fontSize   = Single.Parse(analog.GetAttribute("FontSize"));

            _attrib.Font = new Font(fontFamily, fontSize);
            _attrib.Max  = Single.Parse(analog.GetAttribute("Max"));
            _attrib.Min  = Single.Parse(analog.GetAttribute("Min"));
        }
Example #16
0
        override public void saveXML(SVXml xml)
        {
            XmlElement gif = xml.createNode(this.GetType().Name);

            gif.SetAttribute("ID", _attrib.ID.ToString());
            gif.SetAttribute("X", _attrib.Rect.X.ToString());
            gif.SetAttribute("Y", _attrib.Rect.Y.ToString());
            gif.SetAttribute("Width", _attrib.Rect.Width.ToString());
            gif.SetAttribute("Height", _attrib.Rect.Height.ToString());

            ///出错图片保存
            gif.SetAttribute("ErrorFile", _attrib.PicError.ImageFileName);
            gif.SetAttribute("ErrorShowName", _attrib.PicError.ShowName);

            ///保存变量
            Int32 i = 0;

            foreach (var name in _attrib.VarName)
            {
                XmlElement nameList = xml.crateChildNode("VarName");
                gif.AppendChild(nameList);

                nameList.SetAttribute("VName", name);
                nameList.SetAttribute("VType", _attrib.VarType[i].ToString());

                i++;
            }

            ///保存背景图片数据
            List <SVBitmap> list = _attrib.Pic.imageArray();

            foreach (var item in list)
            {
                XmlElement picList = xml.crateChildNode("PIC");
                gif.AppendChild(picList);

                picList.SetAttribute("Name", item.ShowName);
                picList.SetAttribute("File", item.ImageFileName);
            }
        }
Example #17
0
        /// <summary>
        /// 从xml文件中加载线条的数据
        /// </summary>
        /// <param Name="xml">xml对象</param>
        /// <param Name="isCreate">true-创建新ID false-使用文件中的ID</param>
        public override void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement lineXml = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(lineXml.GetAttribute("id"));
            }

            int x = int.Parse(lineXml.GetAttribute("x"));
            int y = int.Parse(lineXml.GetAttribute("y"));

            _attrib.start      = new Point(x, y);
            _attrib.LineLength = UInt16.Parse(lineXml.GetAttribute("length"));
            _attrib.LineWidth  = Byte.Parse(lineXml.GetAttribute("width"));
            _attrib.ShowType   = Boolean.Parse(lineXml.GetAttribute("type"));
            _attrib.LineColor  = Color.FromArgb(int.Parse(lineXml.GetAttribute("color")));
        }
Example #18
0
        /// <summary>
        /// 保存当前按钮内容到xml文件中
        /// </summary>
        /// <param Name="xml">xml对象</param>
        override public void saveXML(SVXml xml)
        {
            XmlElement button = xml.createNode(this.GetType().Name);

            button.SetAttribute("id", _attrib.ID.ToString());
            button.SetAttribute("x", _attrib.Rect.X.ToString());
            button.SetAttribute("y", _attrib.Rect.Y.ToString());
            button.SetAttribute("width", _attrib.Rect.Width.ToString());
            button.SetAttribute("height", _attrib.Rect.Height.ToString());

            ///循环保存图片数组
            List <SVBitmap> list = _attrib.BitMapArray.imageArray();

            foreach (var item in list)
            {
                XmlElement picList = xml.crateChildNode("PIC");
                button.AppendChild(picList);

                picList.SetAttribute("Name", item.ShowName);
                picList.SetAttribute("File", item.ImageFileName);
            }
        }
Example #19
0
        /// <summary>
        /// 保存数据到xml文件中
        /// </summary>
        /// <param Name="xml">xml文件对象</param>
        override public void saveXML(SVXml xml)
        {
            XmlElement curve = xml.createNode(this.GetType().Name);

            curve.SetAttribute("ID", _attrib.ID.ToString());
            curve.SetAttribute("X", _attrib.Rect.X.ToString());
            curve.SetAttribute("Y", _attrib.Rect.Y.ToString());
            curve.SetAttribute("Width", _attrib.Rect.Width.ToString());
            curve.SetAttribute("Height", _attrib.Rect.Height.ToString());
            curve.SetAttribute("FrontColor", _attrib.FrontColor.ToArgb().ToString());
            curve.SetAttribute("BackgdColor", _attrib.BackgdColor.ToArgb().ToString());
            curve.SetAttribute("Interval", _attrib.Interval.ToString());
            curve.SetAttribute("Font", _attrib.Font.Name.ToString());
            curve.SetAttribute("FontSize", _attrib.Font.Size.ToString());
            curve.SetAttribute("Max", _attrib.Max.ToString());
            curve.SetAttribute("Min", _attrib.Min.ToString());

            curve.SetAttribute("Count", _attrib.Variable.Count.ToString());

            ///保存变量的字段
            foreach (var varTmp in _attrib.Variable)
            {
                XmlElement nameList = xml.crateChildNode("VarName");
                curve.AppendChild(nameList);
                nameList.SetAttribute("Value", varTmp.Var.VarName);

                XmlElement typeList = xml.crateChildNode("VarType");
                curve.AppendChild(typeList);
                typeList.SetAttribute("Value", varTmp.Var.VarBlockType.ToString());

                XmlElement colorList = xml.crateChildNode("VarColor");
                curve.AppendChild(colorList);
                colorList.SetAttribute("Value", varTmp.Color.ToArgb().ToString());

                XmlElement enableList = xml.crateChildNode("varEnabled");
                curve.AppendChild(enableList);
                enableList.SetAttribute("Value", varTmp.Enabled.ToString());
            }
        }
Example #20
0
        override public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            XmlElement icon = xml.CurrentElement;

            if (isCreate)
            {
                newID();
            }
            else
            {
                _attrib.ID = UInt16.Parse(icon.GetAttribute("ID"));
            }

            int x      = int.Parse(icon.GetAttribute("X"));
            int y      = int.Parse(icon.GetAttribute("Y"));
            int width  = int.Parse(icon.GetAttribute("Width"));
            int height = int.Parse(icon.GetAttribute("Height"));

            _attrib.Rect = new Rectangle(x, y, width, height);
            _attrib.PicIconData.ImageFileName = icon.GetAttribute("ImageFile");
            _attrib.PicIconData.ShowName      = icon.GetAttribute("ImageShowName");
        }
Example #21
0
        override public void saveXML(SVXml xml)
        {
            XmlElement binary = xml.createNode(this.GetType().Name);

            ///写入尺寸
            binary.SetAttribute("ID", _attrib.ID.ToString());
            binary.SetAttribute("X", _attrib.Rect.X.ToString());
            binary.SetAttribute("Y", _attrib.Rect.Y.ToString());
            binary.SetAttribute("Width", _attrib.Rect.Width.ToString());
            binary.SetAttribute("Height", _attrib.Rect.Height.ToString());

            ///写入变量
            binary.SetAttribute("Variable", _attrib.Variable.VarName);
            binary.SetAttribute("VarialeType", _attrib.Variable.VarBlockType.ToString());

            ///写入自定义名称
            binary.SetAttribute("CustomTrueText", _attrib.CustomTrueText);
            binary.SetAttribute("CustomFalseText", _attrib.CustomFlaseText);
            //binary.SetAttribute("CustomExText", _attrib.CustomExceptionText);

            ///图片
            binary.SetAttribute("TImageFile", _attrib.TruePicture.ImageFileName);
            binary.SetAttribute("TImageShowName", _attrib.TruePicture.ShowName);
            binary.SetAttribute("FImageFile", _attrib.FlasePicture.ImageFileName);
            binary.SetAttribute("FImageShowName", _attrib.FlasePicture.ShowName);
            binary.SetAttribute("EImageFile", _attrib.ExPicture.ImageFileName);
            binary.SetAttribute("EImageShowName", _attrib.ExPicture.ShowName);

            binary.SetAttribute("TrueColor", _attrib.TrueColor.ToArgb().ToString());
            binary.SetAttribute("TrueBgColor", _attrib.TrueBgColor.ToArgb().ToString());
            binary.SetAttribute("FalseColor", _attrib.FalseColor.ToArgb().ToString());
            binary.SetAttribute("FalseBgColor", _attrib.FalseBgColor.ToArgb().ToString());
            binary.SetAttribute("Font", _attrib.Font.Name.ToString());
            binary.SetAttribute("FontSize", _attrib.Font.Size.ToString());
            binary.SetAttribute("Type", _attrib.Type.ToString());
            binary.SetAttribute("ExceptionColor", _attrib.ExceptionColor.ToArgb().ToString());
            binary.SetAttribute("ExceptionBgColor", _attrib.ExceptionBgColor.ToArgb().ToString());
        }
Example #22
0
        /// <summary>
        /// 保存当前按钮内容到xml文件中
        /// </summary>
        /// <param Name="xml">xml对象</param>
        override public void saveXML(SVXml xml)
        {
            XmlElement button = xml.createNode(this.GetType().Name);

            button.SetAttribute("id", _attrib.ID.ToString());
            button.SetAttribute("x", _attrib.Rect.X.ToString());
            button.SetAttribute("y", _attrib.Rect.Y.ToString());
            button.SetAttribute("width", _attrib.Rect.Width.ToString());
            button.SetAttribute("height", _attrib.Rect.Height.ToString());
            button.SetAttribute("color", _attrib.FrontColorground.ToArgb().ToString());
            button.SetAttribute("backcolor", _attrib.BackColorground.ToArgb().ToString());
            button.SetAttribute("backgdcolor", _attrib.BackColorgroundDown.ToArgb().ToString());
            button.SetAttribute("text", _attrib.Text);
            button.SetAttribute("falseText", _attrib.FText);

            button.SetAttribute("font", _attrib.Font.Name.ToString());
            button.SetAttribute("fontSize", _attrib.Font.Size.ToString());
            button.SetAttribute("Confirm", _attrib.Comfirm.ToString());
            button.SetAttribute("ButtonType", _attrib.ButtonType.ToString());
            button.SetAttribute("ButtonTypeID", _attrib.ButtonPage.PageID.ToString());
            button.SetAttribute("ButtonTypeText", _attrib.ButtonPage.PageText);
            button.SetAttribute("ButtonTypeVar", _attrib.BtnVarText.VarName);
            button.SetAttribute("ButtonTypeVarType", _attrib.BtnVarText.VarBlockType.ToString());
            //按钮使能
            button.SetAttribute("Enabled", _attrib.BtnEnable.ToString());
            button.SetAttribute("EnabledVar", _attrib.EnVarText.VarName);
            button.SetAttribute("EnabledVarType", _attrib.EnVarText.VarBlockType.ToString());
            //按钮图片数据
            button.SetAttribute("IsShowPicture", _attrib.IsShowPic.ToString());
            button.SetAttribute("BtnDownPicFile", _attrib.BtnDownPic.ImageFileName);
            button.SetAttribute("BtnDownPicShowName", _attrib.BtnDownPic.ShowName);
            button.SetAttribute("BtnUpPicFile", _attrib.BtnUpPic.ImageFileName);
            button.SetAttribute("BtnUpPicShowName", _attrib.BtnUpPic.ShowName);
            //趋势图关联
            button.SetAttribute("CurveObj", _attrib.CurveObj);
        }
Example #23
0
        /*
         * 通过XML文件来加载页面控件对象
         *
         * xml - 一个页面对应的xml对象
         * isCreate - true: 创建新的ID号
         *            false: 直接使用文件中的ID号
         * */
        public void loadXML(SVXml xml, Boolean isCreate = false)
        {
            _redoUndo.setEnabled(false);

            XmlElement page = xml.CurrentElement;

            if (isCreate)
            {
                var instance = SVUniqueID.instance();
                _attrib.id = instance.newUniqueID();
                instance.saveFile();
            }
            else
            {
                _attrib.id = UInt16.Parse(page.GetAttribute("ID"));
            }

            try
            {
                XmlElement width = xml.select("Width");
                _attrib.Width = int.Parse(width.InnerText);

                XmlElement height = xml.select("Height");
                _attrib.Height = int.Parse(height.InnerText);

                XmlElement back = xml.select("Backcolor");
                _attrib.BackColor = Color.FromArgb(int.Parse(back.InnerText));

                XmlElement mainPage = xml.select("MainPage");
                _attrib.IsMainPage = Boolean.Parse(mainPage.InnerText);
                if (_attrib.IsMainPage)
                {
                    setToMainPageWidget();
                }

                XmlElement backGroundType = xml.select("BackGroundType");
                _attrib.BackGroundType = Byte.Parse(backGroundType.InnerText);

                XmlElement picShowName = xml.select("PicShowName");
                _attrib.PicIconData.ShowName = picShowName.InnerText;

                XmlElement picFile = xml.select("PicFile");
                _attrib.PicIconData.ImageFileName = picFile.InnerText;


                XmlElement alignMent = xml.select("alignment");
                _attrib.IsAlignment = Byte.Parse(alignMent.InnerText);
            }
            catch (Exception)
            {
            }

            //读取当前页面的所有子控件
            List <XmlElement> listNodes = xml.selectChilds();

            foreach (XmlElement node in listNodes)
            {
                SVPanel svPanel = SVNameToObject.getInstance(node.Name) as SVPanel;
                if (svPanel == null)
                {
                    continue;
                }

                svPanel.setRedoUndoObject(_redoUndo);
                svPanel.setParentID(_attrib.id);

                svPanel.MouseDown += new MouseEventHandler((sder, ev) =>
                {
                    MouseSelectEvent(sder, ev);
                });

                svPanel.MouseUp += new MouseEventHandler((sder, ev) =>
                {
                    MouseSelectEvent(sder, ev);
                });

                this.Controls.Add(svPanel);
                xml.CurrentElement = node;
                svPanel.loadXML(xml, isCreate);
                svPanel.refreshPropertyToPanel();
            }

            _redoUndo.setEnabled(true);
        }