本文整理汇总了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);
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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 ();
}
}
示例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);
}
示例8: StartEntry
private async Task StartEntry (Guid id)
{
var model = new TimeEntryModel (id);
await model.LoadAsync();
await TimeEntryModel.ContinueAsync (model.Data);
}
示例9: SyncModel
private async Task SyncModel ()
{
var data = timeEntryManager.Active;
if (data != null) {
model = new TimeEntryModel (data);
await model.LoadAsync ();
UpdateView ();
}
}
示例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);
}
});
}
示例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;
}
}