Пример #1
0
        public ButtonSettingDialog(ButtonSettingEntity btnSetting)
        {
            InitializeComponent();


            this.ButtonSetting = btnSetting;

            this.numUpDownColumn.Value = this.ButtonSetting.ColumnCount;
            this.numUpDownRow.Value    = this.ButtonSetting.RowCount;
            this.numUpDownWidth.Value  = this.ButtonSetting.Width;
            this.numUpDownHeight.Value = this.ButtonSetting.Height;
        }
Пример #2
0
        protected override void OnAcceptClick(object sender, EventArgs e)
        {
            this.ButtonSetting =
                new ButtonSettingEntity
            {
                ColumnCount = int.Parse(this.numUpDownColumn.Value.ToString()),
                RowCount    = int.Parse(this.numUpDownRow.Value.ToString()),
                Width       = int.Parse(this.numUpDownWidth.Value.ToString()),
                Height      = int.Parse(this.numUpDownHeight.Value.ToString())
            };

            base.OnAcceptClick(this, e);
        }
Пример #3
0
        public void ReadXmlProfile(string filePath)
        {
            XmlDocument xd = new XmlDocument();

            try
            {
                this.PageData   = new List <PageEntity>();
                this.ButtonData = new List <ButtonEntity>();

                if (File.Exists(filePath))
                {
                    xd.Load(filePath);
                }

                XmlNodeList pageNodes      = xd.SelectNodes("/Profile/PageData/Page");
                XmlNodeList btnNodes       = xd.SelectNodes("/Profile/ButtonData/Button");
                XmlNode     btnSettingNode = xd.SelectSingleNode("/Profile/ButtonSetting");


                if (pageNodes != null)
                {
                    foreach (XmlNode node in pageNodes)
                    {
                        string Name  = GetSingleNodeInnerText(node, "./Name");
                        int    Index = 0;
                        int.TryParse(GetSingleNodeInnerText(node, "./Index"), out Index);
                        this.PageData.Add(
                            new PageEntity
                        {
                            Name  = Name,
                            Index = Index
                        }
                            );
                    }
                }


                if (btnNodes != null)
                {
                    foreach (XmlNode node in btnNodes)
                    {
                        string DataPath = GetSingleNodeInnerText(node, "./DataPath");
                        string DataName = GetSingleNodeInnerText(node, "./DataName");

                        int PageIndex = 0;
                        int.TryParse(GetSingleNodeInnerText(node, "./PageIndex"), out PageIndex);
                        int ColumnIndex = 0;
                        int.TryParse(GetSingleNodeInnerText(node, "./ColumnIndex"), out ColumnIndex);
                        int RowIndex = 0;
                        int.TryParse(GetSingleNodeInnerText(node, "./RowIndex"), out RowIndex);
                        this.ButtonData.Add(
                            new ButtonEntity
                        {
                            PageIndex   = PageIndex,
                            ColumnIndex = ColumnIndex,
                            RowIndex    = RowIndex,
                            DataPath    = DataPath,
                            DataName    = DataName
                        });
                    }
                }

                int ColumnCount = 10;
                int RowCount    = 10;
                int Height      = 32;
                int Width       = 32;

                if (btnSettingNode != null)
                {
                    int.TryParse(GetSingleNodeInnerText(btnSettingNode, "./ColumnCount"), out ColumnCount);
                    int.TryParse(GetSingleNodeInnerText(btnSettingNode, "./RowCount"), out RowCount);
                    int.TryParse(GetSingleNodeInnerText(btnSettingNode, "./Height"), out Height);
                    int.TryParse(GetSingleNodeInnerText(btnSettingNode, "./Width"), out Width);
                }

                this.ButtonSetting = new ButtonSettingEntity
                {
                    ColumnCount = ColumnCount,
                    RowCount    = RowCount,
                    Height      = Height,
                    Width       = Width,
                };
            }
            catch (XmlException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }