Implement migration plan: models, service, MVVM, XAML layout, icons\n\n- Add Models: HistoryItem, VariableItem, FunctionDefinitionItem, IconFont\n- Add Services: ICalculatorService, CalculatorService wrapping interpreter\n- Update MainViewModel: properties and Submit/ToggleFunctions commands\n- Rebuild Views/MainView.axaml with variables, history, input, functions panel\n- Add BoolToGridLengthConverter for panel toggle\n- Wire Material Design Icons font as Avalonia resource in App.axaml/csproj
This commit is contained in:
parent
22f9043e50
commit
7b1912579f
11 changed files with 342 additions and 9 deletions
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia;
|
||||
|
||||
namespace AdvancedCalculator.Converters;
|
||||
|
||||
public class BoolToGridLengthConverter : IValueConverter
|
||||
{
|
||||
public static readonly BoolToGridLengthConverter Instance = new();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo? culture)
|
||||
{
|
||||
var isOpen = value is bool b && b;
|
||||
// Return star when true, otherwise zero pixels
|
||||
return isOpen ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo? culture)
|
||||
{
|
||||
if (value is GridLength gl)
|
||||
{
|
||||
return gl.Value > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue