public void LoadButtons(string filename)
        {
            buttonGroup = ButtonGroup.FromFile(filename);

            foreach (ControlMap map in buttonGroup.Buttons)
            {
                AddButton(map);
            }
        }
示例#2
0
        public static ButtonGroup FromFile(string filename)
        {
            ButtonGroup group = new ButtonGroup();

            if (File.Exists(filename))
            {
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(ButtonGroup));
                    FileStream fs = new FileStream(filename, FileMode.Open);

                    group = (ButtonGroup)serializer.Deserialize(fs);

                    fs.Close();
                }
                catch
                {
                }
            }
            group.LoadFilename = filename;
            return group;
        }