Click here to Skip to main content
15,867,488 members
Home / Discussions / C#
   

C#

 
GeneralRe: Authentication Error while migration of .net web application from VS2012 (.net 4.0) to VS2019 (.net 4.7.2)project Pin
Richard Deeming16-Jun-20 1:10
mveRichard Deeming16-Jun-20 1:10 
GeneralRe: Authentication Error while migration of .net web application from VS2012 (.net 4.0) to VS2019 (.net 4.7.2)project Pin
Rohith PH16-Jun-20 1:31
Rohith PH16-Jun-20 1:31 
GeneralRe: Authentication Error while migration of .net web application from VS2012 (.net 4.0) to VS2019 (.net 4.7.2)project Pin
Richard Deeming16-Jun-20 2:29
mveRichard Deeming16-Jun-20 2:29 
GeneralRe: Authentication Error while migration of .net web application from VS2012 (.net 4.0) to VS2019 (.net 4.7.2)project Pin
Rohith PH16-Jun-20 23:40
Rohith PH16-Jun-20 23:40 
GeneralRe: Authentication Error while migration of .net web application from VS2012 (.net 4.0) to VS2019 (.net 4.7.2)project Pin
Richard Deeming16-Jun-20 23:49
mveRichard Deeming16-Jun-20 23:49 
QuestionProblem with serial port Pin
DanTheBest14-Jun-20 5:48
DanTheBest14-Jun-20 5:48 
AnswerRe: Problem with serial port Pin
OriginalGriff14-Jun-20 8:27
mveOriginalGriff14-Jun-20 8:27 
QuestionHow To Write And Comsume An Async Method Pin
Kevin Marois12-Jun-20 6:47
professionalKevin Marois12-Jun-20 6:47 
I have code in my DAL that I want to call from the UI asynchronously in my WPF app. I think I have this right, but I'd like to get your opinion.

DAL Interface
public interface IDAL
{
    Task<List<ReportData>> GetReportData(ReportArgsEntity args);
}
DAL
public class MyDAL : IDAL
{
    public Task<List<ReportData>> GetReportData(ReportArgsEntity args)
    {
        var t = Task.Factory.StartNew(() => 
        {
            List<ReportData> results = new List<ReportData>();

            // Get report data here

            return results;
        });

        return t;
    }
}
BL Interface
public interface IBL
{
    Task<List<ReportData>> GetReportData(ReportArgsEntity args);
}
BL
public class MyBL : IBL
{
    IDAL _dal;
    public MyBL()
    {
        _dal = new MyDAL();
    }
    public Task<List<ReportData>> GetReportData(ReportArgsEntity args)
    {
        return _dal.GetReportData(args);
    }
}
View Model
public class MyViewModel
{
    IBL _bizLayer;

    public MyViewModel()
    {
        _bizLayer = new MyBL();
    }

    private async void RunReport()
    {
        var args = new ReportArgsEntity()
        {
            // Set properties here
        };

        var reportData = await _bizLayer.GetReportData(args);

        // When the data comes back, show he report
    }
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: How To Write And Comsume An Async Method Pin
Richard Deeming12-Jun-20 8:09
mveRichard Deeming12-Jun-20 8:09 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois12-Jun-20 9:54
professionalKevin Marois12-Jun-20 9:54 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming14-Jun-20 23:44
mveRichard Deeming14-Jun-20 23:44 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 7:31
professionalKevin Marois15-Jun-20 7:31 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming15-Jun-20 7:38
mveRichard Deeming15-Jun-20 7:38 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 7:41
professionalKevin Marois15-Jun-20 7:41 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming15-Jun-20 7:50
mveRichard Deeming15-Jun-20 7:50 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 9:01
professionalKevin Marois15-Jun-20 9:01 
QuestionRemoving a field from jSon String Pin
simpledeveloper11-Jun-20 8:00
simpledeveloper11-Jun-20 8:00 
AnswerRe: Removing a field from jSon String Pin
OriginalGriff11-Jun-20 22:44
mveOriginalGriff11-Jun-20 22:44 
GeneralRe: Removing a field from jSon String Pin
simpledeveloper12-Jun-20 9:05
simpledeveloper12-Jun-20 9:05 
GeneralRe: Removing a field from jSon String Pin
OriginalGriff12-Jun-20 9:06
mveOriginalGriff12-Jun-20 9:06 
AnswerRe: Removing a field from jSon String Pin
James Curran17-Jun-20 20:23
James Curran17-Jun-20 20:23 
QuestionIs there any good C# desktop library to implement Card liked UI dashboard? Pin
yccheok11-Jun-20 6:31
yccheok11-Jun-20 6:31 
AnswerRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
Richard MacCutchan11-Jun-20 21:36
mveRichard MacCutchan11-Jun-20 21:36 
GeneralRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
yccheok12-Jun-20 6:13
yccheok12-Jun-20 6:13 
GeneralRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
Richard MacCutchan12-Jun-20 6:43
mveRichard MacCutchan12-Jun-20 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.