BElluu
BElluu
CC#
Created by BElluu on 3/1/2024 in #help
DTO is fine? DTO have any alternatives?
Hello, I read on some blog that DTO should not be used in production. Is it true ? Are there any alternatives to DTO? Having a Product model and ProductDto just because it needs to be trimmed down by a few fields looks pretty dirty. Thank you in advance!
33 replies
CC#
Created by BElluu on 1/22/2023 in #help
❔ EntityframeworkCore starts project on migration
3 replies
CC#
Created by BElluu on 1/9/2023 in #help
❔ How to disable background worker?
Hi, I need to do something in background when state is true and stop when state is false. I changing state by button. If I press button, state is true unit I press button again. I set WorkerSupportsCancellation on true. When I press button again, I have all the time TEST in console. Any idea?
private void Start_Click(object sender, EventArgs e)
{
if (started)
{
StartButton.Text = "Start";
started = false;
backgroundWorker1.CancelAsync();
InitCheckLocalTimer().Stop();
InitCheckLocalTimer().Dispose();
}
else
{
StartButton.Text = "Stop";
started = true;
InitCheckLocalTimer().Start();
}
}

private void CheckLocalTimer(object sender, EventArgs e)
{
if (!backgroundWorker1.IsBusy)
{
backgroundWorker1.RunWorkerAsync();
}
}

private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
if (!backgroundWorker1.CancellationPending && !e.Cancel)
{
Console.WriteLine("TEST")
}
else
{
e.Cancel = true;
}
}
private void Start_Click(object sender, EventArgs e)
{
if (started)
{
StartButton.Text = "Start";
started = false;
backgroundWorker1.CancelAsync();
InitCheckLocalTimer().Stop();
InitCheckLocalTimer().Dispose();
}
else
{
StartButton.Text = "Stop";
started = true;
InitCheckLocalTimer().Start();
}
}

private void CheckLocalTimer(object sender, EventArgs e)
{
if (!backgroundWorker1.IsBusy)
{
backgroundWorker1.RunWorkerAsync();
}
}

private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
if (!backgroundWorker1.CancellationPending && !e.Cancel)
{
Console.WriteLine("TEST")
}
else
{
e.Cancel = true;
}
}
4 replies
CC#
Created by BElluu on 1/3/2023 in #help
❔ Quick image finder in other image
Quick option to find a photo in another photo? For example, I have a picture of a cat that I pasted in 60 out of 100 pictures. I want the program to find which photos the cat is in.
8 replies
CC#
Created by BElluu on 1/2/2023 in #help
❔ Watch on screen area and react
Hi. How can I do it? I need to "watch" on specfic screen area and when eg cursor is in this area app will do something. How can I "watch" on specific area? Need I do screenshots every second?
12 replies
CC#
Created by BElluu on 12/19/2022 in #help
❔ CQRS with MediatR without Controllers
I heard that in the case of CQRS the use of controllers is redundant and not needed. Is it true? If so, how do we delegate a specific endpoint to a specific command/query?
3 replies