Skip to content

Commit b437177

Browse files
committed
Add Hyperlinks
1 parent 10428e5 commit b437177

File tree

14 files changed

+107
-5
lines changed

14 files changed

+107
-5
lines changed

WarehouseControlSystem/WarehouseControlSystem.Android/WarehouseControlSystem.Android.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,21 @@
605605
<ItemGroup>
606606
<AndroidResource Include="Resources\drawable-xxxhdpi\ic_action_wallpaper.png" />
607607
</ItemGroup>
608+
<ItemGroup>
609+
<AndroidResource Include="Resources\drawable\ic_action_insert_link.png" />
610+
</ItemGroup>
611+
<ItemGroup>
612+
<AndroidResource Include="Resources\drawable-hdpi\ic_action_insert_link.png" />
613+
</ItemGroup>
614+
<ItemGroup>
615+
<AndroidResource Include="Resources\drawable-xhdpi\ic_action_insert_link.png" />
616+
</ItemGroup>
617+
<ItemGroup>
618+
<AndroidResource Include="Resources\drawable-xxhdpi\ic_action_insert_link.png" />
619+
</ItemGroup>
620+
<ItemGroup>
621+
<AndroidResource Include="Resources\drawable-xxxhdpi\ic_action_insert_link.png" />
622+
</ItemGroup>
608623
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
609624
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
610625
<PropertyGroup>
Loading

WarehouseControlSystem/WarehouseControlSystem.UWP/WarehouseControlSystem.UWP.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
<Content Include="Assets\Images\ic_action_fullscreen.png" />
134134
<Content Include="Assets\Images\ic_action_grid_on.png" />
135135
<Content Include="Assets\Images\ic_action_image_aspect_ratio.png" />
136+
<Content Include="Assets\Images\ic_action_insert_link.png" />
136137
<Content Include="Assets\Images\ic_action_red_report_problem.png" />
137138
<Content Include="Assets\Images\ic_action_refresh.png" />
138139
<Content Include="Assets\Images\ic_action_remove_circle.png" />

WarehouseControlSystem/WarehouseControlSystem/Helpers/NAV/NAV.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ private static Indicator GetIndicatorsByLocationFromXML(XElement currentnode)
531531
ind.Position = StringToInt(currentatribute.Value);
532532
break;
533533
}
534+
case "URL":
535+
{
536+
ind.URL = currentatribute.Value;
537+
break;
538+
}
534539
}
535540
}
536541
return ind;
@@ -856,6 +861,11 @@ private static Indicator GetIndicatorsByZoneFromXML(XElement currentnode)
856861
ind.Position = StringToInt(currentatribute.Value);
857862
break;
858863
}
864+
case "URL":
865+
{
866+
ind.URL = currentatribute.Value;
867+
break;
868+
}
859869
}
860870
}
861871
return ind;

WarehouseControlSystem/WarehouseControlSystem/Model/NAV/Indicator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ public class Indicator
1111
public string Value { get; set; } = "";
1212
public string ValueColor { get; set; } = "";
1313
public int Position { get; set; }
14+
public string URL { get; set; } = "";
1415
}
1516
}

WarehouseControlSystem/WarehouseControlSystem/View/Content/IndicatorView.xaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
WidthRequest="{Binding WidthHeight, Source={x:Reference Name=ThisIndView}}"
99
HeightRequest="{Binding WidthHeight, Source={x:Reference Name=ThisIndView}}"
1010
Padding="2">
11-
<Grid
11+
<StackLayout.GestureRecognizers>
12+
<TapGestureRecognizer Command="{Binding TapCommand}"/>
13+
</StackLayout.GestureRecognizers>
14+
<Grid
1215
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
1316
ColumnSpacing="0"
1417
RowSpacing="0"
@@ -40,7 +43,23 @@
4043
FontSize="Medium"
4144
HorizontalOptions="EndAndExpand"
4245
Margin="0,0,10,8"/>
43-
</Grid>
46+
47+
<Image Grid.Row="2" x:Name="iconelement"
48+
HorizontalOptions="Start" VerticalOptions="End"
49+
Aspect="AspectFit"
50+
IsVisible="{Binding IsURLExist}" Margin="3,0,0,0">
51+
<Image.Source>
52+
<OnPlatform x:TypeArguments="FileImageSource">
53+
<On Platform="UWP,WinPhone">
54+
<FileImageSource File="Assets/Images/ic_action_insert_link.png"/>
55+
</On>
56+
<On Platform="iOS,Android">
57+
<FileImageSource File="ic_action_insert_link.png.png"/>
58+
</On>
59+
</OnPlatform>
60+
</Image.Source>
61+
</Image>
62+
</Grid>
4463
</StackLayout>
4564
</ContentView.Content>
4665
</ContentView>

WarehouseControlSystem/WarehouseControlSystem/View/Content/InnerSubSchemeView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="WarehouseControlSystem.View.Content.InnerSubSchemeView">
55
<ContentView.Content>
6-
<StackLayout Padding="1" BackgroundColor="DarkGray">
6+
<StackLayout Padding="0,1,0,0" BackgroundColor="LightGray">
77
<Grid x:Name="maingrid" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" ColumnSpacing="0" RowSpacing="0">
88
</Grid>
99
</StackLayout>

WarehouseControlSystem/WarehouseControlSystem/View/Content/InnerSubSchemeView.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ private void ShowSelection(SubSchemeElement element)
194194
}
195195
case RackOrientationEnum.HorizontalRight:
196196
{
197-
selectLeft = element.Left + element.Width - sss.Section;
197+
//selectLeft = element.Left + element.Width - sss.Section;
198+
//selectTop = element.Top + sss.Depth - 1;
199+
selectLeft = element.Left + sss.Section;
198200
selectTop = element.Top + sss.Depth - 1;
199201
break;
200202
}
@@ -206,8 +208,10 @@ private void ShowSelection(SubSchemeElement element)
206208
}
207209
case RackOrientationEnum.VerticalUp:
208210
{
211+
//selectLeft = element.Left + sss.Depth - 1;
212+
//selectTop = element.Top + sss.Section - 1;
209213
selectLeft = element.Left + sss.Depth - 1;
210-
selectTop = element.Top + sss.Section - 1;
214+
selectTop = element.Top + element.Height - sss.Section;
211215
break;
212216
}
213217
default:

WarehouseControlSystem/WarehouseControlSystem/ViewModel/IndicatorViewModel.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using WarehouseControlSystem.ViewModel.Base;
55
using Xamarin.Forms;
66
using WarehouseControlSystem.Model.NAV;
7+
using System.Windows.Input;
78

89
namespace WarehouseControlSystem.ViewModel
910
{
@@ -69,10 +70,38 @@ public int Position
6970
}
7071
}
7172
} int position;
73+
public bool IsURLExist
74+
{
75+
get { return isurlexist; }
76+
set
77+
{
78+
if (isurlexist != value)
79+
{
80+
isurlexist = value;
81+
OnPropertyChanged(nameof(IsURLExist));
82+
}
83+
}
84+
} bool isurlexist;
85+
public string URL
86+
{
87+
get { return url; }
88+
set
89+
{
90+
if (url != value)
91+
{
92+
url = value;
93+
OnPropertyChanged(nameof(URL));
94+
}
95+
}
96+
} string url;
97+
98+
public ICommand TapCommand { protected set; get; }
99+
public event Action<IndicatorViewModel> OnTap;
72100

73101
public IndicatorViewModel(INavigation navigation, Indicator indicator) : base(navigation)
74102
{
75103
FillFields(indicator);
104+
TapCommand = new Command<object>(Tap);
76105
}
77106

78107
public void FillFields(Indicator indicator)
@@ -81,6 +110,29 @@ public void FillFields(Indicator indicator)
81110
Description = indicator.Description;
82111
Value = indicator.Value;
83112
ValueColor = Color.FromHex(indicator.ValueColor);
113+
URL = indicator.URL;
114+
IsURLExist = !string.IsNullOrEmpty(indicator.URL);
115+
}
116+
117+
public void Tap(object sender)
118+
{
119+
if (!string.IsNullOrEmpty(URL))
120+
{
121+
try
122+
{
123+
Uri uri = new Uri(URL);
124+
Device.OpenUri(uri);
125+
}
126+
catch (Exception ex)
127+
{
128+
System.Diagnostics.Debug.WriteLine(ex.Message);
129+
}
130+
131+
if (OnTap is Action<LocationViewModel>)
132+
{
133+
OnTap(this);
134+
}
135+
}
84136
}
85137
}
86138
}

0 commit comments

Comments
 (0)