Merge pull request #5420 from larsbrubaker/main

default to include printing
This commit is contained in:
Lars Brubaker 2023-03-20 10:52:33 -07:00 committed by GitHub
commit ea6ced10d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 8 deletions

View file

@ -563,11 +563,25 @@ namespace MatterHackers.MatterControl
printer.Dispose();
}
public static void LaunchBrowser(string targetUri)
public static void LaunchBrowser(string targetUri)
{
string AddQueryPram(string url, string key, string value)
{
if (url.Contains("?"))
{
return url + "&" + key + "=" + value;
}
else
{
return url + "?" + key + "=" + value;
}
}
UiThread.RunOnIdle(() =>
{
if (!string.IsNullOrEmpty(OemSettings.Instance.AffiliateCode)
var affiliateCode = OemSettings.Instance.AffiliateCode;
if (!string.IsNullOrEmpty(affiliateCode)
&& targetUri.Contains("matterhackers.com"))
{
string internalLink = "";
@ -578,14 +592,15 @@ namespace MatterHackers.MatterControl
targetUri = targetUri.Substring(0, targetUri.Length - internalLink.Length);
}
if (targetUri.Contains("?"))
// if the affiliateCode is only numbers, we assume it is a tracking code
if (affiliateCode.All(char.IsDigit))
{
targetUri += $"&aff={OemSettings.Instance.AffiliateCode}";
targetUri = AddQueryPram(targetUri, "aff", affiliateCode);
}
else
else // it is an RCODE
{
targetUri += $"?aff={OemSettings.Instance.AffiliateCode}";
}
targetUri = AddQueryPram(targetUri, "rcode", affiliateCode);
}
targetUri += internalLink;
}

View file

@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.SettingsManagement
public bool ShowShopButton = true;
public bool DesignToolsOnly = true;
public bool DesignToolsOnly = false;
public bool CheckForUpdatesOnFirstRun = false;