SpReeD
SpReeD
CC#
Created by SpReeD on 8/24/2024 in #help
✅ MAUI - Mutlitap Gesture
I haven't found anything on the net about "Multitap Gestures". I tried a few things, currently using "CommunityToolkit.Maui" with the "TouchBehavior". So I'm left with the question, is it even possible?
12 replies
CC#
Created by SpReeD on 6/3/2024 in #help
✅ Blazor and Javascript loading
So, I have a main page and a separate adminpage. On navigating to the admin site it changes the layout to AdminLayout.razor which inherits from @inherits LayoutComponentBase. So far, so good, the adminpage inlcudes @layout AdminLayout and everything is displayed correctly. The AdminLayout also has several JS includes at the end of body. It seems that after first navigation those scripts aren't loaded, the behaviour is as followed: - Navigate to admin page - Click on a <a href="#"> that should expand a collapsed div, but it doesn't - Reload/Refresh the page after it's initial load and it works as expected Switching the rendermode to Server and Server without prerender haven't helped here. Navigating to the adminpage via NavigationManager, could this be an issue?
11 replies
CC#
Created by SpReeD on 6/2/2024 in #help
✅ Blazor / ASP.NET - @inject keyed service
Is there a way in .NET 8 to inject a keyed service like a normal service with the @inject keyword? I know of the FromKeyedServices attribute, but cannot figure out how to use it in combination with @inject. I thought of a way like @inject [FromKeyedServices("MyService")] ServiceClass FooBar;
6 replies
CC#
Created by SpReeD on 3/18/2024 in #help
Yet another question about struct & class
So, here I am, having this code
public readonly record struct MinifigureDto {
public required int Id { get; init; }
public required string Name { get; init; }
public required int ThemeId { get; init; }
public required uint Amount { get; init; }
}
public readonly record struct MinifigureDto {
public required int Id { get; init; }
public required string Name { get; init; }
public required int ThemeId { get; init; }
public required uint Amount { get; init; }
}
This object won't change during runtime, so, should I make it a struct or a class? What is the devil in the detail?
9 replies
CC#
Created by SpReeD on 3/15/2024 in #help
The best-practice way to use a plausibility check
So, I have the following class
namespace CleanLib.Lego.Parts;

public class Color : Entity {
private string? _Name;
public string Name {
get => this._Name!;
set {
value.ThrowIfNullOrWhiteSpace();

this._Name = value;
}
}

private string? _Code;
public string Code {
get => this._Code!;
set {
value.ThrowIfNullOrWhiteSpace();

this._Code = value;
}
}

public Color(string name, string code) {
this.Name = name;
this.Code = code;
}
}
namespace CleanLib.Lego.Parts;

public class Color : Entity {
private string? _Name;
public string Name {
get => this._Name!;
set {
value.ThrowIfNullOrWhiteSpace();

this._Name = value;
}
}

private string? _Code;
public string Code {
get => this._Code!;
set {
value.ThrowIfNullOrWhiteSpace();

this._Code = value;
}
}

public Color(string name, string code) {
this.Name = name;
this.Code = code;
}
}
Is it okay to throw in the setter of the properties or is it somehow "better" to check this in the constructor? Logically spoken, both values won't ever change, but may be "corrected" if inserted wrongly in the database.
3 replies
CC#
Created by SpReeD on 3/2/2024 in #help
Is "System.IO.IsolatedStorage" still a thing in .NET?
I'm wondering if the usage of Isolated storage is still something, someone could consider using today. Plus, is there finally a way to make it persistent across version changes of the application, or do we still need an "updater" software? However, I'm free to hear some alternatives 🙂 How you would store a local Highscore Database/File?
5 replies