Compare commits
2 Commits
05a0eab829
...
113a3d8876
Author | SHA1 | Date |
---|---|---|
kwan.nguyen | 113a3d8876 | |
kwan.nguyen | 181b4447ce |
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace PCUT.Extensions
|
|||
{
|
||||
var lengthX = Math.Abs(maxX - moveCommand.X);
|
||||
builder.AddHpglMove(moveCommand.X, moveCommand.Y, ref maxX);
|
||||
length += (lengthX + (heightUnit / UnitLength)) * 0.75;
|
||||
length += (lengthX + heightUnit) * 0.75;
|
||||
break;
|
||||
}
|
||||
case LineCommand lineCommand:
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<Identity
|
||||
Name="ac171214-3336-4e02-845d-9bdc107cce71"
|
||||
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"/>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<RowDefinition Height="0.1*"/>
|
||||
<RowDefinition Height="0.1*"/>
|
||||
<RowDefinition x:Name="PreviewRowDefinition" Height="0.6*"/>
|
||||
<RowDefinition Height="0.1*" MinHeight="100"/>
|
||||
<RowDefinition Height="0.1*" MinHeight="{Binding CommandDisplayMinHeight}"/>
|
||||
<RowDefinition Height="0.1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -65,7 +65,7 @@
|
|||
Margin="5 0 0 0"/>
|
||||
<TextBlock Text="(mm)" Foreground="{ThemeResource SystemAccentColor}" VerticalAlignment="Center" Margin="5 0 0 0" />
|
||||
</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"/>
|
||||
<TextBox
|
||||
Text="{Binding PrintCommand}"
|
||||
|
|
|
@ -1,27 +1,17 @@
|
|||
using PCUT.Extensions;
|
||||
using PCUT.Factories;
|
||||
using Http.Core.Contexts;
|
||||
using PCUT.Extensions;
|
||||
using PCUT.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
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.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// 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 PortSettingViewModel _portSettings;
|
||||
private readonly DesignCenterViewModel _designCenterViewModel;
|
||||
private CutDialogViewModel ViewModels;
|
||||
private readonly CutDialogViewModel ViewModels;
|
||||
|
||||
public CutFilesDialog(
|
||||
string portName,
|
||||
|
@ -97,6 +87,7 @@ namespace PCUT.Pages
|
|||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
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();
|
||||
if (debugMode)
|
||||
{
|
||||
_ = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
ViewModels.PrintCommand += path;
|
||||
ViewModels.PrintCommand += $"Command: {path}{Environment.NewLine}Estimate: {waitTime.TotalSeconds}s{Environment.NewLine}";
|
||||
});
|
||||
}
|
||||
waitTask.Wait();
|
||||
try
|
||||
{
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue