Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:09:56+00:00 2026-06-16T00:09:56+00:00

I apologize in advance if my question is a bit vague. I am looking

  • 0

I apologize in advance if my question is a bit vague.

I am looking into and learning reactiveui which I find a very interesting concept. For that, I am building a small application using WPF and Prism and I am having some difficulties understanding the way commands are build in the View Models.

I have an example which, if complete, will hopefully clarify things for me a little bit:

I would like to have a grid that displays some data. This data is loaded from a web service and my goal is to load it once when the view is shown to the user and then to reload it every x times (once a minute, for example) or when explicitly triggered from a button in the View.

So, my View Model currently looks like:

public class MyPageViewModel : ReactiveValidatedObject
{
        /// <summary>
        /// Collection of tickets
        /// </summary>
        public ReactiveCollection<TicketModel> Tickets { get { return _Tickets.Value; } }

        /// <summary>
        /// Private store of tickets
        /// </summary>
        private ObservableAsPropertyHelper<ReactiveCollection<TicketModel>> _Tickets { get; set; }

        /// <summary>
        /// The service which retrieves the tickets
        /// </summary>
        private ITicketService _ticketService;

        public MyPageViewModel() : this(null) { }


        public MyPageViewModel(ITicketService ticketService)
        {
            LoadTickets = new ReactiveAsyncCommand(null, 0);
            }

        /// <summary>
        /// A command which exposes the load action for the tickets
        /// </summary>
        public ReactiveAsyncCommand LoadTickets { get; private set; }

        private void loadTickets()
        {
            //returns a List<TicketModel>
            var tickets = _ticketService.GetTickets();
        }
}

My questions are:

1) How do I register an async command which will be fired every x times and will call the internal loadTickets function that will reload the Ticket storage? This command will also be fired by the exposed command LoadTickets.

2) In the function, loadTickets I will fetch each time a List from the service. How do I convert this list to the ReactiveCollection that is exposed to the UI.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:09:56+00:00Added an answer on June 16, 2026 at 12:09 am

    1) How do I register an async command which will be fired every x times and will call the internal loadTickets function that will reload the Ticket storage? This command will also be fired by the exposed command LoadTickets.

    Observable.Timer(TimeSpan.FromSeconds(10), RxApp.DeferredScheduler)
        .InvokeCommand(LoadTickets);
    

    2) In the function, loadTickets I will fetch each time a List from the service. How do I convert this list to the ReactiveCollection that is exposed to the UI.

    // This makes it so when you invoke LoadTickets.Execute, Tickets
    // gets updated.
    // NB: Make loadTickets return a List<Ticket>
    LoadTickets.RegisterAsyncFunc(x => loadTickets())
        .Select(x => new ReactiveCollection<Ticket>(x))
        .ToProperty(this, x => x.Tickets);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very noobish question, so I apologize in advance! I have two
First of all I apologize in advance for this question, a bit off the
This is a very general question and i'd like to apologize in advance for
I'm very new to programming so I apologize in advance if my question is
I apologize in advance as this question is quite vague. About a month ago,
I apologize in advance for the general, possibly vague question but it's been on
This might be a bit of a noob question, so I apologize in advance.
Apologies in advance if this question is a bit vague. It's the result of
I'd like to apologize in advance, because this is not a very good question.
I apologize in advance if this question seems remedial. Which would be considered more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.