Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ protected override MauiApp CreateMauiApp() => ApplicationBuilder.Create()
{
handlers
.AddHandler<ExtendedSlider, ExtendedSliderHandler>()
.AddHandler<ColorImage, ColorImageHandler>()
;
})
.ConfigureContainer((containerBuilder) =>
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion BrickController2/BrickController2.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ protected override MauiApp CreateMauiApp() => ApplicationBuilder.Create()
{
handlers
.AddHandler<ExtendedSlider, ExtendedSliderHandler>()
.AddHandler<PageBase, CustomPageHandler>()
;

// handle swipe if there is no touch screen
Expand Down

This file was deleted.

This file was deleted.

30 changes: 14 additions & 16 deletions BrickController2/BrickController2/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@
<Setter Property="TextColor" Value="{DynamicResource NavigationBarItemColor}"/>
<Setter Property="FontSize" Value="Large"/>
</Style>

<Style x:Key="NavigationBarImageButtonStyle" TargetType="controls:ImageButton">
<Setter Property="WidthRequest" Value="30"/>
<Setter Property="HeightRequest" Value="30"/>
<Setter Property="ImageColor" Value="{DynamicResource NavigationBarItemColor}"/>
</Style>

<!-- Header bar -->

Expand All @@ -83,12 +77,6 @@
<Setter Property="ColumnSpacing" Value="6"/>
</Style>

<Style x:Key="HeaderBarImageButtonStyle" TargetType="controls:ImageButton">
<Setter Property="WidthRequest" Value="30"/>
<Setter Property="HeightRequest" Value="30"/>
<Setter Property="ImageColor" Value="{DynamicResource HeaderItemColor}"/>
</Style>

<!-- Footer bar -->

<Style x:Key="FooterGridStyle" TargetType="Grid">
Expand Down Expand Up @@ -172,12 +160,22 @@

<!-- Floating button styles -->
<Style x:Key="FloatingActionButtonStyle" TargetType="controls:FloatingActionButton">
<Setter Property="ButtonColor" Value="{DynamicResource FloatingButtonColor}"/>
<Setter Property="ImageColor" Value="{DynamicResource PrimaryTextColor}"/>
<Setter Property="BackgroundColor" Value="{DynamicResource FloatingButtonColor}"/>
<Setter Property="ImageColor" Value="{DynamicResource NavigationBarItemColor}"/>
<Setter Property="Aspect" Value="Center"/>
<Setter Property="CornerRadius" Value="25"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="HeightRequest" Value="50"/>
<Setter Property="WidthRequest" Value="50"/>
</Style>
<Style x:Key="InlineActionButtonStyle" TargetType="controls:FloatingActionButton">
<Setter Property="ButtonColor" Value="{DynamicResource InlineButtonColor}"/>
<Setter Property="ImageColor" Value="{DynamicResource PrimaryTextColor}"/>
<Setter Property="BackgroundColor" Value="{DynamicResource InlineButtonColor}"/>
<Setter Property="ImageColor" Value="{DynamicResource NavigationBarItemColor}"/>
<Setter Property="Aspect" Value="Center"/>
<Setter Property="CornerRadius" Value="23"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="HeightRequest" Value="46"/>
<Setter Property="WidthRequest" Value="46"/>
</Style>

<!-- Misc -->
Expand Down
5 changes: 5 additions & 0 deletions BrickController2/BrickController2/BrickController2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<EmbeddedResource Include="UI\Images\*.png" />
</ItemGroup>

<ItemGroup>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" />
Expand Down
5 changes: 5 additions & 0 deletions BrickController2/BrickController2/DI/ApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public static MauiAppBuilder Create()
return builder
// configure BC2 app
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
// source: https://github.com/google/material-design-icons/blob/master/font/MaterialIconsOutlined-Regular.otf
fonts.AddFont("MaterialIconsOutlined-Regular", "Icons");
})
// configure other common dependencies if needed
;
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<data name="AdvancedSettings" xml:space="preserve">
<value>Advanced settings</value>
</data>
<data name="ApplyChanges" xml:space="preserve">
<value>Apply changes</value>
</data>
<data name="AreYouSureToDeleteControllerAction" xml:space="preserve">
<value>Are you sure to delete this controller action?</value>
</data>
Expand Down Expand Up @@ -315,6 +318,15 @@
<data name="ErrorDuringScanning" xml:space="preserve">
<value>Error during scanning</value>
</data>
<data name="ExportControllerProfile" xml:space="preserve">
<value>Export the controller profile</value>
</data>
<data name="ExportCreation" xml:space="preserve">
<value>Export the creation</value>
</data>
<data name="ExportSequence" xml:space="preserve">
<value>Export the sequence</value>
</data>
<data name="ExportSuccessful" xml:space="preserve">
<value>Export successful:</value>
</data>
Expand Down Expand Up @@ -348,6 +360,15 @@
<data name="IconSet" xml:space="preserve">
<value>Icon set</value>
</data>
<data name="ImportControllerProfile" xml:space="preserve">
<value>Import a controller profile</value>
</data>
<data name="ImportCreation" xml:space="preserve">
<value>Import a creation</value>
</data>
<data name="ImportSequence" xml:space="preserve">
<value>Import a sequence</value>
</data>
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
Expand Down
14 changes: 14 additions & 0 deletions BrickController2/BrickController2/UI/Commands/CommandExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Windows.Input;

namespace BrickController2.UI.Commands;

internal static class CommandExtensions
{
internal static void RaiseCanExecuteChanged(this ICommand command)
{
if (command is IExtendableCommand cmd)
{
cmd.RaiseCanExecuteChanged();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Windows.Input;

namespace BrickController2.UI.Commands;

internal interface IExtendableCommand
{
void RaiseCanExecuteChanged();
}
12 changes: 5 additions & 7 deletions BrickController2/BrickController2/UI/Commands/SafeCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Input;

namespace BrickController2.UI.Commands
{
public class SafeCommand : ICommand
public class SafeCommand : ICommand, IExtendableCommand
{
private readonly Func<object, Task> _execute;
private readonly Predicate<object> _canExecute;
Expand Down Expand Up @@ -58,13 +56,13 @@ public async void Execute(object parameter)
}
}

private void RaiseCanExecuteChanged()
public void RaiseCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}

public class SafeCommand<TExecute> : ICommand
public class SafeCommand<TExecute> : ICommand, IExtendableCommand
{
private readonly Func<TExecute, Task> _execute;
private readonly Predicate<object> _canExecute;
Expand Down Expand Up @@ -106,7 +104,7 @@ public async void Execute(object parameter)
}
}

private void RaiseCanExecuteChanged()
public void RaiseCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
Expand Down
6 changes: 5 additions & 1 deletion BrickController2/BrickController2/UI/Controls/CheckBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<Border x:Name="UncheckedShape" WidthRequest="25" HeightRequest="25" VerticalOptions="Center" HorizontalOptions="Center" Padding="1" StrokeShape="RoundRectangle 12" Stroke="{DynamicResource SecondaryColor}" BackgroundColor="{DynamicResource PageBackgroundColor}">
</Border>
<Border x:Name="CheckedShape" WidthRequest="25" HeightRequest="25" VerticalOptions="Center" HorizontalOptions="Center" Padding="1" StrokeShape="RoundRectangle 12" BackgroundColor="{DynamicResource CheckBoxCheckedColor}">
<controls:ColorImage Source="{extensions:ImageResource Source=ic_checkmark.png}" Color="{DynamicResource PageBackgroundColor}" WidthRequest="20" HeightRequest="20" HorizontalOptions="Center" VerticalOptions="Center"/>
<Image>
<Image.Source>
<FontImageSource Color="{DynamicResource PageBackgroundColor}" FontFamily="Icons" Glyph="check"/>
</Image.Source>
</Image>
</Border>
</Grid>
</ContentView.Content>
Expand Down
14 changes: 0 additions & 14 deletions BrickController2/BrickController2/UI/Controls/ColorImage.cs

This file was deleted.

10 changes: 10 additions & 0 deletions BrickController2/BrickController2/UI/Controls/ColorImage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Image
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:BrickController2.UI.Controls"
x:Class="BrickController2.UI.Controls.ColorImage">
<Image.Source>
<FontImageSource x:Name="ImageSource" FontFamily="Icons" />
</Image.Source>
</Image>
Loading