changed get("ClientToken") GetClientToken()

This commit is contained in:
Lars Brubaker 2016-08-26 18:30:21 -07:00
parent 024cfd85b8
commit c6d0408ab9
10 changed files with 62 additions and 17 deletions

View file

@ -375,10 +375,10 @@ namespace MatterHackers.MatterControl
private UpdateControlData()
{
CheckVersionStatus();
if (ApplicationSettings.Instance.get("ClientToken") != null
if (ApplicationSettings.Instance.GetClientToken() != null
|| OemSettings.Instance.CheckForUpdatesOnFirstRun)
{
if (ApplicationSettings.Instance.get("ClientToken") == null)
if (ApplicationSettings.Instance.GetClientToken() == null)
{
updateRequestType = UpdateRequestType.FirstTimeEver;
}

View file

@ -61,7 +61,14 @@ namespace MatterHackers.MatterControl
{
public class MatterControlApplication : SystemWindow
{
public static bool CameraPreviewActive = false;
#if DEBUG
//public static string MCWSBaseUri { get; } = "http://192.168.2.129:9206";
public static string MCWSBaseUri { get; } = "https://mattercontrol-test.appspot.com";
#else
public static string MCWSBaseUri { get; } = "https://mattercontrol.appspot.com";
#endif
public static bool CameraPreviewActive = false;
public bool RestartOnClose = false;
private static readonly Vector2 minSize = new Vector2(600, 600);
private static MatterControlApplication instance;
@ -116,6 +123,11 @@ namespace MatterHackers.MatterControl
{
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData();
}
if (OemSettings.Instance.ForceTestEnvironment)
{
MCWSBaseUri = "https://mattercontrol-test.appspot.com";
}
}
private MatterControlApplication(double width, double height)
@ -404,13 +416,6 @@ namespace MatterHackers.MatterControl
}
}
#if DEBUG
//public static string MCWSBaseUri { get; } = "http://192.168.2.129:9206";
public static string MCWSBaseUri { get; } = "https://mattercontrol-test.appspot.com";
#else
public static string MCWSBaseUri { get;} = "https://mattercontrol.appspot.com";
#endif
public static void LoadUITheme()
{
//Load the default theme by index

View file

@ -1,6 +1,7 @@
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.SettingsManagement;
using System.Collections.Generic;
using System;
namespace MatterHackers.MatterControl
{
@ -50,6 +51,31 @@ namespace MatterHackers.MatterControl
return oemName;
}
private string GetClientTokenKeyName()
{
string keyName = "ClientToken";
#if DEBUG
keyName += "_Test";
#else
if(OemSettings.Instance.ForceTestEnvironment)
{
keyName += "_Test";
}
#endif
return keyName;
}
public string GetClientToken()
{
return get(GetClientTokenKeyName());
}
public void SetClientToken(string clientToken)
{
set(GetClientTokenKeyName(), clientToken);
}
public string get(string key)
{
string result;

View file

@ -65,6 +65,8 @@ namespace MatterHackers.MatterControl.SettingsManagement
}
}
public bool ForceTestEnvironment = false;
public bool UseSimpleModeByDefault = false;
public string ThemeColor = "";

View file

@ -1,7 +1,7 @@
{
"ThemeColor": "",
"AffiliateCode": "5NEP8W",
"WindowTitleExtra": "",
"WindowTitleExtra": "Lars Title",
"ShowShopButton": true,
"CheckForUpdatesOnFirstRun": false,
"ManufacturerNameMappings": [

View file

@ -5332,3 +5332,15 @@ Translated:- default -
English:Profile History
Translated:Profile History
English:Detect sections of the model that would be too thin to print, expand them, and print them.
Translated:Detect sections of the model that would be too thin to print, expand them, and print them.
English:Detect gaps between perimeters that are too thin to fill with normal infill and attempt to fill them.
Translated:Detect gaps between perimeters that are too thin to fill with normal infill and attempt to fill them.
English:Expand Thin Walls
Translated:Expand Thin Walls
English:Fill Thin Gaps
Translated:Fill Thin Gaps

@ -1 +1 @@
Subproject commit 2b09202a784ae8ba66c9d04911b35c7cf5e5a18a
Subproject commit c36a5ba10e96a4b23129fd0cb51e49d24b136d24

View file

@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.VersionManagement
string clientToken = responseValues.get("ClientToken");
if (clientToken != null)
{
ApplicationSettings.Instance.set("ClientToken", clientToken);
ApplicationSettings.Instance.SetClientToken(clientToken);
}
}
}

View file

@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.VersionManagement
public override void Request()
{
//If the client token exists, use it, otherwise wait for client token before making request
if (ApplicationSettings.Instance.get("ClientToken") == null)
if (ApplicationSettings.Instance.GetClientToken() == null)
{
ClientTokenRequest request = new ClientTokenRequest();
request.RequestSucceeded += new EventHandler(onClientTokenRequestSucceeded);
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.VersionManagement
public void onClientTokenReady()
{
string clientToken = ApplicationSettings.Instance.get("ClientToken");
string clientToken = ApplicationSettings.Instance.GetClientToken();
requestValues["ClientToken"] = clientToken;
if (clientToken != null)
{

View file

@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.VersionManagement
public override void Request()
{
//If the client token exists, use it, otherwise wait for client token before making request
if (ApplicationSettings.Instance.get("ClientToken") == null)
if (ApplicationSettings.Instance.GetClientToken() == null)
{
ClientTokenRequest request = new ClientTokenRequest();
request.RequestSucceeded += new EventHandler(onRequestSucceeded);
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.VersionManagement
public void onClientTokenReady()
{
string clientToken = ApplicationSettings.Instance.get("ClientToken");
string clientToken = ApplicationSettings.Instance.GetClientToken();
requestValues["ClientToken"] = clientToken;
if (clientToken != null)
{