update hide debug features
This commit is contained in:
parent
181b4447ce
commit
113a3d8876
|
@ -25,12 +25,14 @@ namespace Http.Core.Contexts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DebugFeaturesEnabled { get; set; } = false;
|
||||||
|
|
||||||
public UserProfile Profile { get; private set; }
|
public UserProfile Profile { get; private set; }
|
||||||
public string AccessToken { get; private set; }
|
public string AccessToken { get; private set; }
|
||||||
public string RefreshToken { get; private set; }
|
public string RefreshToken { get; private set; }
|
||||||
|
public DateTime? ExpiredTime { get; private set; }
|
||||||
public string DeviceId { get; private set; }
|
public string DeviceId { get; private set; }
|
||||||
public string AppVersion { get; private set; }
|
public string AppVersion { get; private set; }
|
||||||
public DateTime? ExpiredTime { get; private set; }
|
|
||||||
|
|
||||||
public bool IsPermittedEdit => Profile.Role == "admin" || (Profile.IsPermittedEdit ?? false);
|
public bool IsPermittedEdit => Profile.Role == "admin" || (Profile.IsPermittedEdit ?? false);
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace PCUT
|
||||||
.AddConfigureClient(client => { client.BaseAddress = new Uri(Api.BaseUrl); })
|
.AddConfigureClient(client => { client.BaseAddress = new Uri(Api.BaseUrl); })
|
||||||
.AddHttpMessageHandler(() => new DeviceAuthHandler())
|
.AddHttpMessageHandler(() => new DeviceAuthHandler())
|
||||||
.AddHttpMessageHandler(() => new AuthenticationHandler());
|
.AddHttpMessageHandler(() => new AuthenticationHandler());
|
||||||
|
UserContext.Instance.DebugFeaturesEnabled = false;
|
||||||
}
|
}
|
||||||
public IServiceProvider AppContainer { get; }
|
public IServiceProvider AppContainer { get; }
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ namespace PCUT
|
||||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||||
{
|
{
|
||||||
UserContext.Instance.SetAppVersion(GetAppVersion());
|
UserContext.Instance.SetAppVersion(GetAppVersion());
|
||||||
ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;
|
ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = UserContext.Instance.DebugFeaturesEnabled;
|
||||||
Frame rootFrame = Window.Current.Content as Frame;
|
Frame rootFrame = Window.Current.Content as Frame;
|
||||||
// Do not repeat app initialization when the Window already has content,
|
// Do not repeat app initialization when the Window already has content,
|
||||||
// just ensure that the window is active
|
// just ensure that the window is active
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<Identity
|
<Identity
|
||||||
Name="ac171214-3336-4e02-845d-9bdc107cce71"
|
Name="ac171214-3336-4e02-845d-9bdc107cce71"
|
||||||
Publisher="CN=pcut, O=PCUT, L=HN, S=HN, C=VN"
|
Publisher="CN=pcut, O=PCUT, L=HN, S=HN, C=VN"
|
||||||
Version="1.3.4.6" />
|
Version="1.3.4.8" />
|
||||||
|
|
||||||
<mp:PhoneIdentity PhoneProductId="ac171214-3336-4e02-845d-9bdc107cce71" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
<mp:PhoneIdentity PhoneProductId="ac171214-3336-4e02-845d-9bdc107cce71" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<RowDefinition Height="0.1*"/>
|
<RowDefinition Height="0.1*"/>
|
||||||
<RowDefinition Height="0.1*"/>
|
<RowDefinition Height="0.1*"/>
|
||||||
<RowDefinition x:Name="PreviewRowDefinition" Height="0.6*"/>
|
<RowDefinition x:Name="PreviewRowDefinition" Height="0.6*"/>
|
||||||
<RowDefinition Height="0.1*" MinHeight="100"/>
|
<RowDefinition Height="0.1*" MinHeight="{Binding CommandDisplayMinHeight}"/>
|
||||||
<RowDefinition Height="0.1*"/>
|
<RowDefinition Height="0.1*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
Margin="5 0 0 0"/>
|
Margin="5 0 0 0"/>
|
||||||
<TextBlock Text="(mm)" Foreground="{ThemeResource SystemAccentColor}" VerticalAlignment="Center" Margin="5 0 0 0" />
|
<TextBlock Text="(mm)" Foreground="{ThemeResource SystemAccentColor}" VerticalAlignment="Center" Margin="5 0 0 0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="3" Height="92" MaxHeight="92" Margin="0 4 0 4">
|
<StackPanel Grid.Row="3" Height="92" MaxHeight="92" Margin="0 4 0 4" Visibility="{Binding CommandDisplay}">
|
||||||
<TextBlock Text="Print Command:" Height="16" Margin="0 0 0 4"/>
|
<TextBlock Text="Print Command:" Height="16" Margin="0 0 0 4"/>
|
||||||
<TextBox
|
<TextBox
|
||||||
Text="{Binding PrintCommand}"
|
Text="{Binding PrintCommand}"
|
||||||
|
|
|
@ -1,27 +1,17 @@
|
||||||
using PCUT.Extensions;
|
using Http.Core.Contexts;
|
||||||
using PCUT.Factories;
|
using PCUT.Extensions;
|
||||||
using PCUT.ViewModels;
|
using PCUT.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Windows.ApplicationModel.Core;
|
using Windows.ApplicationModel.Core;
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
using Windows.UI.Popups;
|
using Windows.UI.Popups;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Controls.Primitives;
|
|
||||||
using Windows.UI.Xaml.Data;
|
|
||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
using Windows.UI.Xaml.Navigation;
|
|
||||||
|
|
||||||
// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
|
@ -34,7 +24,7 @@ namespace PCUT.Pages
|
||||||
private readonly string _portName;
|
private readonly string _portName;
|
||||||
private readonly PortSettingViewModel _portSettings;
|
private readonly PortSettingViewModel _portSettings;
|
||||||
private readonly DesignCenterViewModel _designCenterViewModel;
|
private readonly DesignCenterViewModel _designCenterViewModel;
|
||||||
private CutDialogViewModel ViewModels;
|
private readonly CutDialogViewModel ViewModels;
|
||||||
|
|
||||||
public CutFilesDialog(
|
public CutFilesDialog(
|
||||||
string portName,
|
string portName,
|
||||||
|
@ -97,6 +87,7 @@ namespace PCUT.Pages
|
||||||
{
|
{
|
||||||
await Task.Factory.StartNew(() =>
|
await Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
|
var debugMode = UserContext.Instance.DebugFeaturesEnabled;
|
||||||
var data = nested.ToHPGL(
|
var data = nested.ToHPGL(
|
||||||
(ViewModels.Width, ViewModels.Height),
|
(ViewModels.Width, ViewModels.Height),
|
||||||
_portSettings.Speed);
|
_portSettings.Speed);
|
||||||
|
@ -105,10 +96,13 @@ namespace PCUT.Pages
|
||||||
foreach (var (path, waitTime) in data)
|
foreach (var (path, waitTime) in data)
|
||||||
{
|
{
|
||||||
_cancellationTokenSource.Token.ThrowIfCancellationRequested();
|
_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();
|
waitTask.Wait();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
using PCUT.Models;
|
using PCUT.Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Http.Core;
|
using Http.Core;
|
||||||
using Http.Core.Extensions;
|
using Http.Core.Extensions;
|
||||||
using static Http.Core.Constants.HttpConstants;
|
using static Http.Core.Constants.HttpConstants;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Http.Core.Contexts;
|
||||||
|
|
||||||
namespace PCUT.ViewModels
|
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)
|
public async Task CutFileAsync(string fileId)
|
||||||
{
|
{
|
||||||
using (var httpClient = HttpClientFactory.CreateClient(ClientNames.ApiClient))
|
using (var httpClient = HttpClientFactory.CreateClient(ClientNames.ApiClient))
|
||||||
|
|
Loading…
Reference in New Issue