Ejemplo n.º 1
0
        /// <summary>
        /// Request the change or conflict list depending on the state of the model. The result is then given to the
        /// view to populate itself. Fire and forget method -- must be run on main thread.
        /// </summary>
        void UpdateChangeList()
        {
            Assert.IsTrue(Threading.IsMainThread, "Updating the change lists must be done from the main thread.");

            // Fetch and send data to the UI depending on what's the current display mode.
            if (m_Model.Conflicted)
            {
                Task.Run(() => m_Model.GetConflictedEntries(m_Model.SavedSearchQuery))
                .ContinueWith(r => m_View.SetConflicts(r.Result), TaskScheduler.FromCurrentSynchronizationContext());
            }
            else
            {
                Task.Run(() => m_Model.GetAllEntries(m_Model.SavedSearchQuery))
                .ContinueWith(r => m_View.SetChanges(r.Result), TaskScheduler.FromCurrentSynchronizationContext());
            }
        }