Beispiel #1
0
        async private void AddResume(object sender, RoutedEventArgs e)
        {
            var result = await AppStorageManager.
                         SaveResumeAsync(new Resume()
            {
                Name = $"Resume {_count}"
            });

            _count++;

            await RefreshUIAsync(result);
        }
Beispiel #2
0
        async private void ImportResume(object sender, RoutedEventArgs e)
        {
            var app_view = ApplicationView.GetForCurrentView();

            FileOpenPicker opener = new FileOpenPicker();

            opener.ViewMode = PickerViewMode.Thumbnail;
            opener.SuggestedStartLocation = PickerLocationId.Desktop;
            opener.CommitButtonText       = "Import the resume";
            opener.FileTypeFilter.Add(".resume");
            var selected_file = await opener.PickSingleFileAsync();

            if (selected_file != null)
            {
                //read and deserialize resume
                var resume = await Resume.FromStorageFileAsync(selected_file);

                if (resume == null)
                {
                    MessageDialog md = new MessageDialog("Cannot read resume data.");
                    await md.ShowAsync();

                    return;
                }

                //name resume
                var new_resume_id         = Guid.NewGuid().ToString();
                int current_storage_count = (await AppStorageManager.ListResumes()).Count;
                resume.Name     = $"resume import [{new_resume_id}]";
                resume.ResumeID = new_resume_id;


                //now store the resume in AppData
                var result = await AppStorageManager.
                             SaveResumeAsync(resume, CreationCollisionOption.GenerateUniqueName);
                await RefreshUIAsync(result);
            }
        }