1FriendlyDoge
1FriendlyDoge
CC#
Created by 1FriendlyDoge on 3/29/2023 in #help
✅ Run code in main thread after Task.Run completed?
Hello, I have a long running void function that I execute in a separate thread by calling Task.Run(MyFunction). Now how could I run another function in the main thread when this one ends? Do I need to make an event or something? What are the common approaches to this?
48 replies
CC#
Created by 1FriendlyDoge on 1/1/2023 in #help
✅ [SOLVED] Multiple functions in same controller? ASP.NET Core API
Hello, I would like to have multiple functions in the same api controller with different routes (eg. "api/[controller]/[function], how would I do that? This is my structure
namespace xyz.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class LoginController : ControllerBase
{
[HttpPost(Name = "functionName")]
public someData functionName()
{
// I would want this to have the route "api/Login/functionName", how do I add the "functionName" to it?
}
}
}
namespace xyz.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class LoginController : ControllerBase
{
[HttpPost(Name = "functionName")]
public someData functionName()
{
// I would want this to have the route "api/Login/functionName", how do I add the "functionName" to it?
}
}
}
5 replies
CC#
Created by 1FriendlyDoge on 11/9/2022 in #help
❔ Issue with NotifyCanExecuteChangedFor from MVVM CommunityTK
The problem occurs in my view model (Avalonia MVVM), I set a variable
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(PreCheckCommand))]
public string username;
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(PreCheckCommand))]
public string username;
and try to run my function
[RelayCommand]
public void PreCheck() { ... }
[RelayCommand]
public void PreCheck() { ... }
whenever the text in to box is changed, it never executes though. Anyone has an idea what the issue is? This is how I use the binding in my xaml
<TextBox ... Text="{Binding Username, Mode=TwoWay}"></TextBox>
<TextBox ... Text="{Binding Username, Mode=TwoWay}"></TextBox>
39 replies
CC#
Created by 1FriendlyDoge on 9/10/2022 in #help
Overlay (Not clickable and selectable window on top of fullscreen window) in WPF
So I basically want to make a transparent window that has a custom usercontrol (for example a dot inside of it) and display it TopMost. The only issue is that I can click it and then the fullscreen app loses focus, is there any way to prevent this? I already tried things like Focusable="False" and even DLL imports like SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);, but nothing seems to work.
2 replies