示例#1
0
        private void SaveConfig(string fileName)
        {
            XmlSerializer ser = new XmlSerializer(typeof(HogKeysConfig), new Type[] { typeof(AnalogInput), typeof(ToggleSwitch), typeof(BinarySwitch), typeof(MultiSwitch), typeof(ToggleOutput) });

            using (var stream = File.Create(fileName))
            {
                HogKeysConfig saver = new HogKeysConfig();
                saver.Inputs  = (BindingList <Input>)pokeys.InputSource.List;
                saver.Outputs = (BindingList <Output>)pokeys.OutputSource.List;
                ser.Serialize(stream, saver);
            }
            MessageBox.Show("Items Saved");
        }
示例#2
0
 private void SaveConfig(string fileName)
 {
     XmlSerializer ser = new XmlSerializer(typeof(HogKeysConfig), new Type[] { typeof(AnalogInput), typeof(ToggleSwitch), typeof(BinarySwitch), typeof(MultiSwitch), typeof(ToggleOutput) });
     using (var stream = File.Create(fileName))
     {
         HogKeysConfig saver = new HogKeysConfig();
         saver.Inputs = (BindingList<Input>)pokeys.InputSource.List;
         saver.Outputs = (BindingList<Output>)pokeys.OutputSource.List;
         ser.Serialize(stream, saver);
     }
     MessageBox.Show("Items Saved");
 }