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


C# TimeEntryModel.LoadAsync方法代码示例

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


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

示例1: Init

 public static async Task<EditTimeEntryGroupViewModel> Init (List<string> timeEntryIds)
 {
     var timeEntryList = await GetTimeEntryDataList (timeEntryIds);
     var model = new TimeEntryModel (timeEntryList.Last ());
     await model.LoadAsync ();
     return new EditTimeEntryGroupViewModel (model, timeEntryList);
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:7,代码来源:EditTimeEntryGroupViewModel.cs

示例2: LoadData

 private async void LoadData ()
 {
     model = new TimeEntryModel (TimeEntryId);
     await model.LoadAsync ();
     if (model.Workspace == null || model.Workspace.Id == Guid.Empty) {
         // Invalid model, do nothing.
     } else {
         modelLoaded = true;
     }
 }
开发者ID:jblj,项目名称:mobile,代码行数:10,代码来源:RecentTimeEntryContinueDialogFragment.cs

示例3: LoadData

 private async void LoadData ()
 {
     model = new TimeEntryModel (TimeEntryId);
     await model.LoadAsync ();
     if (model.Workspace == null || model.Workspace.Id == Guid.Empty) {
         Dismiss ();
     } else {
         modelLoaded = true;
     }
 }
开发者ID:karabatov,项目名称:mobile,代码行数:10,代码来源:ChooseTimeEntryProjectDialogFragment.cs

示例4: Init

        public static async Task<EditTimeEntryViewModel> Init (Guid timeEntryId)
        {
            var model = new TimeEntryModel (timeEntryId);
            await model.LoadAsync ();

            var tagsView = await TimeEntryTagCollectionView.Init (timeEntryId);
            var tagList = tagsView.Data.ToList ();

            // If the entry is new, setup it a bit.
            if (model.State == TimeEntryState.New) {
                model.StartTime = Time.UtcNow.AddMinutes (-5);
                model.StopTime = Time.UtcNow;
                tagList = await GetDefaultTagList (model.Workspace.Id);
            }

            return new EditTimeEntryViewModel (model, tagList);
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:17,代码来源:EditTimeEntryViewModel.cs

示例5: GetTimeEntryData

        public static async Task<List<SimpleTimeEntryData>> GetTimeEntryData ()
        {
            var store = ServiceContainer.Resolve<IDataStore> ();
            var userId = ServiceContainer.Resolve<AuthManager> ().GetUserId ();

            var entries = await store.Table<TimeEntryData>()
                          .Where (r => r.State != TimeEntryState.New
                                  && r.DeletedAt == null
                                  && r.UserId == userId)
                          .OrderByDescending (r => r.StartTime)
                          .ToListAsync();

            var uniqueEntries = entries.GroupBy (x  => new {x.ProjectId, x.Description })
            .Select (grp => grp.First())
            .Take (itemCount)
            .ToList();

            var simpleEntries = new List<SimpleTimeEntryData> ();
            foreach (var entry in uniqueEntries) {
                var model = new TimeEntryModel (entry);
                await model.LoadAsync();

                int color = 0;
                String projectName = "";
                if (model.Project != null) {
                    color = model.Project.Color;
                    projectName = model.Project.Name;
                }
                var colorString = ProjectModel.HexColors [color % ProjectModel.HexColors.Length];

                simpleEntries.Add (
                new SimpleTimeEntryData {
                    Id = entry.Id,
                    IsRunning = entry.State == TimeEntryState.Running,
                    Description = entry.Description,
                    Project = projectName,
                    ProjectColor = colorString,
                    StartTime = entry.StartTime,
                    StopTime = entry.StopTime ?? DateTime.MinValue
                });
            }
            return simpleEntries;
        }
开发者ID:MrBloo63,项目名称:mobile,代码行数:43,代码来源:WearDataProvider.cs

示例6: CreateModelFromIntent

        private async void CreateModelFromIntent ()
        {
            var extras = Intent.Extras;
            if (extras == null)
                return;

            var extraIdStr = extras.GetString (ExtraTimeEntryId);
            Guid extraId;
            if (!Guid.TryParse (extraIdStr, out extraId))
                return;

            model = new TimeEntryModel (extraId);

            // Ensure that the model exists
            await model.LoadAsync ();
            if (model.Workspace == null || model.Workspace.Id == Guid.Empty) {
                Finish ();
            }
        }
开发者ID:jblj,项目名称:mobile,代码行数:19,代码来源:EditTimeEntryActivity.cs

示例7: Init

        public static async Task<EditTimeEntryViewModel> Init (Guid timeEntryId)
        {
            TimeEntryModel model;
            List<TagData> tagList;

            if (timeEntryId == Guid.Empty) {
                model = new TimeEntryModel (TimeEntryModel.GetDraft ());
                model.StartTime = Time.UtcNow.AddMinutes (-5);
                model.StopTime = Time.UtcNow;
                model.State = TimeEntryState.Finished;
                tagList = await GetDefaultTagList (model.Workspace.Id);
            } else {
                model = new TimeEntryModel (timeEntryId);
                await model.LoadAsync ();
                var tagsView = await TimeEntryTagCollectionView.Init (timeEntryId);
                tagList = tagsView.Data.ToList ();
            }

            return new EditTimeEntryViewModel (model, tagList);
        }
开发者ID:MrBloo63,项目名称:mobile,代码行数:20,代码来源:EditTimeEntryViewModel.cs

示例8: StartEntry

 private async Task StartEntry (Guid id)
 {
     var model = new TimeEntryModel (id);
     await model.LoadAsync();
     await TimeEntryModel.ContinueAsync (model.Data);
 }
开发者ID:MrBloo63,项目名称:mobile,代码行数:6,代码来源:WearDataService.cs

示例9: SyncModel

 private async Task SyncModel ()
 {
     var data = timeEntryManager.Active;
     if (data != null) {
         model = new TimeEntryModel (data);
         await model.LoadAsync ();
         UpdateView ();
     }
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:9,代码来源:LogTimeEntriesViewModel.cs

示例10: UpdateView

 private void UpdateView (bool isRunning, TimeEntryData data)
 {
     ServiceContainer.Resolve<IPlatformUtils> ().DispatchOnUIThread (async () => {
         // Check if an entry is running.
         if (isRunning) {
             var model = new TimeEntryModel (data);
             await model.LoadAsync ();
             Description = model.Description;
             ProjectName = model.Project != null ? model.Project.Name : string.Empty;
             IsTimeEntryRunning = true;
             durationTimer.Start ();
         } else {
             Description = string.Empty;
             ProjectName = string.Empty;
             IsTimeEntryRunning = false;
             durationTimer.Stop ();
             Duration = TimeSpan.FromSeconds (0).ToString ().Substring (0, 8);
         }
     });
 }
开发者ID:MrBloo63,项目名称:mobile,代码行数:20,代码来源:LogTimeEntriesViewModel.cs

示例11: LoadData

        private async void LoadData ()
        {
            timeEntry = new TimeEntryModel (TimeEntryId);
            workspace = new WorkspaceModel (WorkspaceId);
            await Task.WhenAll (timeEntry.LoadAsync (), workspace.LoadAsync ());

            if (timeEntry.Workspace == null || timeEntry.Workspace.Id == Guid.Empty) {
                // TODO: Better logic to determine if the models are actually non-existent
                Dismiss ();
            } else {
                modelsLoaded = true;
            }
        }
开发者ID:karabatov,项目名称:mobile,代码行数:13,代码来源:CreateProjectDialogFragment.cs


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