C#: Disable button during search/calculation

前端 未结 4 1064
梦如初夏
梦如初夏 2021-01-16 12:58

I have a search dialog where I want to disable the search button during the search. This is the current code but the button does not get deactivated

View:

         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 13:45

    This code must work.

    private async void ExecuteSearch() {
            IsNotSearching = false;
    
            var task = Task.Factory.StartNew(() => {
                //do some searching here
            });
            await task;
    
            IsNotSearching = true;
        }
    

提交回复
热议问题