Exemplo n.º 1
0
 private void PasteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var xml = Clipboard.GetText();
         var ps  = JocysCom.ClassLibrary.Runtime.Serializer.DeserializeFromXmlString <PadSetting>(xml);
         _PadSetting.Load(ps);
     }
     catch (Exception ex)
     {
         var form = new MessageBoxWindow();
         ControlsHelper.CheckTopMost(form);
         form.ShowDialog(ex.Message);
         return;
     }
 }
Exemplo n.º 2
0
        public void SavePadSetting(UserSetting setting, PadSetting padSetting)
        {
            var ps = new PadSetting();

            ps.Load(padSetting);
            // If setting doesn't exists then...
            if (!PadSettings.Items.Any(x => x.PadSettingChecksum == ps.PadSettingChecksum))
            {
                // Add setting to configuration.
                lock (PadSettings.SyncRoot)
                    PadSettings.Items.Add(ps);
            }
            // If pad setting checksum changed then...
            if (setting.PadSettingChecksum != ps.PadSettingChecksum)
            {
                // Assign updated checksum.
                setting.PadSettingChecksum = ps.PadSettingChecksum;
                var ud = GetDevice(setting.InstanceGuid);
                setting.Completion = UserSetting.GetCompletionPoints(ps, ud);
            }
            CleanupPadSettings();
        }