当前位置: 首页>>代码示例>>C#>>正文


C# ReactiveList.Remove方法代码示例

本文整理汇总了C#中ReactiveList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ReactiveList.Remove方法的具体用法?C# ReactiveList.Remove怎么用?C# ReactiveList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReactiveList的用法示例。


在下文中一共展示了ReactiveList.Remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AccountsViewModel

        public AccountsViewModel(IAccountsService accountsService)
        {
            _accountsService = accountsService;
            Accounts = new ReactiveList<IAccount>(accountsService);
            LoginCommand = ReactiveCommand.Create();
            GoToAddAccountCommand = ReactiveCommand.Create();
            DeleteAccountCommand = ReactiveCommand.Create();

            DeleteAccountCommand.OfType<IAccount>().Subscribe(x =>
            {
                if (Equals(accountsService.ActiveAccount, x))
                    ActiveAccount = null;
                accountsService.Remove(x);
                Accounts.Remove(x);
            });

            LoginCommand.OfType<IAccount>().Subscribe(x =>
            {
                if (Equals(accountsService.ActiveAccount, x))
                    DismissCommand.ExecuteIfCan();
                else
                {
                    ActiveAccount = x;
                    MessageBus.Current.SendMessage(new LogoutMessage());
                    DismissCommand.ExecuteIfCan();
                }
            });

            GoToAddAccountCommand.Subscribe(_ => ShowViewModel(CreateViewModel<IAddAccountViewModel>()));

            this.WhenActivated(d => Accounts.Reset(accountsService));
        }
开发者ID:treejames,项目名称:CodeFramework,代码行数:32,代码来源:AccountsViewModel.cs

示例2: TrackingControlViewModel

        public TrackingControlViewModel(ITrackPresenter TrackPresenter, IMappingService MappingService, TrackFormatterManager TrackFormatterManager)
        {
            _trackPresenter = TrackPresenter;
            _trackFormatterManager = TrackFormatterManager;
            _mappingService = MappingService;

            _track = new ReactiveList<EarthPoint>();
            _track.Changed
                  .Subscribe(_ => RefreshTrack());

            LoadTrack = ReactiveCommand.CreateAsyncTask(LoadTrackImpl);
            SaveTrack = ReactiveCommand.CreateAsyncTask(SaveTrackImpl);
            ReactiveCommand<object> clearCommand = ReactiveCommand.Create(_track.IsEmptyChanged.Select(e => !e));
            clearCommand.Subscribe(_ => _track.Clear());
            ClearTrack = clearCommand;

            IConnectableObservable<TrackPathRider> prp =
                _track.Changed
                      .Select(_ => new TrackPathRider(new GpsTrack(_track.ToList())))
                      .Publish();
            PathRider = prp;
            prp.Connect();

            _mappingService.Clicks
                           .Where(c => c.Action == MouseAction.LeftClick)
                           .Subscribe(c => AppendPointToTrack(c.Point));

            _mappingService.Clicks
                           .Where(c => c.Action == MouseAction.RightClick)
                           .Subscribe(c => _track.Remove(_track.LastOrDefault()));
        }
开发者ID:NpoSaut,项目名称:netEMapTools,代码行数:31,代码来源:TrackingControlViewModel.cs

示例3: FileListViewModel

        public FileListViewModel(IScreen host)
        {
            HostScreen = host;

            Files = new ReactiveList<string>(new []
            {
                "c:/temp/foo.txt",
                "c:/temp/bar.txt",
                "c:/temp/baseball.dat",
                "c:/temp/basketball.dat",
                "c:/temp/handegg.dat"
            });

            var confirmDelete = new Interaction<Unit, string>();

            DeleteFile = ReactiveCommand.CreateFromTask(
                async () =>
                {
                    var fileToDelete = SelectedFile;
                    var baseMessage = $"Do you really want to delete {fileToDelete}?";
                    var help = "\nConfirm by entering the full file name below.";
                    var message = baseMessage + help;
                    var abort = this
                        .WhenAnyValue(x => x.SelectedFile)
                        .Skip(1)
                        .Select(_ => Unit.Default);

                    ConfirmDeleteViewModel = new ConfirmEventViewModel(abort, confirmDelete)
                    {
                        Message = message
                    };

                    while (true)
                    {
                        var confirmation = await confirmDelete.Handle(Unit.Default);

                        if (confirmation == fileToDelete)
                        {
                            SelectedFile = null;
                            Files.Remove(fileToDelete);
                            ConfirmDeleteViewModel = null;
                            break;
                        }

                        if (confirmation == null)
                        {
                            ConfirmDeleteViewModel = null;
                            break;
                        }

                        ConfirmDeleteViewModel.Message = baseMessage + "\nYou didn't type the right thing." + help;
                    }
                },
                this.WhenAnyValue(vm => vm.SelectedFile).Select(s => s != null));
        }
开发者ID:moswald,项目名称:RxUI-ConfirmationExample,代码行数:55,代码来源:FileListViewModel.cs

示例4: MainViewModel

 public MainViewModel()
 {
     People = new ReactiveList<PersonViewModel>();
     People.ActOnEveryObject(x => x.Delete.Subscribe(p => People.Remove((PersonViewModel) p)), _ => { });
     People.AddRange(new[]
     {
         new PersonViewModel("Jerry", "Seinfeld"),
         new PersonViewModel("George", "Costanza"),
         new PersonViewModel("Elaine", "Something"),
         new PersonViewModel("Newman", "Something"),
     });
 }
开发者ID:kmcginnes,项目名称:PoC.ReactiveCommandBubbling,代码行数:12,代码来源:MainViewModel.cs

示例5: FavoriteViewModel

        public FavoriteViewModel(Guid id, IEnumerable<FavoriteItemViewModel> favoriteItems) {
            _id = id;
            FavoriteItems = new ReactiveList<FavoriteItemViewModel>(favoriteItems);

            Listen<ContentFavorited>()
                .Select(x => x.Content.MapTo<FavoriteItemViewModel>())
                .ObserveOnMainThread()
                .Subscribe(FavoriteItems.Add);

            Listen<ContentUnFavorited>()
                .ObserveOnMainThread()
                .Select(x => FavoriteItems.Find(x.Content.Id))
                .Subscribe(x => FavoriteItems.Remove(x));
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:14,代码来源:FavoriteViewModel.cs

示例6: BaseMenuViewModel

        protected BaseMenuViewModel(IAccountsService accountsService)
        {
            AccountsService = accountsService;
            DeletePinnedRepositoryCommand = ReactiveCommand.Create();
            PinnedRepositories = new ReactiveList<PinnedRepository>(AccountsService.ActiveAccount.PinnnedRepositories);

            DeletePinnedRepositoryCommand.OfType<PinnedRepository>()
                .Subscribe(x =>
                {
                    AccountsService.ActiveAccount.PinnnedRepositories.Remove(x);
                    AccountsService.Update(AccountsService.ActiveAccount);
                    PinnedRepositories.Remove(x);
                });
        }
开发者ID:treejames,项目名称:CodeFramework,代码行数:14,代码来源:BaseMenuViewModel.cs

示例7: AccountsViewModel

        public AccountsViewModel(IAccountsService accountsService)
        {
            _accountsService = accountsService;

            _accounts = new ReactiveList<GitHubAccount>(accountsService.OrderBy(x => x.Username));
            this.WhenActivated(d => _accounts.Reset(accountsService.OrderBy(x => x.Username)));
            Accounts = _accounts.CreateDerivedCollection(CreateAccountItem);

            this.WhenAnyValue(x => x.ActiveAccount)
                .Subscribe(x =>
                {
                    foreach (var account in Accounts)
                        account.Selected = Equals(account.Account, x);
                });

            DeleteAccountCommand = ReactiveCommand.Create();
            DeleteAccountCommand.OfType<GitHubAccount>().Subscribe(x =>
            {
                if (Equals(accountsService.ActiveAccount, x))
                    ActiveAccount = null;
                accountsService.Remove(x);
                _accounts.Remove(x);
            });

            LoginCommand = ReactiveCommand.Create();
            LoginCommand.OfType<GitHubAccount>().Subscribe(x =>
            {
                if (Equals(accountsService.ActiveAccount, x))
                    DismissCommand.ExecuteIfCan();
                else
                {
                    ActiveAccount = x;
                    MessageBus.Current.SendMessage(new LogoutMessage());
                    DismissCommand.ExecuteIfCan();
                }
            });

            DismissCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.ActiveAccount).Select(x => x != null))
                                            .WithSubscription(x => base.DismissCommand.ExecuteIfCan(x));

            GoToAddAccountCommand = ReactiveCommand.Create()
                .WithSubscription(_ => ShowViewModel(CreateViewModel<NewAccountViewModel>()));

        }
开发者ID:nelsonnan,项目名称:CodeHub,代码行数:44,代码来源:AccountsViewModel.cs


注:本文中的ReactiveList.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。