Skip to content

Commit

Permalink
Bin Images
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegLobakov committed Aug 17, 2018
1 parent f69c0de commit 8ed68b9
Show file tree
Hide file tree
Showing 16 changed files with 267 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Android.Widget;
using Android.OS;
using WarehouseControlSystem;
using FFImageLoading.Forms.Platform;

namespace WarehouseControlSystem.Droid
{
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@
<Reference Include="FastAndroidCamera, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\FastAndroidCamera.2.0.0\lib\MonoAndroid403\FastAndroidCamera.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.3.840\lib\MonoAndroid10\FFImageLoading.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Forms, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Forms.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Forms.Platform, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Platform, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Platform.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Svg.Forms, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Svg.Forms.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Svg.Forms.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Svg.Platform, Version=2.4.3.840, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Svg.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Svg.Platform.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Transformations, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Transformations.2.4.3.840\lib\MonoAndroid10\FFImageLoading.Transformations.dll</HintPath>
</Reference>
<Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.3.1.0.697729\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -97,6 +118,9 @@
<Reference Include="Plugin.Settings.Abstractions, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.3.1.1\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp, Version=1.60.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\..\packages\SkiaSharp.1.60.0\lib\MonoAndroid\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.EnterpriseServices" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<package id="PCLStorage" version="1.0.2" targetFramework="monoandroid80" />
<package id="PCLStorage.Abstractions" version="1.0.4-b2017032801" targetFramework="monoandroid81" />
<package id="Plugin.CurrentActivity" version="2.1.0.4" targetFramework="monoandroid81" />
<package id="SkiaSharp" version="1.60.0" targetFramework="monoandroid81" />
<package id="System.AppContext" version="4.3.0" targetFramework="monoandroid80" />
<package id="System.Collections" version="4.3.0" targetFramework="monoandroid80" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="monoandroid80" />
Expand Down Expand Up @@ -75,6 +76,11 @@
<package id="Xamarin.Android.Support.v7.Palette" version="27.0.2.1" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="27.0.2.1" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="27.0.2.1" targetFramework="monoandroid81" />
<package id="Xamarin.FFImageLoading" version="2.4.3.840" targetFramework="monoandroid81" />
<package id="Xamarin.FFImageLoading.Forms" version="2.4.3.840" targetFramework="monoandroid81" />
<package id="Xamarin.FFImageLoading.Svg" version="2.4.3.840" targetFramework="monoandroid81" />
<package id="Xamarin.FFImageLoading.Svg.Forms" version="2.4.3.840" targetFramework="monoandroid81" />
<package id="Xamarin.FFImageLoading.Transformations" version="2.4.3.840" targetFramework="monoandroid81" />
<package id="Xamarin.Forms" version="3.1.0.697729" targetFramework="monoandroid81" />
<package id="ZXing.Net.Mobile" version="2.4.1" targetFramework="monoandroid81" />
<package id="ZXing.Net.Mobile.Forms" version="2.4.1" targetFramework="monoandroid81" />
Expand Down
22 changes: 21 additions & 1 deletion WarehouseControlSystem/WarehouseControlSystem.UWP/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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<Assembly>()
{
typeof(CachedImage).GetTypeInfo().Assembly,
typeof(CachedImageRenderer).GetTypeInfo().Assembly
};
Xamarin.Forms.Forms.Init(e, assembliesToInclude);

//Xamarin.Forms.Forms.Init(e);

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@
<PackageReference Include="Xam.Plugins.Settings">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Forms">
<Version>2.4.3.840</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms">
<Version>2.4.3.840</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Transformations">
<Version>2.4.3.840</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms">
<Version>3.1.0.697729</Version>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions WarehouseControlSystem/WarehouseControlSystem/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<Color x:Key="WellcodeButtonBackgoundColor">#6d6d6d</Color>
<Color x:Key="SchemeBlockWhiteColor">White</Color>
<Color x:Key="SchemeBlockWhiteColorDark">#b7b7b7</Color>
<Color x:Key="BinViewColor">#e2dacf</Color>
<Color x:Key="BinViewColorDark">#cbc4ba</Color>
<Color x:Key="BinViewColorDark2">#b4aea5</Color>
<Color x:Key="BinViewColor">White</Color>
<Color x:Key="BinViewColorDark">#e5e5e5</Color>
<Color x:Key="BinViewColorDark2">#cecece</Color>
</ResourceDictionary>
</Application.Resources>
</Application>
57 changes: 57 additions & 0 deletions WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,63 @@ private static BinInfo GetBinInfoFromXML(XElement currentnode)
return bi;
}

public static Task<List<BinImage>> GetBinImagesByRackID(int rackid, CancellationTokenSource cts)
{
var tcs = new TaskCompletionSource<List<BinImage>>();

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<List<BinImage>> tcs, SoapParams sp, CancellationTokenSource cts)
{
try
{
XElement soapbodynode = await Process(sp, false, cts).ConfigureAwait(false);
string response = soapbodynode.Value;
XDocument document = GetDoc(response);
List<BinImage> rv = new List<BinImage>();
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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; } = "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WarehouseControlSystem.View.Pages.Racks.Card.BinView"
xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
x:Name="ThisBinView">
<ContentView.Content>
<StackLayout HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
SizeChanged="StackLayout_SizeChanged"
Spacing="0">
Spacing="0"
Padding="1"
BackgroundColor="{StaticResource BinViewColorDark}">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCommand}"/>
</StackLayout.GestureRecognizers>
Expand Down Expand Up @@ -56,7 +59,9 @@
</Label.Triggers>
</Label>

<ActivityIndicator Grid.Row="1"


<ActivityIndicator Grid.Row="1"
IsVisible="{Binding LoadAnimation}"
IsRunning="{Binding LoadAnimation}"
HeightRequest="30" WidthRequest="30"
Expand All @@ -69,6 +74,17 @@
IsVisible="{Binding IsSearchQuantityVisible}">
</Label>

<Image Grid.Row="1"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Source="{Binding ImageSource}">
<Image.Triggers>
<DataTrigger Binding="{Binding IsSearchQuantityVisible}" TargetType="Image" Value="false">
<Setter Property="IsVisible" Value="true"/>
</DataTrigger>
</Image.Triggers>
</Image>

<Grid Grid.Row="2" Padding="2"
ColumnSpacing="0" RowSpacing="0"
IsVisible="{Binding IsContent}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void BinsIsLoaded(BinsViewModel bvm)
model.State = ModelState.Normal;
model.GetSearchText();
rackview.Update(model);
model.LoadBinImages();
}

private async void BinSelected(BinViewModel bvm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public ImageSource ImageSource
OnPropertyChanged(nameof(ImageSource));
}
}
}
ImageSource imagesource;
} ImageSource imagesource;


public string ImageURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ public string BottomRightValue
OnPropertyChanged("BottomRightValue");
}
}
}
string bottomrightvalue;
} string bottomrightvalue;

public string BottomLeftValue
{
Expand All @@ -335,9 +334,36 @@ public string BottomLeftValue
OnPropertyChanged("BottomLeftValue");
}
}
}
string bottomleftvalue;
} string bottomleftvalue;

public ImageSource ImageSource
{
get { return imagesource; }
set
{
if (imagesource != value)
{
imagesource = value;
OnPropertyChanged(nameof(ImageSource));
}
}
} ImageSource imagesource;
public bool ImageSourceLoaded
{
get
{
return imagesourceloaded;
}
set
{
if (imagesourceloaded != value)
{
imagesourceloaded = value;
OnPropertyChanged(nameof(ImageSourceLoaded));
}
}
}
bool imagesourceloaded;
public string Description
{
get { return description; }
Expand Down
Loading

0 comments on commit 8ed68b9

Please sign in to comment.