Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions AI Demos/AISmartPDFFormFill/SmartFill/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ public partial class App : Application
public App()
{
InitializeComponent();

MainPage = new MainPage();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new MainPage());
}
}
}
2 changes: 1 addition & 1 deletion AI Demos/AISmartPDFFormFill/SmartFill/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void SavePDF(object sender, EventArgs e)

var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write);
PdfViewer.SaveDocument(stream);
Application.Current?.MainPage?.DisplayAlert("Success", $"Document saved successfully at:\n{filePath}", "OK");
Application.Current?.Windows?.FirstOrDefault()?.Page?.DisplayAlertAsync("Success", $"Document saved successfully at:\n{filePath}", "OK");

}

Expand Down
6 changes: 3 additions & 3 deletions AI Demos/AISmartPDFFormFill/SmartFill/SmartFill.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

Expand Down Expand Up @@ -69,7 +69,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
<PackageReference Include="Syncfusion.Maui.Core" Version="*" />
<PackageReference Include="Syncfusion.Maui.DataForm" Version="*" />
<PackageReference Include="Syncfusion.Maui.Inputs" Version="*" />
Expand Down
6 changes: 4 additions & 2 deletions AI Demos/SmartRedaction/SmartRedaction/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ public partial class App : Application
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
protected override Window CreateWindow(IActivationState activationState)
{
return new Window(new AppShell());
}
}
}
16 changes: 8 additions & 8 deletions AI Demos/SmartRedaction/SmartRedaction/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public MainPage()
PdfViewer.DocumentLoaded += PdfViewer_DocumentLoaded;
}

private void MarkRedaction_StateChanged(object? sender, Syncfusion.Maui.Buttons.StateChangedEventArgs e)
private void MarkRedaction_StateChanged(object sender, Syncfusion.Maui.Buttons.StateChangedEventArgs e)
{
if (e.IsChecked.HasValue && e.IsChecked.Value)
{
Expand All @@ -42,11 +42,11 @@ private void MarkRedaction_StateChanged(object? sender, Syncfusion.Maui.Buttons.
PdfViewer.AnnotationMode = AnnotationMode.None;
}

private void PdfViewer_DocumentLoaded(object? sender, EventArgs? e)
private void PdfViewer_DocumentLoaded(object sender, EventArgs e)
{
if (openAIService.DeploymentName == "DEPLOYMENT_NAME")
{
Application.Current?.MainPage?.DisplayAlert("Alert", "The Azure API key or endpoint is missing or incorrect. Please verify your credentials", "OK");
Application.Current?.Windows?.FirstOrDefault()?.Page?.DisplayAlertAsync("Alert", "The Azure API key or endpoint is missing or incorrect. Please verify your credentials", "OK");
MobileScan.IsEnabled = false;
DesktopScanButton.IsEnabled = false;
}
Expand All @@ -57,7 +57,7 @@ private void PdfViewer_DocumentLoaded(object? sender, EventArgs? e)
}
}

private void AddRedact_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
private void AddRedact_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (AddRedact.IsEnabled)
AddRedact.Opacity = 1;
Expand All @@ -81,9 +81,9 @@ private void OkClicked(object sender, EventArgs e)

}

private void PdfViewer_AnnotationAdded(object? sender, AnnotationEventArgs e)
private void PdfViewer_AnnotationAdded(object sender, AnnotationEventArgs e)
{
if ((bool)MarkRedaction.IsChecked && e.Annotation is SquareAnnotation)
if (MarkRedaction.IsChecked != null && (bool)MarkRedaction.IsChecked && e.Annotation is SquareAnnotation)
{
e.Annotation.Name = $"RedactedRect{PdfViewer.Annotations.Count}";
e.Annotation.Author = "RedactedRect";
Expand All @@ -93,7 +93,7 @@ private void PdfViewer_AnnotationAdded(object? sender, AnnotationEventArgs e)
SelectRedactitem.IsEnabled = true;
}

private void SensitiveInfoView_NodeChecked(object? sender, NodeCheckedEventArgs e)
private void SensitiveInfoView_NodeChecked(object sender, NodeCheckedEventArgs e)
{
if (e.Node?.Content is TreeItem treeItem)
{
Expand Down Expand Up @@ -498,7 +498,7 @@ private void SavePDF(object sender, EventArgs e)
var filePath = Path.Combine(FileSystem.AppDataDirectory, "SavedSample.pdf");
var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write);
PdfViewer.SaveDocument(stream);
Application.Current?.MainPage?.DisplayAlert("Success", $"Document saved successfully at:\n{filePath}", "OK");
Application.Current?.Windows?.FirstOrDefault()?.Page?.DisplayAlertAsync("Success", $"Document saved successfully at:\n{filePath}", "OK");
}

private void OpenCloseMobileRedactLayout(object sender, EventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions AI Demos/SmartRedaction/SmartRedaction/SmartRedaction.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

Expand Down Expand Up @@ -68,7 +68,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
<PackageReference Include="Syncfusion.Maui.Buttons" Version="*" />
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="*" />
<PackageReference Include="Syncfusion.Maui.TreeView" Version="*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public ObservableCollection<TreeItem> SensitiveInfo
internal int textBoundsCount = 0;


private Stream? _pdfFile;
public Stream? PdfFile
private Stream _pdfFile;
public Stream PdfFile
{
get { return _pdfFile; }
set
Expand Down Expand Up @@ -105,7 +105,7 @@ public async Task PickAndShow(PickOptions options)
message = ex.Message;
else
message = "File open failed.";
Application.Current?.MainPage?.DisplayAlert("Error", message, "OK");
Application.Current?.Windows?.FirstOrDefault()?.Page?.DisplayAlertAsync("Error", message, "OK");
}

}
Expand Down Expand Up @@ -174,7 +174,7 @@ private void LoadPdfFile()
OnPropertyChanged(nameof(PdfFile));
}

public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
Expand All @@ -201,7 +201,7 @@ public bool IsChecked
}
}

public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
Expand Down
6 changes: 4 additions & 2 deletions AI Demos/Summarizer/Summarizer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ public partial class App : Application
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
}
2 changes: 1 addition & 1 deletion AI Demos/Summarizer/Summarizer/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private async void PdfViewer_DocumentLoaded(object? sender, EventArgs? e)
{
AssistServices AI = new AssistServices();
if (AI.DeploymentName == "DEPLOYMENT_NAME")
Application.Current?.MainPage?.DisplayAlert("Alert", "The Azure API key or endpoint is missing or incorrect. Please verify your credentials", "OK");
Application.Current?.Windows?.FirstOrDefault()?.Page?.DisplayAlertAsync("Alert", "The Azure API key or endpoint is missing or incorrect. Please verify your credentials", "OK");
await LoadPDFDataAsync();
var reply = await viewModel.assistService.GetAnswerFromGPT("Read the PDF document contents and understand the concept. Provide summary for this in 3 to 4 simple sentences. Ignore about iTextSharp related points in the details");
var suggestion = await viewModel.assistService.GetSuggestion("Provide short Summary for the document");
Expand Down
6 changes: 3 additions & 3 deletions AI Demos/Summarizer/Summarizer/Summarizer.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

Expand Down Expand Up @@ -69,7 +69,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.12.0" />
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="*" />
<PackageReference Include="Syncfusion.Maui.AIAssistView" Version="*" />
Expand Down
6 changes: 4 additions & 2 deletions Annotations/FreeText/FreeText/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ public partial class App : Application
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
}
7 changes: 4 additions & 3 deletions Annotations/FreeText/FreeText/FreeText.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

Expand All @@ -18,6 +18,7 @@
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<ApplicationTitle>FreeText</ApplicationTitle>
Expand Down Expand Up @@ -67,7 +68,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
<PackageReference Include="Syncfusion.Compression.NET" Version="*" />
<PackageReference Include="Syncfusion.Maui.Core" Version="*" />
<PackageReference Include="Syncfusion.Maui.SignaturePad" Version="*" />
Expand Down
43 changes: 23 additions & 20 deletions Annotations/FreeText/FreeText/UI/FreeTextEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public partial class FreeTextEditor : ContentView
internal float SelectedFontSize { get; set; } = 12;
internal float SelectedThickness { get; set; } = 1;

internal event EventHandler<Microsoft.Maui.Graphics.Color> FillColorChanged;
internal event EventHandler<Microsoft.Maui.Graphics.Color> FontColorChanged;
internal event EventHandler<Microsoft.Maui.Graphics.Color> BorderColorChanged;
internal event EventHandler<float> BorderThicknessChanged;
internal event EventHandler<float> OpacityChanged;
internal event EventHandler<double> FontSizeChanged;
internal event EventHandler<Microsoft.Maui.Graphics.Color>? FillColorChanged;
internal event EventHandler<Microsoft.Maui.Graphics.Color>? FontColorChanged;
internal event EventHandler<Microsoft.Maui.Graphics.Color>? BorderColorChanged;
internal event EventHandler<float>? BorderThicknessChanged;
internal event EventHandler<float>? OpacityChanged;
internal event EventHandler<double>? FontSizeChanged;

Button? PreButton = null;
public FreeTextEditor()
Expand All @@ -27,7 +27,7 @@ public FreeTextEditor()
Colorpaletteborder.Content = MyGrid;
this.Content = Colorpaletteborder;
tabView.SelectionChanged += OnSelectionChanged;
tabView.LayoutChanged += TabView_LayoutChanged;
tabView.SizeChanged += TabView_LayoutChanged;
this.PropertyChanged += FreeTextFillColorPalatte_PropertyChanged;
}

Expand Down Expand Up @@ -100,14 +100,17 @@ private void FreeTextFillColorPalatte_PropertyChanged(object? sender, System.Com
}

#if MACCATALYST
Frame Colorpaletteborder = new Frame()
Border Colorpaletteborder = new Border()
{
BackgroundColor = Color.FromArgb("#EEE8F4"),
BorderColor = Color.FromArgb("#26000000"),
Stroke = Color.FromArgb("#26000000"),
Padding = new Thickness(0),
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Start,
CornerRadius = 12,
StrokeShape = new RoundRectangle
{
CornerRadius = new CornerRadius(12)
},
Shadow = new Shadow
{
Offset = new Point(-1, 0),
Expand Down Expand Up @@ -219,15 +222,15 @@ private void ColorFillButton_Clicked(object sender, EventArgs e)
button.WidthRequest = 40;
button.CornerRadius = 40;
#if MACCATALYST || IOS
PreButton.CornerRadius = 17;
PreButton?.CornerRadius = 17;
#endif
button.HorizontalOptions = LayoutOptions.Center;
button.VerticalOptions = LayoutOptions.Center;
int column = Grid.GetColumn(button);
int row = Grid.GetRow(button);
Grid.SetColumn(selectedColorButtonHighlight, column);
Grid.SetRow(selectedColorButtonHighlight, row);
FillColorChanged.Invoke(this, GetColor(button));
FillColorChanged?.Invoke(this, GetColor(button));
}
if (selectedColorButtonHighlight.Parent == null)
{
Expand Down Expand Up @@ -263,15 +266,15 @@ private void ColorStrokeButton_Clicked(object sender, EventArgs e)
button.WidthRequest = 40;
button.CornerRadius = 40;
#if MACCATALYST || IOS
PreButton.CornerRadius = 17;
PreButton?.CornerRadius = 17;
#endif
button.HorizontalOptions = LayoutOptions.Center;
button.VerticalOptions = LayoutOptions.Center;
int column = Grid.GetColumn(button);
int row = Grid.GetRow(button);
Grid.SetColumn(selectedColorButtonHighlightStroke, column);
Grid.SetRow(selectedColorButtonHighlightStroke, row);
BorderColorChanged.Invoke(this, GetColor(button));
BorderColorChanged?.Invoke(this, GetColor(button));
}
if (selectedColorButtonHighlightStroke.Parent == null)
{
Expand All @@ -282,27 +285,27 @@ private void FreeTextOpacitySlidervalue_Chnaged(object sender, EventArgs e)
{
float opacity = (float)FreeTextOpacitySlider.Value;
SelectedOpacity = opacity;
OpacityChanged.Invoke(this,opacity);
OpacityChanged?.Invoke(this,opacity);
}

private void ShapeFillColorOpacitySlidervalue_Chnaged(object sender, EventArgs e)
{
float opacity = (float)shapeFillColorOpacitySlider.Value;
SelectedOpacity = opacity;
OpacityChanged.Invoke(this, opacity);
OpacityChanged?.Invoke(this, opacity);
}

private void SfSlider_ValueChangeEnd(object sender, EventArgs e)
{
float thickness = (float)FreetextStroke.Value;
SelectedThickness = thickness;
BorderThicknessChanged.Invoke(this, thickness);
BorderThicknessChanged?.Invoke(this, thickness);
}

private void FontSizeSliderValueChanged(object sender, EventArgs e)
{
SelectedFontSize = (float)textSize.Value;
FontSizeChanged.Invoke(this, textSize.Value);
FontSizeChanged?.Invoke(this, textSize.Value);
}

private void FontColorButton_Clicked(object sender, EventArgs e)
Expand Down Expand Up @@ -333,15 +336,15 @@ private void FontColorButton_Clicked(object sender, EventArgs e)
button.WidthRequest = 40;
button.CornerRadius = 40;
#if MACCATALYST || IOS
PreButton.CornerRadius = 17;
PreButton?.CornerRadius = 17;
#endif
button.HorizontalOptions = LayoutOptions.Center;
button.VerticalOptions = LayoutOptions.Center;
int column = Grid.GetColumn(button);
int row = Grid.GetRow(button);
Grid.SetColumn(selectedFontColorHighlight, column);
Grid.SetRow(selectedFontColorHighlight, row);
FontColorChanged.Invoke(this, GetColor(button));
FontColorChanged?.Invoke(this, GetColor(button));
}
if (selectedFontColorHighlight.Parent == null)
{
Expand Down
Loading