Click here to Skip to main content
15,890,506 members
Home / Discussions / C#
   

C#

 
AnswerRe: Trying to use a string to adb command line Pin
Cláudio Hideki4-Oct-17 23:40
Cláudio Hideki4-Oct-17 23:40 
GeneralRe: Trying to use a string to adb command line Pin
Richard MacCutchan4-Oct-17 23:50
mveRichard MacCutchan4-Oct-17 23:50 
AnswerRe: Trying to use a string to adb command line Pin
Bernhard Hiller4-Oct-17 23:31
Bernhard Hiller4-Oct-17 23:31 
GeneralRe: Trying to use a string to adb command line Pin
Cláudio Hideki4-Oct-17 23:45
Cláudio Hideki4-Oct-17 23:45 
GeneralRe: Trying to use a string to adb command line Pin
Bernhard Hiller5-Oct-17 21:14
Bernhard Hiller5-Oct-17 21:14 
Questioncreate a simple editor with intellisense Pin
Member 121289494-Oct-17 0:08
Member 121289494-Oct-17 0:08 
AnswerRe: create a simple editor with intellisense Pin
Eddy Vluggen4-Oct-17 0:17
professionalEddy Vluggen4-Oct-17 0:17 
QuestionRun List Of Tasks, Then Get All Results Pin
Kevin Marois2-Oct-17 12:51
professionalKevin Marois2-Oct-17 12:51 
I have this method:
private async Task<QualificationTestResult> RunTest(Location bay, IBayQualificationTest test, CancellationTokenSource token, string baySerialNumber)
{
    var _logger = new BayQualificationTestLogger(bay, baySerialNumber);
    IEnumerable<string> details = null;

    var testResult = new QualificationTestResult
    {
        Name = test.Name,
        Version = test.Version,
    };

    testResult.Result = test.PerformTest(_logger, 
                                        ((InstrumentService)_instrumentService).GetBayCommunicationService(bay),
                                        token.Token,
                                        out details);

    return testResult;
}
I want to run it for a number of different tests, then get all QualificationTestResults back into a list.

So far I have this:
qualificationResult.TestResults.Clear();

IEnumerable<IBayQualificationTest> tests = GetQualificationTests().OrderBy(x => x.Priority).ToList();

// List of tasks to complete
List<Task> tasks = new List<Task>();
Task<QualificationTestResult> thermalTask = null;
Task<QualificationTestResult> eSensingTask = null;

// Launch the Thermal test in it's own task
var thermal = tests.Where(t => t.Name.ToLower().Contains("therm")).FirstOrDefault();
if (thermal != null)
{
    thermalTask = Task.Factory.StartNew(() =>
                    RunTest(bay, thermal, token, baySerialNumber));

    tasks.Add(thermalTask);
}

// Launch other tests here, just like the Thermal, test above
.
.
.

// Wait for all tasks to complete
Task completionTask = Task.WhenAll(tasks);

// Put all results into the list of results
foreach (var t in tasks)
{
    qualificationResult.TestResults.Add(t);
}
This won't compile. On the Factory line I get
Cannot implicitly convert type 'System.Threading.Tasks.Task<System.Threading.Tasks.Task<...Core.Models.QualificationTestResult>>' to 'System.Threading.Tasks.Task<...Core.Models.QualificationTestResult>'

And on the FOR EACH at the bottom, the t.Result errors with "Task does not contain a definition for Result"

This is driving me nuts. What am I doing wrong here???
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Run List Of Tasks, Then Get All Results Pin
Pete O'Hanlon2-Oct-17 20:09
mvePete O'Hanlon2-Oct-17 20:09 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Kevin Marois3-Oct-17 3:52
professionalKevin Marois3-Oct-17 3:52 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Richard Deeming3-Oct-17 4:31
mveRichard Deeming3-Oct-17 4:31 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Kevin Marois3-Oct-17 5:33
professionalKevin Marois3-Oct-17 5:33 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Richard Deeming3-Oct-17 6:21
mveRichard Deeming3-Oct-17 6:21 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Nathan Minier4-Oct-17 1:54
professionalNathan Minier4-Oct-17 1:54 
QuestionFind Insert Position In An ObservableCollection Pin
Kevin Marois2-Oct-17 6:54
professionalKevin Marois2-Oct-17 6:54 
AnswerRe: Find Insert Position In An ObservableCollection Pin
Dave Kreskowiak2-Oct-17 7:14
mveDave Kreskowiak2-Oct-17 7:14 
GeneralRe: Find Insert Position In An ObservableCollection Pin
Kevin Marois2-Oct-17 7:21
professionalKevin Marois2-Oct-17 7:21 
GeneralRe: Find Insert Position In An ObservableCollection Pin
Dave Kreskowiak2-Oct-17 7:45
mveDave Kreskowiak2-Oct-17 7:45 
GeneralRe: Find Insert Position In An ObservableCollection Pin
Kevin Marois2-Oct-17 7:52
professionalKevin Marois2-Oct-17 7:52 
GeneralOT: bad link in your sig. Pin
OriginalGriff2-Oct-17 21:56
mveOriginalGriff2-Oct-17 21:56 
GeneralRe: OT: bad link in your sig. Pin
Dave Kreskowiak3-Oct-17 1:52
mveDave Kreskowiak3-Oct-17 1:52 
GeneralRe: OT: bad link in your sig. Pin
OriginalGriff3-Oct-17 2:20
mveOriginalGriff3-Oct-17 2:20 
AnswerRe: Find Insert Position In An ObservableCollection Pin
Alaa Ben Fatma3-Oct-17 10:27
professionalAlaa Ben Fatma3-Oct-17 10:27 
SuggestionUse design patterns in the 15 puzzle game and ensure a rollback Pin
Member 1276922230-Sep-17 5:22
Member 1276922230-Sep-17 5:22 
GeneralRe: Use design patterns in the 15 puzzle game and ensure a rollback Pin
OriginalGriff30-Sep-17 5:40
mveOriginalGriff30-Sep-17 5:40 

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.