SharedMauiCoreLibrary 1.0.0-alpha
See the version list below for details.
dotnet add package SharedMauiCoreLibrary --version 1.0.0-alpha
NuGet\Install-Package SharedMauiCoreLibrary -Version 1.0.0-alpha
<PackageReference Include="SharedMauiCoreLibrary" Version="1.0.0-alpha" />
paket add SharedMauiCoreLibrary --version 1.0.0-alpha
#r "nuget: SharedMauiCoreLibrary, 1.0.0-alpha"
// Install SharedMauiCoreLibrary as a Cake Addin #addin nuget:?package=SharedMauiCoreLibrary&version=1.0.0-alpha&prerelease // Install SharedMauiCoreLibrary as a Cake Tool #tool nuget:?package=SharedMauiCoreLibrary&version=1.0.0-alpha&prerelease
SharedMauiCoreLibrary
A shared library containing recurring features & utilities for .NET MAUI applications
Available content
Please find a list of available content below.
Behaviors
Namespace
xmlns:behaviors="clr-namespace:AndreasReitberger.Shared.Core.Behaviors;assembly=SharedMauiCoreLibrary"
EventToCommandBehavior
This Behavior
executes a Command
when the specified Event
is fired.
<sliders:SfSlider
Margin="0,4"
Minimum="0" Maximum="{Binding LimitFan}"
StepSize="1"
MinorTicksPerInterval="100"
ShowLabels="True"
>
<sliders:SfSlider.Behaviors>
<behaviors:EventToCommandBehavior
EventName="ValueChangeEnd"
Command="{Binding SetFanCommand}"
/>
</sliders:SfSlider.Behaviors>
</sliders:SfSlider>
Converters
Namespace
xmlns:converters="clr-namespace:AndreasReitberger.Shared.Core.Converters;assembly=SharedMauiCoreLibrary"
BooleanReverseVisibilityConverter & BooleanVisibilityConverter
This Converter
converts a Boolean
into a reverse and non-reverse visibility (if value
is true
, it returns false
)
<Label
Style="{StaticResource SmallLabelStyle}"
TextColor="{DynamicResource Error}"
Text="{x:Static localization:Strings.NotAvailableDots}"
IsVisible="{Binding HasDoubleExtruder, Converter={StaticResource BooleanReverseVisibilityConverter}}"
/>
ByteArrayToImageConverter
This Converter
converts a byte[]
into an Image
<Image
VerticalOptions="Start"
Margin="{OnIdiom Phone='-4,0', Tablet='-62,0', Default='-4,0'}"
Source="{Binding Thumbnail, Converter={StaticResource ByteArrayToImageConverter}}"
>
<Image.Style>
<Style TargetType="Image">
<Setter Property="Aspect" Value="AspectFit"/>
<Style.Triggers>
<DataTrigger
TargetType="Image"
Binding="{Binding IsPortrait}"
Value="False">
<Setter Property="Aspect" Value="AspectFill"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
ColorToBlackWhiteConverter
This Converter
converts a Color
into Colors.White
or Colors.Black
. This helps to get the
accurate oreground
for a colored Background
.
<Border
BackgroundColor="{Binding HexCode, Converter={StaticResource StringToColorConverter}, Mode=OneWay}"
>
<Label
Text="{Binding HexCode}"
TextColor="{Binding Source={RelativeSource AncestorType={x:Type Border}}, Path=BackgroundColor, Converter={StaticResource ColorToBlackWhiteConverter}, Mode=OneWay}"
Style="{StaticResource LabelStyle}"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
/>
</Border>
DoubleHoursToTimeSpanConverter
This Converter
converts a Double
into a TimeSpan
.
<Label
LineBreakMode="WordWrap" Margin="2,10,0,10"
VerticalTextAlignment="Center"
FontSize="{OnIdiom Tablet=14, Default=12}"
>
<Label.Style>
<Style TargetType="Label" BasedOn="{StaticResource TitleViewHeadlineLabelStyle}">
<Setter Property="IsVisible" Value="False"/>
<Style.Triggers>
<MultiTrigger
TargetType="Label">
<MultiTrigger.Conditions>
<BindingCondition Binding="{Binding IsPrinting, Mode=TwoWay}" Value="True"/>
<BindingCondition Binding="{Binding ShowRemainingPrintTimeInTitleView}" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="IsVisible" Value="True"/>
</MultiTrigger>
</Style.Triggers>
</Style>
</Label.Style>
<Label.FormattedText>
<FormattedString>
<Span Text="("/>
<Span Text="{Binding RemainingPrintTime, Converter={StaticResource DoubleHoursToTimeSpanConverter}}"/>
<Span Text=")"/>
</FormattedString>
</Label.FormattedText>
</Label>
DoubleHoursToTimeSpanConverter
This Converter
converts a List<string>
into a single String
with the defined separator char.
LongToGigaByteConverter
This Converter
converts a long
into a Double
. The result wil be in GigaBytes.
LongToMegaByteConverter
This Converter
converts a long
into a Double
. The result wil be in MegaBytes.
StringToColorConverter
This Converter
converts a String
(hex formated string) into a Color
.
UnixDateToDateTimeConverter
This Converter
converts a Double
(UNIX based) into a DateTime
.
<Label
LineBreakMode="WordWrap" Margin="2,10,0,10"
VerticalTextAlignment="Center"
FontSize="{OnIdiom Tablet=14, Default=12}"
>
<Label.FormattedText>
<FormattedString>
<Span Text="("/>
<Span Text="{Binding CurrentDateTime, Converter={StaticResource UnixDateToDateTimeConverter}}"/>
<Span Text=")"/>
</FormattedString>
</Label.FormattedText>
</Label>
UnixDoubleHoursToTimeSpanConverter
This Converter
converts a Double
(UNIX based) into a TimeSpan
.
<Label
LineBreakMode="WordWrap" Margin="2,10,0,10"
VerticalTextAlignment="Center"
FontSize="{OnIdiom Tablet=14, Default=12}"
>
<Label.FormattedText>
<FormattedString>
<Span Text="("/>
<Span Text="{Binding RemainingPrintTime, Converter={StaticResource UnixDoubleHoursToTimeSpanConverter}}"/>
<Span Text=")"/>
</FormattedString>
</Label.FormattedText>
</Label>
UriToStringConverter
This Converter
converts a Uri
into a String
.
Helpers
Namespace
namespace AndreasReitberger.Shared.Core
ViewModelBase
This Class
contains all needed properties for a ViewModel. You can inherit from this Class directly for your ViewModel,
or create an own ViewModelBase and inherit there form this class.
public partial class BaseViewModel : ViewModelBase
{
#region Properties
#region App
bool _isBeta = SettingsStaticDefault.App_IsBeta;
public new bool IsBeta
{
get { return _isBeta; }
set { SetProperty(ref _isBeta, value); }
}
bool _isLightVersion = SettingsStaticDefault.App_IsLightVersion;
public bool IsLightVersion
{
get { return _isLightVersion; }
set { SetProperty(ref _isLightVersion, value); }
}
bool _isTabletMode = false;
public bool IsTabletMode
{
get { return _isTabletMode; }
set { SetProperty(ref _isTabletMode, value); }
}
#endregion
#region Navigation
bool _isViewShown = false;
public bool IsViewShown
{
get { return _isViewShown; }
set { SetProperty(ref _isViewShown, value); }
}
#endregion
#region Connection
bool _isConnecting = false;
public bool IsConnecting
{
get { return _isConnecting; }
set { SetProperty(ref _isConnecting, value); }
}
#endregion
#endregion
#region Constructor
public BaseViewModel()
{
}
#endregion
#region LiveCycle
public void OnDisappearing()
{
try
{
if (SettingsApp.SettingsChanged)
{
// Notify other modules
MessagingCenter.Send(new AppMessageInfo(), AppMessages.OnSettingsChanged.ToString());
SettingsApp.SaveSettings();
SettingsApp.SettingsChanged = false;
}
}
catch (Exception exc)
{
// Log error
EventManager.Instance.LogError(exc);
}
}
#endregion
}
JsonConvertHelper
This Class
uses Newtonsoft.JSON in order to serialize and deserialize objects to strings and vice reverse.
This is helpful if you want to store Collections or custom objects in the MAUI.Preferences (Settings).
// Convert to a String
SettingsApp.WebCam_DefaultWebCamSettings = JsonConvertHelper.ToSettingsString(value);
// Convert back to an object
ObservableCollection<KlipperWebCamSettingsInfo> webcams = JsonConvertHelper.ToObject(SettingsApp.WebCam_Settings, new ObservableCollection<KlipperWebCamSettingsInfo>());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-android31.0 is compatible. net6.0-ios was computed. net6.0-ios15.4 is compatible. net6.0-maccatalyst was computed. net6.0-maccatalyst15.4 is compatible. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows10.0.19041 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Maui.Dependencies (>= 6.0.400)
- Microsoft.Maui.Extensions (>= 6.0.400)
- Newtonsoft.Json (>= 13.0.1)
-
net6.0-android31.0
- Microsoft.Maui.Dependencies (>= 6.0.400)
- Microsoft.Maui.Extensions (>= 6.0.400)
- Newtonsoft.Json (>= 13.0.1)
-
net6.0-ios15.4
- Microsoft.Maui.Dependencies (>= 6.0.400)
- Microsoft.Maui.Extensions (>= 6.0.400)
- Newtonsoft.Json (>= 13.0.1)
- System.Runtime.InteropServices.NFloat.Internal (>= 6.0.1)
-
net6.0-maccatalyst15.4
- Microsoft.Maui.Dependencies (>= 6.0.400)
- Microsoft.Maui.Extensions (>= 6.0.400)
- Newtonsoft.Json (>= 13.0.1)
- System.Runtime.InteropServices.NFloat.Internal (>= 6.0.1)
-
net6.0-windows10.0.19041
- Microsoft.Maui.Dependencies (>= 6.0.400)
- Microsoft.Maui.Extensions (>= 6.0.400)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharedMauiCoreLibrary:
Package | Downloads |
---|---|
SharedMauiXamlStylesLibrary
A collection of predefined Control styles for MAUI and Syncfusion. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.14-preview1 | 45 | 12/19/2024 |
1.1.13 | 438 | 10/21/2024 |
1.1.12 | 176 | 9/20/2024 |
1.1.11 | 99 | 9/10/2024 |
1.1.10 | 151 | 8/10/2024 |
1.1.9 | 132 | 6/14/2024 |
1.1.8 | 135 | 5/10/2024 |
1.1.7 | 161 | 4/11/2024 |
1.1.6 | 140 | 3/28/2024 |
1.1.5 | 118 | 3/27/2024 |
1.1.4 | 131 | 3/20/2024 |
1.1.3 | 131 | 3/19/2024 |
1.1.2 | 179 | 2/12/2024 |
1.1.1 | 299 | 12/6/2023 |
1.1.0 | 155 | 11/14/2023 |
1.0.16 | 155 | 9/16/2023 |
1.0.15 | 183 | 8/9/2023 |
1.0.14 | 282 | 7/22/2023 |
1.0.13 | 277 | 5/18/2023 |
1.0.12 | 395 | 3/8/2023 |
1.0.11 | 444 | 1/20/2023 |
1.0.10-preview | 152 | 1/10/2023 |
1.0.9-preview | 178 | 12/29/2022 |
1.0.8.1 | 328 | 11/29/2022 |
1.0.8 | 370 | 11/29/2022 |
1.0.7 | 316 | 11/16/2022 |
1.0.6 | 327 | 11/14/2022 |
1.0.5 | 404 | 10/23/2022 |
1.0.4 | 686 | 10/3/2022 |
1.0.3 | 391 | 8/21/2022 |
1.0.2 | 386 | 8/15/2022 |
1.0.0-alpha | 339 | 6/22/2022 |