Monday, May 29, 2017

command somethings :D

 #region Get Badge All command
        private RelayCommand _GetBadgeAllCommand;

        /// 
        /// Gets the LoginCommand.
        /// 
        public RelayCommand GetBadgeAllCommand
        {
            get
            {
                return _GetBadgeAllCommand ?? (_GetBadgeAllCommand = new RelayCommand(
                    ExecuteGetBadgeAllCommand,
                    CanExecuteGetBadgeAllCommand));
            }
        }

        private async void ExecuteGetBadgeAllCommand()
        {
            try
            {
                IsBusyVoting = true;

                var _VotingSummary = await Task.Factory.StartNew(() =>
                {
                    BadgeBus votingBus = new BadgeBus(Utility._connectionStringRead);
                    return votingBus.getBadgeSummary(UserLogin.id);
                });

                VotingSumury = _VotingSummary;
                RaisePropertyChanged("VotingSumury");
                IsBusyVoting = false;


            }
            catch (Exception ex)
            {
                base._dialogService.ShowMessageBox(ex.Message, Properties.Resources.COM_TitleMessageBox);
            }
            finally
            {
                IsBusyVoting = false;
            }
        }

        private bool CanExecuteGetBadgeAllCommand()
        {
            return true;
        }
        #endregion

No comments: