diff --git a/GSCFieldApp/GSCFieldApp.csproj b/GSCFieldApp/GSCFieldApp.csproj
index 87f30226..3aee7271 100644
--- a/GSCFieldApp/GSCFieldApp.csproj
+++ b/GSCFieldApp/GSCFieldApp.csproj
@@ -147,7 +147,6 @@
Always
-
Always
diff --git a/GSCFieldApp/Package.appxmanifest b/GSCFieldApp/Package.appxmanifest
index 7a39a1c1..213e497c 100644
--- a/GSCFieldApp/Package.appxmanifest
+++ b/GSCFieldApp/Package.appxmanifest
@@ -1,6 +1,6 @@
-
+
Geological Survey Canada Field Application
diff --git a/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs b/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs
index 79b5839c..0325ef82 100644
--- a/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs
+++ b/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs
@@ -4,6 +4,7 @@
using SQLite;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Template10.Common;
using Template10.Mvvm;
@@ -22,7 +23,7 @@ public class FieldBookDialogViewModel : ViewModelBase
public FieldBooks existingUserDetail;
//UI
- private List _projectType = new List();
+ private ObservableCollection _projectType = new ObservableCollection();
private string _selectedProjectType = string.Empty;
private string _startStationNumber = "1";
private string _projectName = string.Empty;
@@ -119,7 +120,7 @@ public string StartStationNumber
public string ActivityName { get { return _activityName; } set { _activityName = value; } }
public string Notes { get { return _notes; } set { _notes = value; } }
- public List ProjectType { get { return _projectType; } set { _projectType = value; } }
+ public ObservableCollection ProjectType { get { return _projectType; } set { _projectType = value; } }
public string SelectedProjectType { get { return _selectedProjectType; } set { _selectedProjectType = value; } }
public bool Enability { get { return _enability; } set { _enability = value; } }
@@ -141,7 +142,10 @@ private void FillProjectType()
//Init.
string fieldName = Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType;
- _projectType = accessData.GetComboboxListWithVocab(userTable, fieldName, out _selectedProjectType);
+ foreach (var pType in accessData.GetComboboxListWithVocab(userTable, fieldName, out _selectedProjectType))
+ {
+ _projectType.Add(pType);
+ }
//Update UI
RaisePropertyChanged("ProjectType");
@@ -259,6 +263,7 @@ public void AutoFillDialog(FieldBooks incomingData)
RaisePropertyChanged("GeologistLN");
RaisePropertyChanged("Notes");
RaisePropertyChanged("ActivityName");
+ RaisePropertyChanged("SelectedProjectType");
}
diff --git a/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs b/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
index e44b115c..623b140b 100644
--- a/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
+++ b/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
@@ -19,7 +19,6 @@
using Windows.Storage.Pickers;
using Windows.UI.Core;
using Template10.Utils;
-using System.Diagnostics;
using Esri.ArcGISRuntime.Geometry;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -38,7 +37,7 @@ public class FieldBooksPageViewModel : ViewModelBase
#region INITIALIZATION
//UI
- public ObservableCollection _projectCollection = new ObservableCollection();
+ private ObservableCollection _projectCollection = new ObservableCollection();
public int _selectedProjectIndex = -1;
private bool _noFieldBookWatermark = false;
@@ -71,6 +70,7 @@ public class FieldBooksPageViewModel : ViewModelBase
public ObservableCollection ProjectCollection
{
get { return _projectCollection; }
+ set { _projectCollection = value; }
}
public bool ProgressRingActive
@@ -90,9 +90,6 @@ public bool ProgressRingVisibility
public FieldBooksPageViewModel()
{
- _projectCollection = new ObservableCollection();
- RaisePropertyChanged("ProjectCollection");
-
//Fill list view of projects
FillProjectCollectionAsync();
@@ -119,116 +116,135 @@ private void FieldBookDialog_newFieldBookSaved(object sender, EventArgs e)
///
/// Will fill the project collection with information related to it
///
- private async void FillProjectCollectionAsync()
+ private async Task FillProjectCollectionAsync()
{
- _projectCollection.Clear();
+ _projectCollection = new ObservableCollection();
+ ProjectCollection = _projectCollection;
RaisePropertyChanged("ProjectCollection");
List invalidFieldBookToDelete = new List();
- //Iterate through local state folder
- IReadOnlyList localStateFolders = await ApplicationData.Current.LocalFolder.GetFoldersAsync();
- IEnumerable reverseStateList = localStateFolders.Reverse();
-
- foreach (StorageFolder sf in reverseStateList)
+ if (_projectCollection.Count() == 0)
{
- //Get files
- IReadOnlyList localFiles = await sf.GetFilesAsync();
- foreach (StorageFile sfi in localFiles)
+ //Iterate through local state folder
+ IReadOnlyList localStateFolders = await ApplicationData.Current.LocalFolder.GetFoldersAsync();
+ IEnumerable reverseStateList = localStateFolders.Reverse();
+
+ foreach (StorageFolder sf in reverseStateList)
{
- //Get the database
- if ((sfi.FileType.Contains(DatabaseLiterals.DBTypeSqlite) || sfi.FileType.Contains(DatabaseLiterals.DBTypeSqliteDeprecated))
- && sfi.DisplayName == DatabaseLiterals.DBName)
+ //Get files
+ IReadOnlyList localFiles = await sf.GetFilesAsync();
+ foreach (StorageFile sfi in localFiles)
{
- FieldBooks currentDB = new FieldBooks();
-
- using (SQLiteConnection currentConnection = accessData.GetConnectionFromPath(sfi.Path))
+ //Get the database
+ if ((sfi.FileType.Contains(DatabaseLiterals.DBTypeSqlite) || sfi.FileType.Contains(DatabaseLiterals.DBTypeSqliteDeprecated))
+ && sfi.DisplayName == DatabaseLiterals.DBName)
{
- List