product tour only local

This commit is contained in:
Lars Brubaker 2022-02-17 09:03:25 -08:00
parent 048e20b659
commit 09edb55ba4
2 changed files with 5 additions and 25 deletions

View file

@ -1862,29 +1862,6 @@ namespace MatterHackers.MatterControl
/// </summary>
public bool AnyPrintTaskRunning => this.ActivePrinters.Any(p => p.Connection.Printing || p.Connection.Paused || p.Connection.CommunicationState == CommunicationStates.PreparingToPrint);
private List<TourLocation> _productTour;
public async Task<List<TourLocation>> LoadProductTour()
{
if (_productTour == null)
{
_productTour = await ApplicationController.LoadCacheableAsync<List<TourLocation>>(
"ProductTour.json",
"MatterHackers",
async () =>
{
var httpClient = new HttpClient();
string json = await httpClient.GetStringAsync("https://matterhackers.github.io/MatterControl-Help/docs/product-tour.json");
// string json = await httpClient.GetStringAsync("https://matterhackers.github.io/MatterControl-Docs/Help/product-tour.json");
return JsonConvert.DeserializeObject<List<TourLocation>>(json);
},
Path.Combine("OemSettings", "ProductTour.json"));
}
return _productTour;
}
public event EventHandler<ApplicationTopBarCreatedEventArgs> ApplicationTopBarCreated;
public void NotifyPrintersTabRightElement(GuiWidget sourceExentionArea)

View file

@ -28,9 +28,12 @@ either expressed or implied, of the FreeBSD Project.
*/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using Newtonsoft.Json;
namespace MatterHackers.MatterControl.Tour
{
@ -51,11 +54,11 @@ namespace MatterHackers.MatterControl.Tour
public IReadOnlyList<TourLocation> Locations => tourLocations;
public static async void StartTour()
public static void StartTour()
{
var topWindow = ApplicationController.Instance.MainView.TopmostParent() as SystemWindow;
var tourLocations = await ApplicationController.Instance.LoadProductTour();
var tourLocations = JsonConvert.DeserializeObject<List<TourLocation>>(StaticData.Instance.ReadAllText(Path.Combine("OEMSettings", "ProductTour.json")));
// Finding matching widgets by name
var visibleTourWidgets = topWindow.FindDescendants(tourLocations.Select(t => t.WidgetName));