コード例 #1
0
        private void SettingsCommand(object sender, ExecutedRoutedEventArgs e)
        {
            var settings  = FlasherConfig.Read();
            var oldDevice = settings.Device.Name;
            var dlg       = new SettingsWindow {
                DataContext = settings,
                Owner       = this
            };

            if (dlg.ShowDialog() ?? false)
            {
                settings.Save();
                if (settings.Device.Name != oldDevice)
                {
                    Model.ClearAll();
                }
                Model.ReloadConfig();
            }
        }
コード例 #2
0
 private StatisticsChannel OpenChannel()
 {
     lock (_channelSync) {
         try {
             if (_channel == null)
             {
                 _channel = new StatisticsChannel(FlasherConfig.Read().GetProgrammerConfig().CreateChannel());
             }
             if (!_channel.IsOpen)
             {
                 _channel.Open();
             }
             return(_channel);
         } catch (Exception) {
             CloseChannel();
             return(null);
         }
     }
 }