static void SetTextBasedOnBusy(ButtonWithBusyIndicator control, bool isBusy, string text) { var activityIndicator = GetActivityIndicator(control); var button = GetButton(control); if (activityIndicator == null || button == null) { return; } activityIndicator.IsVisible = activityIndicator.IsRunning = isBusy; button.Text = isBusy ? string.Empty : control.Text; }
static Button GetButton(ButtonWithBusyIndicator control) { return(control.Children[0] as Button); }
static ActivityIndicator GetActivityIndicator(ButtonWithBusyIndicator control) { return(control.Children[1] as ActivityIndicator); }