Chethan Chinmay

Chethan Chinmay

  • NA
  • 51
  • 5.2k

c#, wpf, tab control change

Jun 30 2018 12:11 AM
if some function is running, when u want to change other tabs it should not happen, i need to give pop up like "please stop test and change tab"... how to do this 
 
i trid this code but it is continuosly looping and giving pop up 
 
private async  void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
  if (e.OriginalSource == MainTabControl)
    {
        if (MainTabControl.SelectedIndex != -1)
          {
             if (SharedInfo.TestInProgress)
                {
                   //e.Handled = true;
                   if (MainTabControl.SelectedIndex != 0)
                       {
                          MainTabControl.SelectedIndex = 0;
                     
                             await this.ShowMessageAsync(
                             "Test is in Progress...",
                             "Let the test be completed...");
                          return;
                       }
               }
         }
     }
}

Answers (1)