Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
GeneralRe: RDP connections in tabs Pin
Pete O'Hanlon13-Aug-18 0:27
mvePete O'Hanlon13-Aug-18 0:27 
GeneralRe: RDP connections in tabs Pin
Member 1144162213-Aug-18 1:17
Member 1144162213-Aug-18 1:17 
GeneralRe: RDP connections in tabs Pin
Pete O'Hanlon13-Aug-18 1:23
mvePete O'Hanlon13-Aug-18 1:23 
GeneralRe: RDP connections in tabs Pin
Mycroft Holmes13-Aug-18 2:16
professionalMycroft Holmes13-Aug-18 2:16 
GeneralRe: RDP connections in tabs Pin
Member 1144162213-Aug-18 3:10
Member 1144162213-Aug-18 3:10 
GeneralRe: RDP connections in tabs Pin
Mycroft Holmes13-Aug-18 13:28
professionalMycroft Holmes13-Aug-18 13:28 
QuestionClasses In Threads - Pause One Until Another Finished Pin
Kevin Marois8-Aug-18 6:43
professionalKevin Marois8-Aug-18 6:43 
AnswerRe: Classes In Threads - Pause One Until Another Finished Pin
Richard Deeming8-Aug-18 8:05
mveRichard Deeming8-Aug-18 8:05 
Something like this should work:
C#
public class Test1 : ITest
{
    private readonly ManualResetEventSlim _mre;
    
    public Test1(ManualResetEventSlim mre)
    {
        _mre = mre;
    }
    
    public TestResult PerformTest()
    {
        try
        {
            Thread.Sleep(60 * 10 * 1000);
            return TestResult.Failed;
        }
        finally
        {
            _mre.Set();
        }
    }
}

public class Test2 : ITest
{
    private readonly ManualResetEventSlim _mre;
    
    public Test2(ManualResetEventSlim mre)
    {
        _mre = mre;
    }
    
    public TestResult PerformTest()
    {
        Thread.Sleep(60 * 2 * 1000);
        
        // Wait for Test1 to complete:
        _mre.Wait();

        // Do some other stuff here.
        return TestResult.Passed;
    }
}

static class Program
{
    static void Main()
    {
        var mre = new ManualResetEventSlim();
        
        var tests = new List<ITest>
        {
            new Test1(mre),
            new Test2(mre),
        };
        
        var tasks = new List<Task>();
        foreach (ITest test in tests)
        {
            Task task = Task.Run(() => test.PerformTest());
            tasks.Add(task);
        }
        
        Task.WaitAll(tasks.ToArray());
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

AnswerRe: Classes In Threads - Pause One Until Another Finished Pin
OriginalGriff8-Aug-18 8:09
mveOriginalGriff8-Aug-18 8:09 
GeneralRe: Classes In Threads - Pause One Until Another Finished Pin
Kevin Marois8-Aug-18 8:22
professionalKevin Marois8-Aug-18 8:22 
GeneralRe: Classes In Threads - Pause One Until Another Finished Pin
OriginalGriff8-Aug-18 22:08
mveOriginalGriff8-Aug-18 22:08 
GeneralRe: Classes In Threads - Pause One Until Another Finished Pin
Richard Deeming9-Aug-18 0:48
mveRichard Deeming9-Aug-18 0:48 
Questionthreads Pin
Laurent mortroux6-Aug-18 22:44
Laurent mortroux6-Aug-18 22:44 
AnswerRe: threads Pin
OriginalGriff6-Aug-18 23:31
mveOriginalGriff6-Aug-18 23:31 
SuggestionRe: threads Pin
Richard Deeming7-Aug-18 2:29
mveRichard Deeming7-Aug-18 2:29 
AnswerRe: threads Pin
Richard Deeming7-Aug-18 2:28
mveRichard Deeming7-Aug-18 2:28 
GeneralRe: threads Pin
Laurent mortroux7-Aug-18 3:28
Laurent mortroux7-Aug-18 3:28 
GeneralRe: threads Pin
Richard Deeming7-Aug-18 3:48
mveRichard Deeming7-Aug-18 3:48 
QuestionLG Smart TV webos 3.0 .net framework client development Pin
impeham6-Aug-18 12:05
impeham6-Aug-18 12:05 
AnswerRe: LG Smart TV webos 3.0 .net framework client development Pin
Simon_Whale7-Aug-18 4:22
Simon_Whale7-Aug-18 4:22 
QuestionHow do you color cell of the listview ? Pin
Member 24584675-Aug-18 17:51
Member 24584675-Aug-18 17:51 
AnswerRe: How do you color cell of the listview ? Pin
Mycroft Holmes5-Aug-18 19:43
professionalMycroft Holmes5-Aug-18 19:43 
AnswerRe: How do you color cell of the listview ? Pin
OriginalGriff5-Aug-18 20:27
mveOriginalGriff5-Aug-18 20:27 
GeneralRe: How do you color cell of the listview ? Pin
Member 24584678-Aug-18 15:33
Member 24584678-Aug-18 15:33 
QuestionSelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Member 138463763-Aug-18 22:32
Member 138463763-Aug-18 22:32 

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.