|
@@ -58,8 +58,6 @@ namespace comal.timesheets
|
|
|
|
|
|
LoadSettings();
|
|
|
|
|
|
- ApplyComalSettings();
|
|
|
-
|
|
|
SaveSettings();
|
|
|
|
|
|
SetupClient();
|
|
@@ -93,24 +91,37 @@ namespace comal.timesheets
|
|
|
return;
|
|
|
|
|
|
string result = "";
|
|
|
+
|
|
|
+ while (string.IsNullOrWhiteSpace(result))
|
|
|
+ result = TryPing();
|
|
|
+
|
|
|
+ TrySetClientType(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void TrySetClientType(string result)
|
|
|
+ {
|
|
|
try
|
|
|
{
|
|
|
- result = JsonClient<User>.Ping(App.DBSettings.URLs, out DatabaseInfo info);
|
|
|
+ ClientFactory.SetClientType(typeof(JsonClient<>), "TimeBench", MobileUtils.AppVersion.InstalledVersionNumber + App.DeviceString, result, true);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- var log = new MobileLogging(LogType.BackgroundProcess, "JsonClient.Ping()", ex.Message + ex.StackTrace, this.GetType().Name);
|
|
|
- if (App.DBSettings.URLs[0].ToUpper().Contains("COM-AL"))
|
|
|
- result = "remote.com-al.com.au:8000";
|
|
|
+ var log = new MobileLogging(LogType.BackgroundProcess, "Client Factory SetClientType", ex.Message + ex.StackTrace, this.GetType().Name);
|
|
|
+ TrySetClientType(result);
|
|
|
}
|
|
|
- try
|
|
|
+ }
|
|
|
+
|
|
|
+ private string TryPing()
|
|
|
+ {
|
|
|
+ try
|
|
|
{
|
|
|
- ClientFactory.SetClientType(typeof(JsonClient<>), "TimeBench", MobileUtils.AppVersion.InstalledVersionNumber + App.DeviceString, result, true);
|
|
|
+ return JsonClient<User>.Ping(App.DBSettings.URLs, out DatabaseInfo info);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- var log = new MobileLogging(LogType.BackgroundProcess, "Client Factory SetClientType", ex.Message + ex.StackTrace, this.GetType().Name);
|
|
|
+ var log = new MobileLogging(LogType.BackgroundProcess, "JsonClient.Ping()", ex.Message + ex.StackTrace, this.GetType().Name);
|
|
|
}
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
private bool CheckLoadFromLink()
|
|
@@ -133,21 +144,6 @@ namespace comal.timesheets
|
|
|
catch { }
|
|
|
}
|
|
|
|
|
|
- private void ApplyComalSettings() //temporary fix
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- List<string> list = new List<string>
|
|
|
- {
|
|
|
- "remote.com-al.com.au:8000",
|
|
|
- "remote2.com-al.com.au:8000",
|
|
|
- "remote3.com-al.com.au:8000"
|
|
|
- };
|
|
|
-
|
|
|
- DBSettings.URLs = list.ToArray();
|
|
|
- }
|
|
|
- catch { }
|
|
|
- }
|
|
|
|
|
|
private void LoadSettings()
|
|
|
{
|