diff --git a/WarehouseControlSystem/WarehouseControlSystem.Android/MainActivity.cs b/WarehouseControlSystem/WarehouseControlSystem.Android/MainActivity.cs index 78e8afe..05bb399 100644 --- a/WarehouseControlSystem/WarehouseControlSystem.Android/MainActivity.cs +++ b/WarehouseControlSystem/WarehouseControlSystem.Android/MainActivity.cs @@ -19,6 +19,7 @@ using Android.Widget; using Android.OS; using WarehouseControlSystem; +using FFImageLoading.Forms.Platform; namespace WarehouseControlSystem.Droid { @@ -30,6 +31,17 @@ protected override void OnCreate(Bundle bundle) TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); + + CachedImageRenderer.Init(true); + //var config = new FFImageLoading.Config.Configuration() + //{ + // VerboseLogging = false, + // VerbosePerformanceLogging = false, + // VerboseMemoryCacheLogging = false, + // VerboseLoadingCancelledLogging = false, + // Logger = new CustomLogger(), + //}; + //ImageService.Instance.Initialize(config); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); } diff --git a/WarehouseControlSystem/WarehouseControlSystem.Android/WarehouseControlSystem.Android.csproj b/WarehouseControlSystem/WarehouseControlSystem.Android/WarehouseControlSystem.Android.csproj index 94df764..708ff2a 100644 --- a/WarehouseControlSystem/WarehouseControlSystem.Android/WarehouseControlSystem.Android.csproj +++ b/WarehouseControlSystem/WarehouseControlSystem.Android/WarehouseControlSystem.Android.csproj @@ -62,6 +62,27 @@ ..\..\packages\FastAndroidCamera.2.0.0\lib\MonoAndroid403\FastAndroidCamera.dll + + ..\..\packages\Xamarin.FFImageLoading.2.4.3.840\lib\MonoAndroid10\FFImageLoading.dll + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Forms.dll + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Forms.Platform.dll + + + ..\..\packages\Xamarin.FFImageLoading.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Platform.dll + + + ..\..\packages\Xamarin.FFImageLoading.Svg.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Svg.Forms.dll + + + ..\..\packages\Xamarin.FFImageLoading.Svg.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Svg.Platform.dll + + + ..\..\packages\Xamarin.FFImageLoading.Transformations.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Transformations.dll + ..\..\packages\Xamarin.Forms.3.1.0.697729\lib\MonoAndroid10\FormsViewGroup.dll @@ -97,6 +118,9 @@ ..\..\packages\Xam.Plugins.Settings.3.1.1\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll + + ..\..\packages\SkiaSharp.1.60.0\lib\MonoAndroid\SkiaSharp.dll + diff --git a/WarehouseControlSystem/WarehouseControlSystem.Android/packages.config b/WarehouseControlSystem/WarehouseControlSystem.Android/packages.config index 24ab459..e5e5fa7 100644 --- a/WarehouseControlSystem/WarehouseControlSystem.Android/packages.config +++ b/WarehouseControlSystem/WarehouseControlSystem.Android/packages.config @@ -7,6 +7,7 @@ + @@ -75,6 +76,11 @@ + + + + + diff --git a/WarehouseControlSystem/WarehouseControlSystem.UWP/App.xaml.cs b/WarehouseControlSystem/WarehouseControlSystem.UWP/App.xaml.cs index a33ee16..663efc2 100644 --- a/WarehouseControlSystem/WarehouseControlSystem.UWP/App.xaml.cs +++ b/WarehouseControlSystem/WarehouseControlSystem.UWP/App.xaml.cs @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; @@ -26,6 +27,8 @@ using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; +using FFImageLoading.Forms; +using FFImageLoading.Forms.Platform; namespace WarehouseControl.UWP { @@ -72,7 +75,24 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) rootFrame.NavigationFailed += OnNavigationFailed; - Xamarin.Forms.Forms.Init(e); + + FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); + //var config = new FFImageLoading.Config.Configuration() + //{ + // VerboseLogging = false, + // VerbosePerformanceLogging = false, + // VerboseMemoryCacheLogging = false, + // VerboseLoadingCancelledLogging = false, + //}; + //FFImageLoading.ImageService.Instance.Initialize(config); + var assembliesToInclude = new List() + { + typeof(CachedImage).GetTypeInfo().Assembly, + typeof(CachedImageRenderer).GetTypeInfo().Assembly + }; + Xamarin.Forms.Forms.Init(e, assembliesToInclude); + + //Xamarin.Forms.Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { diff --git a/WarehouseControlSystem/WarehouseControlSystem.UWP/WarehouseControlSystem.UWP.csproj b/WarehouseControlSystem/WarehouseControlSystem.UWP/WarehouseControlSystem.UWP.csproj index 4edee03..2627163 100644 --- a/WarehouseControlSystem/WarehouseControlSystem.UWP/WarehouseControlSystem.UWP.csproj +++ b/WarehouseControlSystem/WarehouseControlSystem.UWP/WarehouseControlSystem.UWP.csproj @@ -248,6 +248,15 @@ 3.1.1 + + 2.4.3.840 + + + 2.4.3.840 + + + 2.4.3.840 + 3.1.0.697729 diff --git a/WarehouseControlSystem/WarehouseControlSystem/App.xaml b/WarehouseControlSystem/WarehouseControlSystem/App.xaml index 7f77634..99b9285 100644 --- a/WarehouseControlSystem/WarehouseControlSystem/App.xaml +++ b/WarehouseControlSystem/WarehouseControlSystem/App.xaml @@ -8,9 +8,9 @@ #6d6d6d White #b7b7b7 - #e2dacf - #cbc4ba - #b4aea5 + White + #e5e5e5 + #cecece \ No newline at end of file diff --git a/WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs b/WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs index 8d66c78..6e3906e 100644 --- a/WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs +++ b/WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs @@ -1593,6 +1593,63 @@ private static BinInfo GetBinInfoFromXML(XElement currentnode) return bi; } + public static Task> GetBinImagesByRackID(int rackid, CancellationTokenSource cts) + { + var tcs = new TaskCompletionSource>(); + + if (IsConnectionFaild()) + { + tcs.SetResult(null); + return tcs.Task; + } + + XNamespace myns = GetNameSpace(); + string functionname = "GetBinImagesByRackID"; + XElement body = + new XElement(myns + functionname, + new XElement(myns + "iD", rackid), + new XElement(myns + "responseDocument", "")); + SoapParams sp = new SoapParams(functionname, body, myns); + Task.Run(() => GetBinImagesByRackIDNAV(tcs, sp, cts)); + return tcs.Task; + } + private static async Task GetBinImagesByRackIDNAV(TaskCompletionSource> tcs, SoapParams sp, CancellationTokenSource cts) + { + try + { + XElement soapbodynode = await Process(sp, false, cts).ConfigureAwait(false); + string response = soapbodynode.Value; + XDocument document = GetDoc(response); + List rv = new List(); + foreach (XElement currentnode in document.Root.Elements()) + { + BinImage bi = GetBinImageFromXML(currentnode); + bi.BinCode = currentnode.Value; + rv.Add(bi); + } + tcs.SetResult(rv); + } + catch (Exception e) + { + tcs.SetException(e); + } + } + private static BinImage GetBinImageFromXML(XElement currentnode) + { + BinImage bv = new BinImage(); + foreach (XAttribute currentatribute in currentnode.Attributes()) + { + switch (currentatribute.Name.LocalName) + { + case "Image": + { + bv.ImageURL = currentatribute.Value; + break; + } + } + } + return bv; + } #endregion #region BinTemplate public static XElement[] SetBinTemplateParams(XNamespace myns, BinTemplate bintemplate) diff --git a/WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinContentEntry.cs b/WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinContent.cs similarity index 100% rename from WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinContentEntry.cs rename to WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinContent.cs diff --git a/WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinImage.cs b/WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinImage.cs new file mode 100644 index 0000000..587f4fa --- /dev/null +++ b/WarehouseControlSystem/WarehouseControlSystem/Model/NAV/BinImage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WarehouseControlSystem.Model.NAV +{ + public class BinImage + { + public string BinCode { get; set; } = ""; + public string ImageURL { get; set; } = ""; + } +} diff --git a/WarehouseControlSystem/WarehouseControlSystem/View/Pages/Racks/Card/BinView.xaml b/WarehouseControlSystem/WarehouseControlSystem/View/Pages/Racks/Card/BinView.xaml index a2d6385..f30747b 100644 --- a/WarehouseControlSystem/WarehouseControlSystem/View/Pages/Racks/Card/BinView.xaml +++ b/WarehouseControlSystem/WarehouseControlSystem/View/Pages/Racks/Card/BinView.xaml @@ -2,12 +2,15 @@ + Spacing="0" + Padding="1" + BackgroundColor="{StaticResource BinViewColorDark}"> @@ -56,7 +59,9 @@ - + + + + + + + + binimages = await NAV.GetBinImagesByRackID(RackID, acd.Default).ConfigureAwait(true); + if (NotDisposed) + { + foreach (BinImage bi in binimages) + { + if (!acd.Default.IsCancellationRequested) + { + BinViewModel bvm = BinViewModels.Find(x => x.Code == bi.BinCode); + if (bvm is BinViewModel) + { + try + { + System.IO.Stream output = await ImageService.Instance.LoadUrl(bi.ImageURL) + .LoadingPlaceholder("icon.png") + .DownSample(100,100) + .AsJPGStreamAsync(); + + if (NotDisposed) + { + if (bvm.NotDisposed) + { + bvm.ImageSource = ImageSource.FromStream(() => output); + bvm.ImageSourceLoaded = true; + } + } + else + break; + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine("WCS:LI ["+ bi.BinCode+"] "+ e.Message); + } + } + } + } + } + } + catch (OperationCanceledException e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + throw e; + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + throw e; + } + } + private void ExistInSearch(BinViewModel bvm) { diff --git a/WarehouseControlSystem/WarehouseControlSystem/ViewModel/RackViewModel.cs b/WarehouseControlSystem/WarehouseControlSystem/ViewModel/RackViewModel.cs index cd48e0f..dc465dc 100644 --- a/WarehouseControlSystem/WarehouseControlSystem/ViewModel/RackViewModel.cs +++ b/WarehouseControlSystem/WarehouseControlSystem/ViewModel/RackViewModel.cs @@ -863,6 +863,22 @@ public async Task LoadBinValues() System.Diagnostics.Debug.WriteLine(e.Message); } } + + public async Task LoadBinImages() + { + try + { + await BinsViewModel.LoadBinImages(ACD).ConfigureAwait(true); + } + catch (OperationCanceledException e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + } + } #endregion #region User Defined Functions diff --git a/WarehouseControlSystem/WarehouseControlSystem/WarehouseControlSystem.csproj b/WarehouseControlSystem/WarehouseControlSystem/WarehouseControlSystem.csproj index 853dbf6..41e6cd8 100644 --- a/WarehouseControlSystem/WarehouseControlSystem/WarehouseControlSystem.csproj +++ b/WarehouseControlSystem/WarehouseControlSystem/WarehouseControlSystem.csproj @@ -34,6 +34,9 @@ + + +