123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- namespace ConfigFileManager.Controls;
- /// <summary>
- /// Interaction logic for ConfigFilePlot.xaml
- /// </summary>
- public partial class ConfigFilePlot : UserControl
- {
- public ConfigFilePlot()
- {
- InitializeComponent();
- this.UpdateBar.Visibility = Visibility.Collapsed;
- }
- public DeviceInfo_VM DeviceInfo
- {
- get { return (DeviceInfo_VM)GetValue(DeviceInfoProperty); }
- set { SetValue(DeviceInfoProperty, value); }
- }
- public static readonly DependencyProperty DeviceInfoProperty =
- DependencyProperty.Register("DeviceInfo", typeof(DeviceInfo_VM), typeof(ConfigFilePlot), new PropertyMetadata(default));
- public ICommand UpdateCommand
- {
- get { return (ICommand)GetValue(UpdateCommandProperty); }
- set { SetValue(UpdateCommandProperty, value); }
- }
- public static readonly DependencyProperty UpdateCommandProperty =
- DependencyProperty.Register("UpdateCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
- public ICommand MigrateCommand
- {
- get { return (ICommand)GetValue(MigrateCommandProperty); }
- set { SetValue(MigrateCommandProperty, value); }
- }
- public static readonly DependencyProperty MigrateCommandProperty =
- DependencyProperty.Register("MigrateCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
- public ICommand CheckRecipeCommand
- {
- get { return (ICommand)GetValue(CheckRecipeCommandProperty); }
- set { SetValue(CheckRecipeCommandProperty, value); }
- }
- public static readonly DependencyProperty CheckRecipeCommandProperty =
- DependencyProperty.Register("CheckRecipeCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
- public ICommand CheckConfigCommand
- {
- get { return (ICommand)GetValue(CheckConfigCommandProperty); }
- set { SetValue(CheckConfigCommandProperty, value); }
- }
- public static readonly DependencyProperty CheckConfigCommandProperty =
- DependencyProperty.Register("CheckConfigCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
- public bool IsUpdate
- {
- get { return (bool)GetValue(IsUpdateProperty); }
- set { SetValue(IsUpdateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for IsUpdate. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsUpdateProperty =
- DependencyProperty.Register("IsUpdate", typeof(bool), typeof(ConfigFilePlot), new PropertyMetadata(false, IsUpdatingChangedCallback));
- private static void IsUpdatingChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (d is not ConfigFilePlot plot)
- return;
- if (e.NewValue is not bool updateStaus)
- return;
- switch (updateStaus)
- {
- case true:
- plot.UpdateBar.Visibility = Visibility.Visible;
- plot.ConfigButton.IsEnabled = false;
- plot.RecipeButton.IsEnabled = false;
- plot.MigrateButton.IsEnabled = false;
- break;
- case false:
- plot.UpdateBar.Visibility = Visibility.Collapsed;
- plot.ConfigButton.IsEnabled = true;
- plot.RecipeButton.IsEnabled = true;
- plot.MigrateButton.IsEnabled = true;
- break;
- }
- plot.UpdateBar.Visibility = updateStaus switch
- {
- true => Visibility.Visible,
- false => Visibility.Collapsed
- };
- }
- }
|