Somgör from Human Resources
Somgör from Human Resources
CC#
Created by Somgör from Human Resources on 6/18/2024 in #help
Avalonia ViewLocator not ViewLocating
I have an Avalonia project with multiple pages like MainView and LoginView and SettingsView etc, pretty standard stuff But now I have the following problem, trying to set my ViewModelBase.ContentViewModel to something will result in the ContentViewModel being null for no apparent reason The program workflow goes like this: The program starts -> the program sets the DataContext to new MainViewModel() -> MainViewModel checks if the user is logged in to an account, if not it will set ContentViewModel to new LoginViewModel(), in the LoginView the user is supposed to log into an account which is then supposed to set the ContentViewModel to a new MainViewModel(), but instead the ContentViewModel is null
9 replies
CC#
Created by Somgör from Human Resources on 6/15/2024 in #help
✅ Help with Avalonia databinding and library objects on ViewModels
Lets say I have an API Client that allows me to fetch data like chats, messages etc That API Client responds with a List of the object which i use to construct my component (in this case for example a chat with a simple name, user icon and last message sent in it) Now i bind the <ItemsControl> to my List of fetched chats and set the datatemplate to my Chat component But now in my ViewModel class for said Chat i need to access the current chat that is being used to construct my View (the chat component) so i can further manipulate and process it
87 replies
CC#
Created by Somgör from Human Resources on 6/12/2024 in #help
How to manage components with Avalonia
So Im making an Avalonia program and i was wondering how I would manage components For example I have a Views folder with my Pages / Views and a ViewModels folder where i store my ViewModel classes Now what if i wanted to create a Component that represents a message, where would i store that? And where would I store their viewmodels etc Im using a ViewLocator
3 replies
CC#
Created by Somgör from Human Resources on 6/10/2024 in #help
Styling in Avalonia
I recently got into Avalonia development and got some basics on my application done Now I need help with doing some styling, maybe animations etc Are there are good guides regarding this I should look into? Libraries and frameworks for such things also work
8 replies
CC#
Created by Somgör from Human Resources on 6/9/2024 in #help
✅ How to handle TextBox Text changing on ViewModel in Avalonia
I have multiple text boxes that are needed before being able to process, and therefore they all must be filled for the continue button to become enabled, however, i cant seem to figure out how i can write such event handler on my ViewModel, i tried using get and set but [ObservableProperty] doesnt work on that Additionally id also need to handle stuff when the selection of a ComboBox changes On google people say it works if you just put a get and set in there but as stated above it doesnt
1 replies
CC#
Created by Somgör from Human Resources on 6/8/2024 in #help
✅ Need help with docker deployment
I have an ASP.NET REST API that i want to deploy on my server but i dont understand how this works at all My image is already pushed but when i try to access my API via CURL request nothing happens Im using docker-compose on my server
version: '3'

services:
your_service:
image: ...
environment:
...
ports:
- "712:8080"
version: '3'

services:
your_service:
image: ...
environment:
...
ports:
- "712:8080"
144 replies
CC#
Created by Somgör from Human Resources on 6/4/2024 in #help
✅ Issues with Avalonia
No description
106 replies
CC#
Created by Somgör from Human Resources on 6/1/2024 in #help
Question about Avalonia
So im a beginner in Avalonia and im watching a youtube tutorial series (more specifically this tutorial) and i have a question about the Community MVVM Toolkit In my Main view im creating a SplitView with a property IsPaneOpen which has a Binding to a value called isPaneOpen, however, in my code i have a private bool _isPaneOpen = false; which has an [ObservableProperty] Attribute to it How does Avalonia know that _isPaneOpen is my binding to isPaneOpen, the same question goes for how avalonia knows that my OnButtonClick() with my [RelayCommand] attribute is the same function as my binding OnButtonClickCommand() Its a very beginner question but i wonder how Avalonia / the MVVM tookit knows what members im reffering to even tho they dont have the same name
4 replies
CC#
Created by Somgör from Human Resources on 5/29/2024 in #help
✅ How to learn XAML styling
I'm new to XAML styling in C# using WinUI 3 (id use MAUI but since I mainly focus on Windows Desktop it's overkill), coming from Kotlin Jetpack compose (for mobile apps) I have cool concepts in mind for my design and know the rough way to get there but somehow nothing works out like it's supposed to do and it's my lack of understanding how XAML styling works properly This is purely about design and not about things such as Data binding etc Also my next question is if WinUI / XAML styling has some sort of creating components that I can just Re use
85 replies
CC#
Created by Somgör from Human Resources on 5/29/2024 in #help
How does database sharding work
I understand the concept of load balancing where for example Service.myApi redirects the request to a server like s1, s2, etc.myApi or even media servers that balance the media into mulitple servers like media.myapi -> m3.myApi But in the case of the media server the data where a media file is stored, is stored in the database so it's just a matter of asking the database for such data But then how can I know what database is targeted when there is db.myapi which would have db1.myApi and db2.myApi since I can't just ask the database for data without knowing where it's stored
63 replies
CC#
Created by Somgör from Human Resources on 5/29/2024 in #help
✅ WinUI3 not compatible with my .NET 7 package
Im trying to make a small WinUI 3 application for Windows Desktop but the package required to make this happen is written on .NET 7 and apparently not compatible with <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> of my WinUI3 target, what can i do to fix this?
2 replies
CC#
Created by Somgör from Human Resources on 5/27/2024 in #help
cant connect to MariaDB
No description
7 replies
CC#
Created by Somgör from Human Resources on 5/27/2024 in #help
How to set env variables in Docker reliably
I want to deploy my backend (or really all my programs) using Kubernetes / CircleCI and now im facing the issue of wanting to have my credentials and such set as environment variables for my Image on deploy My current structure is something like: program starts -> generates config files -> reads config files Now with the config files being waited for to get filled in it kinda destroys the point of automatic deployment, and me using SQLite as database doesnt help either considering it would be gone each time TLDR; So how can i reliably pass Environment variables for credentials like that into my Image on deploy
6 replies
CC#
Created by Somgör from Human Resources on 5/27/2024 in #help
How does Dapper work
My question is not exactly related to how the workflow of Dapper works but rather how it's extension methods work I recently got into partial classes and extension methods and I was wondering how Dapper is able to add a Query<T>() function into all sorts of SQL connectors, wouldn't that mean Dapper would need to link every single SQL connector as a dependency in order to target to the object to extend on? Because I would like to make an extension library based on another project I once made but I don't want to end up linking a version of my library into it that is a dependency which eventually becomes outdated while nothing on its extending part changes simply because the linked dependency is not up to date anymore
6 replies
CC#
Created by Somgör from Human Resources on 5/24/2024 in #help
✅ Question about partial classes
So recently I got into partial classes (it's a miracle I didn't find out about this sooner I love them) and have since been using them to manage my code by splitting up classes into what they do /take care of instead of having one huge class Now I wonder when and when not to use partial classes because personally I don't see any downsides to them, for example when writing a library that uses partial classes, doesn't that mean people can easily write an "extensions" by tapping into the same namespace / class and just adding things to them
17 replies
CC#
Created by Somgör from Human Resources on 5/18/2024 in #help
Refactoring objects issue
So a long long time ago i implemented Objects and how they are set in a very stupid way, which i am now correcting by adapting them to be compatible with the default JSON Serializer and bringing the code to overall more structure by following C# conventions more My issue I want to structure the following object (shown in the screenshot) to use [JsonPropertyName] and such instead of the constructor with a JObject (from Newtonsoft JSON), which would be no problem, however, as you can see some values use a different key (for example ndcId is in "o":{"ndcId":0000}) while others are more nested (like "o":{"chatmessage":{"content"}}) What would be the proper approach to serialize them with the default serializer while keeping them in the same class as i dont want to split up my class for every branch of "o"
28 replies
CC#
Created by Somgör from Human Resources on 5/8/2024 in #help
How to set Object from Inherited class with Reflections
Im working on a framework for one of my libraries and my goal is to create a similar structure as Discord.NET as stated in #How to create a structure like Discord.NET i have an issue with my Context object Setting it using module.ModuleInteractionBase = (InteractionBase)Activator.CreateInstance(moduleType); seems to work but the instance its setting seems to be different from what my command handler class inherits
public class Commands : InteractionBase
{

[Command("ping", "Simple Ping Command")]
[EnabledInDms(false)]
[PermissionGroup(PermissionGroup.PermissionGroups.Agent)]
public async Task HandleCommand(string arg1, string[] arg2 = null)
{
await Console.Out.WriteLineAsync(Context.InteractionName);
}
}
public class Commands : InteractionBase
{

[Command("ping", "Simple Ping Command")]
[EnabledInDms(false)]
[PermissionGroup(PermissionGroup.PermissionGroups.Agent)]
public async Task HandleCommand(string arg1, string[] arg2 = null)
{
await Console.Out.WriteLineAsync(Context.InteractionName);
}
}
6 replies
CC#
Created by Somgör from Human Resources on 5/8/2024 in #help
How to create a structure like Discord.NET
I want to write an extension to a library ive started some time ago and was wondering how i could build up a similar system to Discord.NET here is an example of what i mean You have a public class that inherits InteractionModuleBase and from that moment on you can create things like
[SlashCommand("some-command", "command description")]
public async Task myCommand(string arg1, string arg2) {}
[SlashCommand("some-command", "command description")]
public async Task myCommand(string arg1, string arg2) {}
And within that function you can access a Context object which contains some data about the Interaction context i was wondering how i could create / achieve such a thing and what the steps for that are
41 replies
CC#
Created by Somgör from Human Resources on 5/1/2024 in #help
✅ Different browser on Puppeteersharp
I'm wondering if there is a way to use a different browser than chrome for Puppeteersharp. Like Firefox or similar When downloading / fetching browsers there doesn't seem to be an option for it
4 replies
CC#
Created by Somgör from Human Resources on 4/17/2024 in #help
✅ Get base version of project in Github actions
I want to setup a github actions workflow that gets the base version of my library (for example 1.5.2) and then appends a dev version like 0.0.1, 0.0.2 etc, so it ends up as 1.5.2-dev0.0.1 for example, however, i cant manage to get my base project version property, is there any way to achieve what i want?
1 replies