diff --git a/PCUT/Http.Core/Contexts/UserContext.cs b/PCUT/Http.Core/Contexts/UserContext.cs index 07d14d7..1844b99 100644 --- a/PCUT/Http.Core/Contexts/UserContext.cs +++ b/PCUT/Http.Core/Contexts/UserContext.cs @@ -25,12 +25,14 @@ namespace Http.Core.Contexts } } + public bool DebugFeaturesEnabled { get; set; } = false; + public UserProfile Profile { get; private set; } public string AccessToken { get; private set; } public string RefreshToken { get; private set; } + public DateTime? ExpiredTime { get; private set; } public string DeviceId { get; private set; } public string AppVersion { get; private set; } - public DateTime? ExpiredTime { get; private set; } public bool IsPermittedEdit => Profile.Role == "admin" || (Profile.IsPermittedEdit ?? false); diff --git a/PCUT/PCUT/App.xaml.cs b/PCUT/PCUT/App.xaml.cs index d96ec8e..ab00b05 100644 --- a/PCUT/PCUT/App.xaml.cs +++ b/PCUT/PCUT/App.xaml.cs @@ -59,6 +59,7 @@ namespace PCUT .AddConfigureClient(client => { client.BaseAddress = new Uri(Api.BaseUrl); }) .AddHttpMessageHandler(() => new DeviceAuthHandler()) .AddHttpMessageHandler(() => new AuthenticationHandler()); + UserContext.Instance.DebugFeaturesEnabled = false; } public IServiceProvider AppContainer { get; } @@ -70,7 +71,7 @@ namespace PCUT protected override void OnLaunched(LaunchActivatedEventArgs e) { UserContext.Instance.SetAppVersion(GetAppVersion()); - ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false; + ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = UserContext.Instance.DebugFeaturesEnabled; Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active diff --git a/PCUT/PCUT/Package.appxmanifest b/PCUT/PCUT/Package.appxmanifest index 9e500c1..e332ccb 100644 --- a/PCUT/PCUT/Package.appxmanifest +++ b/PCUT/PCUT/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="1.3.4.8" /> diff --git a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml index cad39d7..b872568 100644 --- a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml +++ b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml @@ -20,7 +20,7 @@ - + @@ -65,7 +65,7 @@ Margin="5 0 0 0"/> - + { + var debugMode = UserContext.Instance.DebugFeaturesEnabled; var data = nested.ToHPGL( (ViewModels.Width, ViewModels.Height), _portSettings.Speed); @@ -105,10 +96,13 @@ namespace PCUT.Pages foreach (var (path, waitTime) in data) { _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - _ = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => + if (debugMode) { - ViewModels.PrintCommand += path; - }); + _ = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => + { + ViewModels.PrintCommand += $"Command: {path}{Environment.NewLine}Estimate: {waitTime.TotalSeconds}s{Environment.NewLine}"; + }); + } waitTask.Wait(); try { diff --git a/PCUT/PCUT/ViewModels/CutDialogViewModel.cs b/PCUT/PCUT/ViewModels/CutDialogViewModel.cs index a57c644..08ad79c 100644 --- a/PCUT/PCUT/ViewModels/CutDialogViewModel.cs +++ b/PCUT/PCUT/ViewModels/CutDialogViewModel.cs @@ -1,12 +1,10 @@ using PCUT.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Http.Core; using Http.Core.Extensions; using static Http.Core.Constants.HttpConstants; +using Windows.UI.Xaml; +using Http.Core.Contexts; namespace PCUT.ViewModels { @@ -25,6 +23,9 @@ namespace PCUT.ViewModels } } + public int CommandDisplayMinHeight { get => UserContext.Instance.DebugFeaturesEnabled ? 100 : 0; } + public Visibility CommandDisplay { get => UserContext.Instance.DebugFeaturesEnabled ? Visibility.Visible : Visibility.Collapsed; } + public async Task CutFileAsync(string fileId) { using (var httpClient = HttpClientFactory.CreateClient(ClientNames.ApiClient))