Skip to content

Commit

Permalink
Just a few updates for later to allow for check of new release
Browse files Browse the repository at this point in the history
  • Loading branch information
jameljoseph committed Jun 10, 2024
2 parents 3d0a7fd + e15d5be commit 824aece
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 46 deletions.
Binary file modified Documents/GSC FIELD APP GUIDE.pdf
Binary file not shown.
Binary file modified Documents/GSC FIELD APP INSTALLATION.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions GSCFieldApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ Shimamura, Kaz – Senior Advisor</value>
<value>Geologist/Geolcode</value>
</data>
<data name="ProjectListStationHeader.Text" xml:space="preserve">
<value>Station</value>
<value>Location</value>
</data>
<data name="ProjectListTypeHeader.Text" xml:space="preserve">
<value>Type</value>
Expand Down Expand Up @@ -1834,10 +1834,10 @@ Shimamura, Kaz – Senior Advisor</value>
<value>Units</value>
</data>
<data name="DrilllogIntervalsFrom.Header" xml:space="preserve">
<value>From (cm)</value>
<value>From (m)</value>
</data>
<data name="DrilllogIntervalsTo.Header" xml:space="preserve">
<value>To (cm)</value>
<value>To (m)</value>
</data>
<data name="FieldworkTableDrill.Text" xml:space="preserve">
<value>Drill Holes</value>
Expand Down
10 changes: 5 additions & 5 deletions GSCFieldApp/Resources/fr/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ Shimamura, Kaz – Conseiller</value>
<value>Géologue/Code de géologue</value>
</data>
<data name="ProjectListStationHeader.Text" xml:space="preserve">
<value>Station</value>
<value>Localisation</value>
</data>
<data name="ProjectListTypeHeader.Text" xml:space="preserve">
<value>Type de projet</value>
Expand Down Expand Up @@ -1529,10 +1529,10 @@ Shimamura, Kaz – Conseiller</value>
<value>Structure</value>
</data>
<data name="SettingPageToggleSymbolStructure.OffContent" xml:space="preserve">
<value>Ne pas utiliser symbole</value>
<value>Ne pas symboliser</value>
</data>
<data name="SettingPageToggleSymbolStructure.OnContent" xml:space="preserve">
<value>Utiliser symbole</value>
<value>Utiliser un symbole</value>
</data>
<data name="MapPageIdentifyStationDialogTitle" xml:space="preserve">
<value>Sommaire de la localisation</value>
Expand Down Expand Up @@ -1829,10 +1829,10 @@ Shimamura, Kaz – Conseiller</value>
<value>Unité de mesure</value>
</data>
<data name="DrilllogIntervalsFrom.Header" xml:space="preserve">
<value>À partir de (cm)</value>
<value>À partir de (m)</value>
</data>
<data name="DrilllogIntervalsTo.Header" xml:space="preserve">
<value>Jusqu'à (cm)</value>
<value>Jusqu'à (m)</value>
</data>
<data name="FieldworkTableDrill.Text" xml:space="preserve">
<value>Forages</value>
Expand Down
35 changes: 32 additions & 3 deletions GSCFieldApp/Services/DatabaseServices/DataAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static SQLiteConnection DbConnection
{
get
{
if (_dbConnection == null)
if (_dbConnection == null && File.Exists(DbPath))
{
return new SQLiteConnection(DbPath);
}
Expand Down Expand Up @@ -458,8 +458,6 @@ public List<object> ReadTableFromDBConnectionWithoutClosingConnection(Type table
{
List<object> tableRows = new List<object>();



//Get the proper table object to read from it
TableMapping tableMap = inConnection.GetMapping(tableType);

Expand All @@ -483,6 +481,37 @@ public List<object> ReadTableFromDBConnectionWithoutClosingConnection(Type table
}


return tableRows;

}

/// <summary>
/// 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.
/// </summary>
/// <param name="query">A query to filter table name, Can handle string.empty and null</param>
/// <returns>A list of object that will act as rows.</returns>
public List<int> ReadScalarFromDBConnectionWithoutClosingConnection(string query, SQLiteConnection inConnection)
{
List<int> tableRows = new List<int>();

//Check for table existance
try
{

//Get table info
if (query != string.Empty || query != null)
{
tableRows = inConnection.QueryScalars<int>(query);
}
}
catch (Exception)
{

}


return tableRows;

}
Expand Down
6 changes: 6 additions & 0 deletions GSCFieldApp/Services/FileServices/FileServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ public async Task<string> SaveArchiveCopy(string fieldbookpath = "", string curr
}

}

//Clean up
if (File.Exists(tempZip))
{
File.Delete(tempZip);
}
}

return outputZipPhotoFilePath;
Expand Down
42 changes: 28 additions & 14 deletions GSCFieldApp/ViewModels/FieldBooksPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<object> 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];
Expand All @@ -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<int> 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();
Expand Down Expand Up @@ -535,7 +539,6 @@ public async Task BackupFieldBook()
//Zip and Copy
string outputZipFilePath = await fs.SaveArchiveCopy(selectedBook.ProjectPath,
selectedBook.metadataForProject.UserCode);

}
}

Expand Down Expand Up @@ -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;
}
Expand Down
48 changes: 30 additions & 18 deletions GSCFieldApp/ViewModels/MapPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2477,11 +2478,15 @@ public async Task<bool> 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);
}

}

}
Expand All @@ -2498,19 +2503,25 @@ public async Task<bool> AddUserLayers()
{
foreach (KeyValuePair<string, StorageFile> 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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2636,7 +2648,7 @@ public void SetLayerVisibility(ToggleSwitch inSwitch)
{
SetLayerVisibilityOrOpacity(inSwitch, inSwitch.Header.ToString());

SaveLayerRendering();
//SaveLayerRendering();
}


Expand Down
3 changes: 2 additions & 1 deletion GSCFieldApp/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<StorageFile> newList = new List<StorageFile>();
Expand Down
2 changes: 1 addition & 1 deletion GSCFieldApp/Views/MapPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Foreground="White" Icon="OpenFile" x:Uid="MapPageAddMaps" x:Name="MapPageAddMap" Tapped="MapPageAddMap_Tapped" ToolTipService.ToolTip=""/>
<AppBarButton x:Name="AddMaps" Label="" x:Uid="MapPageMapMenu" Foreground="White" VerticalAlignment="Top" ToolTipService.ToolTip="" Style="{StaticResource AppBarHiddenChevron}">
<AppBarButton x:Name="AddMaps" Label="" x:Uid="MapPageMapMenu" Foreground="White" VerticalAlignment="Top" ToolTipService.ToolTip="" Style="{StaticResource AppBarHiddenChevron}">
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE81E;"/>
</AppBarButton.Icon>
Expand Down
2 changes: 1 addition & 1 deletion GSCFieldApp/Views/MapPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public void SetBackgroundGrid()
private async void MapPageAddMap_Tapped(object sender, TappedRoutedEventArgs e)
{
//Refresh
UpdateLayout();
//UpdateLayout();

//Load
try
Expand Down

0 comments on commit 824aece

Please sign in to comment.