diff --git a/Documents/GSC FIELD APP GUIDE.pdf b/Documents/GSC FIELD APP GUIDE.pdf
index ef10de8c..3b3df2c4 100644
Binary files a/Documents/GSC FIELD APP GUIDE.pdf and b/Documents/GSC FIELD APP GUIDE.pdf differ
diff --git a/Documents/GSC FIELD APP INSTALLATION.pdf b/Documents/GSC FIELD APP INSTALLATION.pdf
index 74e7b559..d5f59aa8 100644
Binary files a/Documents/GSC FIELD APP INSTALLATION.pdf and b/Documents/GSC FIELD APP INSTALLATION.pdf differ
diff --git a/GSCFieldApp/Resources/en-US/Resources.resw b/GSCFieldApp/Resources/en-US/Resources.resw
index d16b06e4..406fd836 100644
--- a/GSCFieldApp/Resources/en-US/Resources.resw
+++ b/GSCFieldApp/Resources/en-US/Resources.resw
@@ -1042,7 +1042,7 @@ Shimamura, Kaz – Senior Advisor
Geologist/Geolcode
- Station
+ Location
Type
@@ -1834,10 +1834,10 @@ Shimamura, Kaz – Senior Advisor
Units
- From (cm)
+ From (m)
- To (cm)
+ To (m)
Drill Holes
diff --git a/GSCFieldApp/Resources/fr/Resources.resw b/GSCFieldApp/Resources/fr/Resources.resw
index d0371a1b..4948ee9a 100644
--- a/GSCFieldApp/Resources/fr/Resources.resw
+++ b/GSCFieldApp/Resources/fr/Resources.resw
@@ -1040,7 +1040,7 @@ Shimamura, Kaz – Conseiller
Géologue/Code de géologue
- Station
+ Localisation
Type de projet
@@ -1529,10 +1529,10 @@ Shimamura, Kaz – Conseiller
Structure
- Ne pas utiliser symbole
+ Ne pas symboliser
- Utiliser symbole
+ Utiliser un symbole
Sommaire de la localisation
@@ -1829,10 +1829,10 @@ Shimamura, Kaz – Conseiller
Unité de mesure
- À partir de (cm)
+ À partir de (m)
- Jusqu'à (cm)
+ Jusqu'à (m)
Forages
diff --git a/GSCFieldApp/Services/DatabaseServices/DataAccess.cs b/GSCFieldApp/Services/DatabaseServices/DataAccess.cs
index 73470cc5..f8ab6fdf 100644
--- a/GSCFieldApp/Services/DatabaseServices/DataAccess.cs
+++ b/GSCFieldApp/Services/DatabaseServices/DataAccess.cs
@@ -102,7 +102,7 @@ private static SQLiteConnection DbConnection
{
get
{
- if (_dbConnection == null)
+ if (_dbConnection == null && File.Exists(DbPath))
{
return new SQLiteConnection(DbPath);
}
@@ -458,8 +458,6 @@ public List ReadTableFromDBConnectionWithoutClosingConnection(Type table
{
List tableRows = new List();
-
-
//Get the proper table object to read from it
TableMapping tableMap = inConnection.GetMapping(tableType);
@@ -483,6 +481,37 @@ public List ReadTableFromDBConnectionWithoutClosingConnection(Type table
}
+ return tableRows;
+
+ }
+
+ ///
+ /// Will return a list of object (rows) from a given table name.
+ /// In addition a query can be passed to filter results.
+ /// Can be used with any database, not the default working one.
+ ///
+ /// A query to filter table name, Can handle string.empty and null
+ /// A list of object that will act as rows.
+ public List ReadScalarFromDBConnectionWithoutClosingConnection(string query, SQLiteConnection inConnection)
+ {
+ List tableRows = new List();
+
+ //Check for table existance
+ try
+ {
+
+ //Get table info
+ if (query != string.Empty || query != null)
+ {
+ tableRows = inConnection.QueryScalars(query);
+ }
+ }
+ catch (Exception)
+ {
+
+ }
+
+
return tableRows;
}
diff --git a/GSCFieldApp/Services/FileServices/FileServices.cs b/GSCFieldApp/Services/FileServices/FileServices.cs
index c2aec103..57dd1421 100644
--- a/GSCFieldApp/Services/FileServices/FileServices.cs
+++ b/GSCFieldApp/Services/FileServices/FileServices.cs
@@ -310,6 +310,12 @@ public async Task SaveArchiveCopy(string fieldbookpath = "", string curr
}
}
+
+ //Clean up
+ if (File.Exists(tempZip))
+ {
+ File.Delete(tempZip);
+ }
}
return outputZipPhotoFilePath;
diff --git a/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs b/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
index b9a6e1bf..e44b115c 100644
--- a/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
+++ b/GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
@@ -157,24 +157,13 @@ private async void FillProjectCollectionAsync()
currentDB.metadataForProject = m as Metadata;
}
- //For stations
+ #region For stations
string stationQuerySelect = "SELECT *";
string stationQueryFrom = " FROM " + DatabaseLiterals.TableStation;
string stationQueryWhere = " WHERE " + DatabaseLiterals.TableStation + "." + DatabaseLiterals.FieldStationAlias + " NOT LIKE '%" + DatabaseLiterals.KeywordStationWaypoint + "%'";
string stationQueryFinal = stationQuerySelect + stationQueryFrom + stationQueryWhere;
List stationCountResult = accessData.ReadTableFromDBConnectionWithoutClosingConnection(stationModel.GetType(), stationQueryFinal, currentConnection);
- if (stationCountResult != null && stationCountResult.Count > 0)
- {
- currentDB.StationNumber = stationCountResult.Count.ToString();
- }
- else if (stationCountResult != null && stationCountResult.Count == 0)
- {
- currentDB.StationNumber = "0";
- }
- else
- {
- currentDB.StationNumber = "?";
- }
+
if (stationCountResult.Count != 0)
{
Station lastStation = (Station)stationCountResult[stationCountResult.Count - 1];
@@ -187,7 +176,22 @@ private async void FillProjectCollectionAsync()
StorageFolder parentFolder = await sfi.GetParentAsync();
currentDB.ProjectPath = parentFolder.Path;
}
+ #endregion
+ #region For locations
+ string queryLocation = "select count(*) from " + DatabaseLiterals.TableLocation;
+ List locationCountResult = accessData.ReadScalarFromDBConnectionWithoutClosingConnection(queryLocation, currentConnection);
+ if (locationCountResult != null && locationCountResult.Count() > 0)
+ {
+ currentDB.StationNumber = locationCountResult[0].ToString();
+ }
+ else
+ {
+ currentDB.StationNumber = 0.ToString();
+ }
+
+
+ #endregion
_projectCollection.Add(currentDB);
currentConnection.Close();
@@ -535,7 +539,6 @@ public async Task BackupFieldBook()
//Zip and Copy
string outputZipFilePath = await fs.SaveArchiveCopy(selectedBook.ProjectPath,
selectedBook.metadataForProject.UserCode);
-
}
}
@@ -568,6 +571,17 @@ public void SetFieldBook(FieldBooks fieldBook)
localSetting.SetSettingValue(DatabaseLiterals.FieldUserInfoPName, fieldBook.metadataForProject.ProjectName);
localSetting.SetSettingValue(DatabaseLiterals.FieldUserInfoActivityName, fieldBook.metadataForProject.MetadataActivity);
+ //Special setting for drill hole
+ if (fieldBook.metadataForProject.FieldworkType.Contains(DatabaseLiterals.KeywordDrill))
+ {
+ localSetting.SetSettingValue(DatabaseLiterals.TableDrillHoles, true);
+ }
+ else
+ {
+ localSetting.SetSettingValue(DatabaseLiterals.TableDrillHoles, false);
+ }
+
+
ApplicationData.Current.SignalDataChanged();
DataAccess.DbPath = fieldBook.ProjectDBPath;
}
diff --git a/GSCFieldApp/ViewModels/MapPageViewModel.cs b/GSCFieldApp/ViewModels/MapPageViewModel.cs
index 63d5df6e..4f5903c1 100644
--- a/GSCFieldApp/ViewModels/MapPageViewModel.cs
+++ b/GSCFieldApp/ViewModels/MapPageViewModel.cs
@@ -1992,6 +1992,7 @@ public async void myMapView_AddByTap(object sender, Windows.UI.Xaml.Input.Tapped
public async void LayerFlyout_ClosedAsync(object sender, object e)
{
await SetLayerOrderAsync();
+ SaveLayerRendering();
}
#endregion
@@ -2477,11 +2478,15 @@ public async Task AddUserLayers()
{
if (tpkList.ContainsKey(configs.LayerName))
{
- bool.TryParse(configs.LayerSettings.LayerVisibility.ToString(), out bool tpkVisibility);
- Double.TryParse(configs.LayerSettings.LayerOpacity.ToString(), out double tpkSliderSettingOpacity);
- await AddDataTypeTPK(tpkList[configs.LayerName], tpkVisibility, tpkSliderSettingOpacity / 100.0);
- tpkList.Remove(configs.LayerName);
- foundLayers = true;
+
+ if (esriMap == null || esriMap.AllLayers.Count(x => x.Name.Replace(".tpk", "") == configs.LayerName.Replace(".tpk", "")) == 0)
+ {
+ bool.TryParse(configs.LayerSettings.LayerVisibility.ToString(), out bool tpkVisibility);
+ Double.TryParse(configs.LayerSettings.LayerOpacity.ToString(), out double tpkSliderSettingOpacity);
+ await AddDataTypeTPK(tpkList[configs.LayerName], tpkVisibility, tpkSliderSettingOpacity / 100.0);
+ tpkList.Remove(configs.LayerName);
+ }
+
}
}
@@ -2498,19 +2503,25 @@ public async Task AddUserLayers()
{
foreach (KeyValuePair remainingTpks in tpkList)
{
- await AddDataTypeTPK(remainingTpks.Value, true, 1);
- MapPageLayers mpl = new MapPageLayers
+ if (esriMap == null || esriMap.AllLayers.Count(x => x.Name.Replace(".tpk", "") == remainingTpks.Key.Replace(".tpk", "")) == 0)
{
- LayerName = remainingTpks.Key
- };
- MapPageLayerSetting mpls = new MapPageLayerSetting
- {
- LayerOpacity = 100,
- LayerVisibility = true
- };
- mpl.LayerSettings = mpls;
- _filenameValues.Insert(0, mpl);
- RaisePropertyChanged("FilenameValues");
+ await AddDataTypeTPK(remainingTpks.Value, true, 1);
+
+ MapPageLayers mpl = new MapPageLayers
+ {
+ LayerName = remainingTpks.Key
+ };
+ MapPageLayerSetting mpls = new MapPageLayerSetting
+ {
+ LayerOpacity = 100,
+ LayerVisibility = true
+ };
+ mpl.LayerSettings = mpls;
+ _filenameValues.Insert(0, mpl);
+ RaisePropertyChanged("FilenameValues");
+ }
+
+
foundLayers = true;
}
}
@@ -2564,6 +2575,7 @@ public async Task AddDataTypeTPK(StorageFile inTPK, bool isTPKVisible = true, do
_tileLayer.IsVisible = isTPKVisible;
_tileLayer.Opacity = tpkOpacity;
+
esriMap.Basemap.BaseLayers.Add(_tileLayer);
//Shows Peojection in map view
@@ -2636,7 +2648,7 @@ public void SetLayerVisibility(ToggleSwitch inSwitch)
{
SetLayerVisibilityOrOpacity(inSwitch, inSwitch.Header.ToString());
- SaveLayerRendering();
+ //SaveLayerRendering();
}
diff --git a/GSCFieldApp/ViewModels/ShellViewModel.cs b/GSCFieldApp/ViewModels/ShellViewModel.cs
index c96bca71..41c13e64 100644
--- a/GSCFieldApp/ViewModels/ShellViewModel.cs
+++ b/GSCFieldApp/ViewModels/ShellViewModel.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Template10.Mvvm;
using Windows.Storage;
using Windows.UI.Xaml;
@@ -148,7 +149,7 @@ public async void QuickBackupAsync()
}
//If any photos needs to be copied, else show warning
- if (FilesToBackup.Count > 1)
+ if (FilesToBackup.Count > 1 && FilesToBackup.Where(x=>x.FileType != DatabaseLiterals.DBTypeSqlite).Count() > 0)
{
//Copy database and rename it
List newList = new List();
diff --git a/GSCFieldApp/Views/MapPage.xaml b/GSCFieldApp/Views/MapPage.xaml
index 6abf4424..7af1b04f 100644
--- a/GSCFieldApp/Views/MapPage.xaml
+++ b/GSCFieldApp/Views/MapPage.xaml
@@ -86,7 +86,7 @@
-
+
diff --git a/GSCFieldApp/Views/MapPage.xaml.cs b/GSCFieldApp/Views/MapPage.xaml.cs
index 3a26dc4b..8e67b447 100644
--- a/GSCFieldApp/Views/MapPage.xaml.cs
+++ b/GSCFieldApp/Views/MapPage.xaml.cs
@@ -380,7 +380,7 @@ public void SetBackgroundGrid()
private async void MapPageAddMap_Tapped(object sender, TappedRoutedEventArgs e)
{
//Refresh
- UpdateLayout();
+ //UpdateLayout();
//Load
try