Merge branch 'tizen' of ssh://review.tizen.org:29418/profile/tv/apps/dotnet/mediahub... 39/148839/1
authorSung-jae Park <nicesj@nicesj.com>
Mon, 11 Sep 2017 04:46:49 +0000 (13:46 +0900)
committerSung-jae Park <nicesj@nicesj.com>
Mon, 11 Sep 2017 04:46:49 +0000 (13:46 +0900)
Change-Id: Ie85e9df936ae67c78a63a65311f6e3c12bfa57f1
Signed-off-by: Sung-jae Park <nicesj@nicesj.com>
1  2 
TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs

@@@ -198,50 -198,48 +198,49 @@@ namespace TVMediaHub.Tizen.Model
          /// <param name="mediaInformationExList">A list of MediaInformationEx</param>
          /// <param name="sortOption">The current sort option</param>
          /// <returns>A list of group item</returns>
 -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
          private async Task<IEnumerable<GroupItem>> MakeGroupAsync(IEnumerable<MediaInformationEx> mediaInformationExList, SortOption sortOption)
 -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
          {
 -            List<GroupItem> result = new List<GroupItem>();
 -            GroupItem lastGroupItem = null;
 -            GroupItem currentGroupItem = null;
 -
 -            if (mediaInformationExList == null)
 +            return await Task.Run(() =>
              {
-                 DbgPort.D("MG Async");
 -                throw new System.ArgumentException("mediaInformationExList must not be null.");
 -            }
 +                List<GroupItem> result = new List<GroupItem>();
 +                GroupItem lastGroupItem = null;
 +                GroupItem currentGroupItem = null;
  
 -            foreach (MediaInformationEx mediaInformationEx in mediaInformationExList)
 -            {
 -                var currentInformation = mediaInformationEx;
 -                var shortcutInfo = new MediaShortcutInfo(currentInformation);
 -
 -                // TODO : The catch implementation should be checked once again.
 -                try
 -                {
 -                    currentGroupItem = GetGroupItem(sortOption, currentGroupItem, mediaInformationEx);
 -                }
 -                catch (Exception e)
 +                if (mediaInformationExList == null)
                  {
 -                    DbgPort.E(e.Message);
 -                    return null;
 +                    throw new System.ArgumentException("mediaInformationExList must not be null.");
                  }
  
 -                if (lastGroupItem != currentGroupItem)
 +                foreach (MediaInformationEx mediaInformationEx in mediaInformationExList)
                  {
 -                    result.Add(currentGroupItem);
 -                    lastGroupItem = currentGroupItem;
 -                }
 +                    var currentInformation = mediaInformationEx;
 +                    var shortcutInfo = new MediaShortcutInfo(currentInformation);
  
 -                if (currentGroupItem != null)
 -                {
 -                    currentGroupItem.Contents.Add(shortcutInfo);
 +                    // TODO : The catch implementation should be checked once again.
 +                    try
 +                    {
 +                        currentGroupItem = GetGroupItem(sortOption, currentGroupItem, mediaInformationEx);
 +                    }
 +                    catch (Exception e)
 +                    {
 +                        DbgPort.E(e.Message);
 +                        return null;
 +                    }
 +
 +                    if (lastGroupItem != currentGroupItem)
 +                    {
 +                        result.Add(currentGroupItem);
 +                        lastGroupItem = currentGroupItem;
 +                    }
 +
 +                    if (currentGroupItem != null)
 +                    {
 +                        currentGroupItem.Contents.Add(shortcutInfo);
 +                    }
                  }
 -            }
  
 -            return result;
 +                return result;
 +            });
          }
  
          /// <summary>