Example #1
0
        private static void IsBusyChanged(Control control, AttachedMemberChangedEventArgs <bool> args)
        {
            BusyIndicator busyIndicator = BusyViewMember.GetValue(control, null);

            if (args.NewValue)
            {
                for (int index = 0; index < control.Controls.Count; index++)
                {
                    control.Controls[index].Enabled = false;
                }
                control.Controls.Add(busyIndicator);
                busyIndicator.Left = (control.ClientSize.Width - busyIndicator.Width) / 2;
                busyIndicator.Top  = (control.ClientSize.Height - busyIndicator.Height) / 2;
                busyIndicator.BringToFront();
            }
            else
            {
                control.Controls.Remove(busyIndicator);
                for (int index = 0; index < control.Controls.Count; index++)
                {
                    control.Controls[index].Enabled = true;
                }
            }
        }