コード例 #1
0
 private void RefreshCommands()
 {
     AddCommand.RaiseCanExecuteChanged();
     MoveUpCommand.RaiseCanExecuteChanged();
     MoveDownCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     DeleteAllCommand.RaiseCanExecuteChanged();
 }
コード例 #2
0
        private async Task DeleteAllModel()
        {
            var dialogres = Xceed.Wpf.Toolkit.MessageBox.Show("Delete all entries?", "Delete entries", MessageBoxButton.YesNo);

            if (dialogres == System.Windows.MessageBoxResult.Yes)
            {
                _busyIndicator.Busy = true;
                await ServiceClient <IDeveloperService> .ExecuteAsync(o => o.DeleteAllAsync());

                Developers = new ObservableCollection <IDeveloper>();

                DeleteAllCommand.RaiseCanExecuteChanged();

                _busyIndicator.Busy = false;
            }
        }
コード例 #3
0
        private void UsersSavedCallback(string payload, string severity)
        {
            var models = JsonConvert.DeserializeObject <IEnumerable <DeveloperModel> >(payload);

            if (models == null)
            {
                return;
            }

            _busyIndicator.Busy = true;
            var list = Developers.ToList();

            list.AddRange(models);
            Developers = new ObservableCollection <IDeveloper>(list);
            DeleteAllCommand.RaiseCanExecuteChanged();
            _busyIndicator.Busy = false;
        }
コード例 #4
0
        private async Task LoadData()
        {
            _busyIndicator.Busy = true;

            await Task.Delay(500);

            //var developerSvc = new DeveloperService();
            //var items = await developerSvc.FindAllAsync();

            var developers = await ServiceClient <IDeveloperService> .ExecuteAsync(o => o.FindAllAsync());

            Developers = new ObservableCollection <IDeveloper>(developers);

            DeleteAllCommand.RaiseCanExecuteChanged();

            _busyIndicator.Busy = false;
        }
コード例 #5
0
        private async Task <bool> DeleteModel(DeveloperModel entity)
        {
            var result = false;

            var dialogres = Xceed.Wpf.Toolkit.MessageBox.Show("Delete the selected entity?", "Delete entity", MessageBoxButton.YesNo);

            if (dialogres == System.Windows.MessageBoxResult.Yes)
            {
                _busyIndicator.Busy = true;
                result = await ServiceClient <IDeveloperService> .ExecuteAsync(o => o.DeleteAsync(entity));

                if (result)
                {
                    Developers.Remove(entity);
                    _eventAggregator.GetEvent <EntityEditPubEvent>().Publish(new DeveloperModel());
                }

                _busyIndicator.Busy = false;
            }
            DeleteAllCommand.RaiseCanExecuteChanged();
            return(result);
        }