예제 #1
0
        public static async Task <UserActivityViewModel> CreateFromFileAsync(StorageFile file, string token, bool isSaveable)
        {
            UserActivityViewModel answer = (UserActivityViewModel)Activator.CreateInstance(typeof(UserActivityViewModel));

            answer.IsSaveable = isSaveable;

            await answer.LoadFromFileAsync(file, token, true);

            return(answer);
        }
        public async void CloseActivity(UserActivityViewModel document)
        {
            // TODO: Check if not saved
            int index = OpenActivities.IndexOf(document);

            if (index != -1)
            {
                OpenActivities.RemoveAt(index);

                if (index < OpenActivities.Count)
                {
                    CurrentActivity = OpenActivities[index];
                }
                else
                {
                    CurrentActivity = OpenActivities.LastOrDefault();
                }

                if (document.Token != null)
                {
                    await SaveFileTokensAsync();
                }
            }
        }
 protected async Task <UserActivityViewModel> LoadFromFileAsync(StorageFile file, string token, bool isSaveable)
 {
     return(await UserActivityViewModel.CreateFromFileAsync(file, token, isSaveable));
 }
 private void AddActivity(UserActivityViewModel doc)
 {
     OpenActivities.Add(doc);
     doc.OnRequestClose          += Doc_OnRequestClose;
     doc.OnRequestSaveFileTokens += Doc_OnRequestSaveFileTokens;
 }
 private async void AddAndSelectActivity(UserActivityViewModel doc)
 {
     AddActivity(doc);
     CurrentActivity = OpenActivities.LastOrDefault();
     await SaveFileTokensAsync();
 }
 protected UserActivityViewModel CreateNewActivity()
 {
     return(UserActivityViewModel.CreateNew());
 }