Skip to content

Commit

Permalink
v1.4.1 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkHopper24 committed Mar 31, 2023
1 parent 1331f07 commit 49de97c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
43 changes: 39 additions & 4 deletions barcodrod.io/Views/DecodePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation.Collections;
Expand All @@ -13,6 +14,7 @@
using Windows.Storage.Pickers;
using Windows.Storage.Streams;
using Windows.System;
using WinRT;
using WinRT.Interop;
using ZXing.Windows.Compatibility;
using Image = Microsoft.UI.Xaml.Controls.Image;
Expand Down Expand Up @@ -371,6 +373,7 @@ public async void DecodeFromFile(string filepath)
DidDecodeSucceed(1);
BarcodeViewer.Source = null;
}
bitmap.Dispose();

}

Expand Down Expand Up @@ -753,6 +756,8 @@ private async void ShareText(object sender, RoutedEventArgs e)

}



private async void BulkDecode(object sender, RoutedEventArgs e)
{
OpenCsv.IsEnabled = false;
Expand All @@ -770,21 +775,36 @@ private async void BulkDecode(object sender, RoutedEventArgs e)
}


ImageFolderButton.IsEnabled = false;
//ImageFolderButton.IsEnabled = false;
SaveCsv.IsEnabled = false;
progressRing.IsActive = false;
progressRing.Value = 0;
TeachingTip.IsOpen = false;

StorageFile file;

var folder = await BulkDecodePicker();
if (folder == null || folder == "NotSelected")
var folderPicker = new FolderPicker();

//Get the Window's HWND
var hwnd = App.MainWindow.As<IWindowNative>().WindowHandle;

//Make folder Picker work in Win32

var initializeWithWindow = folderPicker.As<IInitializeWithWindow>();
initializeWithWindow.Initialize(hwnd);
folderPicker.FileTypeFilter.Add("*");

var folder = await folderPicker.PickSingleFolderAsync();



if (folder == null)
{
ImageFolderButton.IsEnabled = true;
return;
}
string[] filePaths = Directory.GetFiles(folder);

string[] filePaths = Directory.GetFiles(folder.Path);
//remove any non image files from filePaths list
filePaths = filePaths.Where(s => s.EndsWith(".jpg") || s.EndsWith(".png") || s.EndsWith(".bmp") || s.EndsWith(".gif") || s.EndsWith(".heif") || s.EndsWith(".hiec") || s.EndsWith(".bmp") || s.EndsWith(".jpeg")).ToArray();
fileCount = filePaths.Length;
Expand Down Expand Up @@ -883,6 +903,21 @@ private async void BulkDecode(object sender, RoutedEventArgs e)


}
[ComImport]
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IInitializeWithWindow
{
void Initialize(IntPtr hwnd);
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("EECDBF0E-BAE9-4CB6-A68E-9598E1CB57BB")]
internal interface IWindowNative
{
IntPtr WindowHandle { get; }
}


private async void KillBulkDecode()
{
Expand Down
4 changes: 2 additions & 2 deletions barcodrod.io/Views/ShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
<NavigationView.MenuItems>
<NavigationViewItem x:Uid="Shell_Decode" helpers:NavigationHelper.NavigateTo="barcodrod.io.ViewModels.DecodeViewModel">
<NavigationViewItem.Icon>
<FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xed14;" />
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xED14;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem x:Uid="Shell_Encode" helpers:NavigationHelper.NavigateTo="barcodrod.io.ViewModels.EncodeViewModel">
<NavigationViewItem.Icon>
<FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xed63;" />
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xED63;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationView.MenuItems>
Expand Down

0 comments on commit 49de97c

Please sign in to comment.