■ 크로스 스레드(Cross Thread) 처리하기

----------------------------------------------------------------------------------------------------

/// <summary>

/// 버튼 갱신하기 대리자

/// </summary>

/// <param name="button">버튼</param>

/// <param name="content">컨텐트</param>

private delegate void UpdateButtonDelegate(Button button, object content);

 

#region 버튼 갱신하기 - UpdateButton(button, content)

 

/// <summary>

/// 버튼 갱신하기

/// </summary>

/// <param name="button">버튼</param>

/// <param name="content">컨텐트</param>

private void UpdateButton(Button button, object content)

{

    if(button.CheckAccess())

    {

        button.Content = content;

    }

    else

    {

        UpdateButtonDelegate updateButtonDelegate = new UpdateButtonDelegate(UpdateButton);

                

        button.Dispatcher.BeginInvoke(updateButtonDelegate, button, content);

    }

}

 

#endregion

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요