diff --git a/CircleViewer/.vs/CircleViewer/v17/.suo b/CircleViewer/.vs/CircleViewer/v17/.suo
index f590a4d..4ea22ac 100644
Binary files a/CircleViewer/.vs/CircleViewer/v17/.suo and b/CircleViewer/.vs/CircleViewer/v17/.suo differ
diff --git a/CircleViewerMaui/App.xaml.cs b/CircleViewerMaui/App.xaml.cs
index 28cba43..1d0e732 100644
--- a/CircleViewerMaui/App.xaml.cs
+++ b/CircleViewerMaui/App.xaml.cs
@@ -2,9 +2,15 @@
public partial class App : Application
{
+ private string syncFusionLicenseKey = "MTg3MzUyM0AzMjMxMmUzMTJlMzQzMVhOUDNaUUxSMUExWTB3a1EzK294VjhKcGh3eENlanRIdXR2aWVrSGZUVTg9";
public App()
{
- InitializeComponent();
+ string[] args = Environment.GetCommandLineArgs();
+
+ //Register SyncFusion license
+ Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(syncFusionLicenseKey);
+
+ InitializeComponent();
MainPage = new AppShell();
}
diff --git a/CircleViewerMaui/AppShell.xaml b/CircleViewerMaui/AppShell.xaml
index 2520d79..183d753 100644
--- a/CircleViewerMaui/AppShell.xaml
+++ b/CircleViewerMaui/AppShell.xaml
@@ -7,7 +7,6 @@
Shell.FlyoutBehavior="Disabled">
diff --git a/CircleViewerMaui/CircleViewerMaui.csproj b/CircleViewerMaui/CircleViewerMaui.csproj
index 7ac186f..e70390a 100644
--- a/CircleViewerMaui/CircleViewerMaui.csproj
+++ b/CircleViewerMaui/CircleViewerMaui.csproj
@@ -49,11 +49,19 @@
+
+
+
+
+ ..\csharp\src\CircleSDK\bin\Debug\netstandard2.0\CircleSDK.dll
+
+
+
diff --git a/CircleViewerMaui/MainPage.xaml b/CircleViewerMaui/MainPage.xaml
index 49836ef..6fb6c19 100644
--- a/CircleViewerMaui/MainPage.xaml
+++ b/CircleViewerMaui/MainPage.xaml
@@ -1,45 +1,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/CircleViewerMaui/MainPage.xaml.cs b/CircleViewerMaui/MainPage.xaml.cs
index 10c8960..57dd870 100644
--- a/CircleViewerMaui/MainPage.xaml.cs
+++ b/CircleViewerMaui/MainPage.xaml.cs
@@ -1,32 +1,89 @@
using System.Reflection;
using CDPShared;
+using Syncfusion.Maui.PdfViewer;
namespace CircleViewerMaui;
public partial class MainPage : ContentPage
{
- int count = 0;
+ int count = 0;
private CDPWorker _cdp;
+ Timer _timer;
+ Boolean _bConnected = false;
public MainPage()
- {
+ {
using (LogMethod.Log(MethodBase.GetCurrentMethod().ReflectedType.Name))
{
_cdp = new CDPWorker();
InitializeComponent();
+ _timer = new Timer(IsReady, null, 250, 250);
+
+ }
+ }
+
+ void IsReady(object state)
+ {
+ if (_bConnected != _cdp.Ready)
+ {
+ _bConnected = _cdp.Ready;
+ OnReady();
+ _timer = null;
}
}
- private void OnCounterClicked(object sender, EventArgs e)
- {
- count++;
+ void OnReady()
+ {
+// Device.InvokeOnMainThreadAsync(() => { lblConnected.Text = "Connected"; });
+ }
+
+ public async Task OpenCirFileAsync()
+ {
+ var fileTypes = new FilePickerFileType(new Dictionary>
+ {
+ { DevicePlatform.iOS, new[] { "public.cir" } },
+ { DevicePlatform.Android, new[] { "application/cir" } },
+ { DevicePlatform.WinUI, new[] { ".cir" } },
+ { DevicePlatform.macOS, new[] { ".cir" } }
+ });
+
+ var options = new PickOptions
+ {
+ FileTypes = fileTypes,
+ PickerTitle = "Open .cir File"
+ };
- if (count == 1)
- CounterBtn.Text = $"Clicked {count} time";
- else
- CounterBtn.Text = $"Clicked {count} times";
+ var result = await FilePicker.PickAsync(options);
- SemanticScreenReader.Announce(CounterBtn.Text);
- }
+ if (result != null)
+ {
+ return result.FullPath;
+ }
+
+ return null;
+ }
+
+ private async void onOpenClicked(object sender, EventArgs e)
+ {
+ var filePath = await OpenCirFileAsync();
+ if (filePath != null)
+ {
+ ViewFileAsync(filePath);
+ }
+ }
+
+ async void ViewFileAsync(string fileToLoad)
+ {
+ using (LogMethod.Log(MethodBase.GetCurrentMethod().ReflectedType.Name))
+ {
+ var result = await _cdp.Decrypt(fileToLoad);
+ if (result.Status.Result.GetValueOrDefault(false))
+ {
+ byte[] buf = Convert.FromBase64String(result.DecryptedData);
+ string ext = Path.GetExtension(result.FileName);
+ PdfViewer.DocumentSource = new MemoryStream(buf);
+ }
+ }
+ }
}
diff --git a/CircleViewerMaui/MauiProgram.cs b/CircleViewerMaui/MauiProgram.cs
index 222f184..93a56c6 100644
--- a/CircleViewerMaui/MauiProgram.cs
+++ b/CircleViewerMaui/MauiProgram.cs
@@ -1,4 +1,6 @@
-using Microsoft.Extensions.Logging;
+using CommunityToolkit.Maui;
+using Microsoft.Extensions.Logging;
+using Syncfusion.Maui.Core.Hosting;
namespace CircleViewerMaui;
@@ -9,14 +11,17 @@ public static class MauiProgram
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
- .ConfigureFonts(fonts =>
+ // Initialize the .NET MAUI Community Toolkit by adding the below line of code
+ .UseMauiCommunityToolkit()
+ .ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
+ builder.ConfigureSyncfusionCore();
#if DEBUG
- builder.Logging.AddDebug();
+ builder.Logging.AddDebug();
#endif
return builder.Build();