예제 #1
0
        /// <summary>
        ///     Binds UI so that controls will look disabled and activity will be
        ///     displayed while operation is in progress. For simplicity Cancel button
        ///     will be disabled during the operation even if it is cancellable
        /// </summary>
        /// <param name="operation"></param>
        private void BindUIToOperation(OperationBase operation)
        {
            Binding isActivityActiveBinding = operation.CreateOneWayBinding("IsComplete", new NotOperatorValueConverter());
            Binding isEnabledBinding        = operation.CreateOneWayBinding("IsComplete");

            this.activity.SetBinding(Activity.IsActiveProperty, isActivityActiveBinding);
            this.registerForm.SetBinding(Control.IsEnabledProperty, isEnabledBinding);
            this.registerButton.SetBinding(Control.IsEnabledProperty, isEnabledBinding);
            this.registerCancel.SetBinding(Control.IsEnabledProperty, isEnabledBinding);
            this.backToLogin.SetBinding(Control.IsEnabledProperty, isEnabledBinding);
        }