mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.338
This commit is contained in:
parent
573fe77e12
commit
0468955d49
751 changed files with 62747 additions and 60672 deletions
|
@ -9,102 +9,102 @@ using Xamarin.Forms.Xaml;
|
|||
|
||||
namespace ShareeSharedGuiLib.View
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class BarLevelInputView : ContentView
|
||||
{
|
||||
private BarLevelInputViewModel _LocalViewModel;
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class BarLevelInputView : ContentView
|
||||
{
|
||||
private BarLevelInputViewModel _LocalViewModel;
|
||||
|
||||
public BarLevelInputView()
|
||||
{
|
||||
InitializeComponent();
|
||||
public BarLevelInputView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_LocalViewModel = new BarLevelInputViewModel();
|
||||
_LocalViewModel = new BarLevelInputViewModel();
|
||||
|
||||
_LocalViewModel.PropertyChanged += (sender, args) =>
|
||||
{
|
||||
// Update Current property from view model on user input.
|
||||
if (args.PropertyName != nameof(BarLevelInputViewModel.Current))
|
||||
return;
|
||||
_LocalViewModel.PropertyChanged += (sender, args) =>
|
||||
{
|
||||
// Update Current property from view model on user input.
|
||||
if (args.PropertyName != nameof(BarLevelInputViewModel.Current))
|
||||
return;
|
||||
|
||||
var viewModel = sender as BarLevelInputViewModel;
|
||||
Current = viewModel?.Current != null
|
||||
? viewModel?.Current.Value.ToString()
|
||||
: String.Empty;
|
||||
};
|
||||
var viewModel = sender as BarLevelInputViewModel;
|
||||
Current = viewModel?.Current != null
|
||||
? viewModel?.Current.Value.ToString()
|
||||
: String.Empty;
|
||||
};
|
||||
|
||||
// Do not bind entire control to local view model. Doing this would break binding of BatteryView control.
|
||||
this.BarLevelElement.BindingContext = _LocalViewModel;
|
||||
this.BarLevelStepper.BindingContext = _LocalViewModel;
|
||||
}
|
||||
// Do not bind entire control to local view model. Doing this would break binding of BatteryView control.
|
||||
this.BarLevelElement.BindingContext = _LocalViewModel;
|
||||
this.BarLevelStepper.BindingContext = _LocalViewModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Maximum"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty MaximumProperty = BindableProperty.Create(
|
||||
"Maximum",
|
||||
typeof(string),
|
||||
typeof(BarLevelInputView),
|
||||
"7",
|
||||
propertyChanged: OnMaximumChanged);
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Maximum"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty MaximumProperty = BindableProperty.Create(
|
||||
"Maximum",
|
||||
typeof(string),
|
||||
typeof(BarLevelInputView),
|
||||
"7",
|
||||
propertyChanged: OnMaximumChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent charing level full.
|
||||
/// </summary>
|
||||
public string Maximum
|
||||
{
|
||||
get => (string)GetValue(MaximumProperty);
|
||||
set => SetValue(MaximumProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent charing level full.
|
||||
/// </summary>
|
||||
public string Maximum
|
||||
{
|
||||
get => (string)GetValue(MaximumProperty);
|
||||
set => SetValue(MaximumProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnMaximumChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelInputView;
|
||||
batteryView?.SetMaximum(int.TryParse(newValue.ToString(), out int maximum) ? (int?)maximum : null);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnMaximumChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelInputView;
|
||||
batteryView?.SetMaximum(int.TryParse(newValue.ToString(), out int maximum) ? (int?)maximum : null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMaximum(int? maximum) => _LocalViewModel.Maximum = maximum;
|
||||
public void SetMaximum(int? maximum) => _LocalViewModel.Maximum = maximum;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Current"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty CurrentProperty = BindableProperty.Create(
|
||||
"Current",
|
||||
typeof(string),
|
||||
typeof(BarLevelInputView),
|
||||
"7",
|
||||
BindingMode.TwoWay,
|
||||
propertyChanged: OnCurrentChanged);
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Current"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty CurrentProperty = BindableProperty.Create(
|
||||
"Current",
|
||||
typeof(string),
|
||||
typeof(BarLevelInputView),
|
||||
"7",
|
||||
BindingMode.TwoWay,
|
||||
propertyChanged: OnCurrentChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent the current charing level.
|
||||
/// </summary>
|
||||
public string Current
|
||||
{
|
||||
get => (string)GetValue(CurrentProperty);
|
||||
set => SetValue(CurrentProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent the current charing level.
|
||||
/// </summary>
|
||||
public string Current
|
||||
{
|
||||
get => (string)GetValue(CurrentProperty);
|
||||
set => SetValue(CurrentProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnCurrentChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelInputView;
|
||||
int current;
|
||||
batteryView?.SetCurrent(int.TryParse(newValue.ToString(), out current) ? (int?)current : null);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnCurrentChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelInputView;
|
||||
int current;
|
||||
batteryView?.SetCurrent(int.TryParse(newValue.ToString(), out current) ? (int?)current : null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrent(int? current) => _LocalViewModel.Current = current;
|
||||
public void SetCurrent(int? current) => _LocalViewModel.Current = current;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,86 +9,86 @@ using Xamarin.Forms.Xaml;
|
|||
|
||||
namespace ShareeSharedGuiLib.View
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class BarLevelView : ContentView
|
||||
{
|
||||
private BarLevelViewModel _LocalViewModel = new BarLevelViewModel();
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class BarLevelView : ContentView
|
||||
{
|
||||
private BarLevelViewModel _LocalViewModel = new BarLevelViewModel();
|
||||
|
||||
public BarLevelView()
|
||||
{
|
||||
InitializeComponent();
|
||||
public BarLevelView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Do not bind entire control to local view model. Doing this would break binding of BatteryView control.
|
||||
this.BarLevelLabel.BindingContext = _LocalViewModel;
|
||||
this.BarLevelImage.BindingContext = _LocalViewModel;
|
||||
}
|
||||
// Do not bind entire control to local view model. Doing this would break binding of BatteryView control.
|
||||
this.BarLevelLabel.BindingContext = _LocalViewModel;
|
||||
this.BarLevelImage.BindingContext = _LocalViewModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Maximum"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty MaximumProperty = BindableProperty.Create(
|
||||
"Maximum",
|
||||
typeof(string),
|
||||
typeof(BarLevelView),
|
||||
"", // Default value must match default value of view model object. Otherwise there might be an update issue.
|
||||
propertyChanged: OnMaximumChanged);
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Maximum"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty MaximumProperty = BindableProperty.Create(
|
||||
"Maximum",
|
||||
typeof(string),
|
||||
typeof(BarLevelView),
|
||||
"", // Default value must match default value of view model object. Otherwise there might be an update issue.
|
||||
propertyChanged: OnMaximumChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent charing level full.
|
||||
/// </summary>
|
||||
public string Maximum
|
||||
{
|
||||
get => (string)GetValue(MaximumProperty);
|
||||
set => SetValue(MaximumProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent charing level full.
|
||||
/// </summary>
|
||||
public string Maximum
|
||||
{
|
||||
get => (string)GetValue(MaximumProperty);
|
||||
set => SetValue(MaximumProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnMaximumChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelView;
|
||||
batteryView?.SetMaximum(int.TryParse(newValue.ToString(), out int maximum) ? (int?)maximum : null);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnMaximumChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelView;
|
||||
batteryView?.SetMaximum(int.TryParse(newValue.ToString(), out int maximum) ? (int?)maximum : null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMaximum(int? maximum) => _LocalViewModel.Maximum = maximum;
|
||||
public void SetMaximum(int? maximum) => _LocalViewModel.Maximum = maximum;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Current"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty CurrentProperty = BindableProperty.Create(
|
||||
"Current",
|
||||
typeof(string),
|
||||
typeof(BarLevelView),
|
||||
"", // Default value must match default value of view model object. Otherwise there might be an update issue.
|
||||
propertyChanged: OnCurrentChanged);
|
||||
/// <summary>
|
||||
/// Create bindable property to to allow "Current"- proptery to act as a valid target for data binding.
|
||||
/// </summary>
|
||||
public static readonly BindableProperty CurrentProperty = BindableProperty.Create(
|
||||
"Current",
|
||||
typeof(string),
|
||||
typeof(BarLevelView),
|
||||
"", // Default value must match default value of view model object. Otherwise there might be an update issue.
|
||||
propertyChanged: OnCurrentChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent the current charing level.
|
||||
/// </summary>
|
||||
public string Current
|
||||
{
|
||||
get => (string)GetValue(CurrentProperty);
|
||||
set => SetValue(CurrentProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the count of bars wich represent the current charing level.
|
||||
/// </summary>
|
||||
public string Current
|
||||
{
|
||||
get => (string)GetValue(CurrentProperty);
|
||||
set => SetValue(CurrentProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnCurrentChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelView;
|
||||
int current;
|
||||
batteryView?.SetCurrent(int.TryParse(newValue.ToString(), out current) ? (int?)current : null);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notifies when value changes. Is required to make binding work.
|
||||
/// </summary>
|
||||
static void OnCurrentChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (newValue != oldValue)
|
||||
{
|
||||
var batteryView = bindable as BarLevelView;
|
||||
int current;
|
||||
batteryView?.SetCurrent(int.TryParse(newValue.ToString(), out current) ? (int?)current : null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrent(int? current) => _LocalViewModel.Current = current;
|
||||
}
|
||||
public void SetCurrent(int? current) => _LocalViewModel.Current = current;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue