Add DetailsUri property to CampaignItem and Add VIEW SITE button in campaign details when the DetailsUri exists
This commit is contained in:
parent
ae8d38bdf6
commit
34e2e19269
@ -15,5 +15,7 @@
|
|||||||
public DateTime To { get; set; }
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
public string PictureUri { get; set; }
|
public string PictureUri { get; set; }
|
||||||
|
|
||||||
|
public string DetailsUri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,10 +5,13 @@
|
|||||||
using Models.Marketing;
|
using Models.Marketing;
|
||||||
using Services.Marketing;
|
using Services.Marketing;
|
||||||
using Base;
|
using Base;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
public class CampaignDetailsViewModel : ViewModelBase
|
public class CampaignDetailsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private CampaignItem _campaign;
|
private CampaignItem _campaign;
|
||||||
|
private bool _isDetailsSite;
|
||||||
private readonly ICampaignService _campaignService;
|
private readonly ICampaignService _campaignService;
|
||||||
|
|
||||||
public CampaignDetailsViewModel(ICampaignService campaignService)
|
public CampaignDetailsViewModel(ICampaignService campaignService)
|
||||||
@ -26,6 +29,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsDetailsSite
|
||||||
|
{
|
||||||
|
get => _isDetailsSite;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_isDetailsSite = value;
|
||||||
|
RaisePropertyChanged(() => IsDetailsSite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override async Task InitializeAsync(object navigationData)
|
public override async Task InitializeAsync(object navigationData)
|
||||||
{
|
{
|
||||||
if (navigationData is int)
|
if (navigationData is int)
|
||||||
@ -38,5 +51,12 @@
|
|||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand EnableDetailsSiteCommand => new Command(EnableDetailsSite);
|
||||||
|
|
||||||
|
private void EnableDetailsSite()
|
||||||
|
{
|
||||||
|
IsDetailsSite = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="eShopOnContainers.Core.Views.CampaignDetailsView"
|
x:Class="eShopOnContainers.Core.Views.CampaignDetailsView"
|
||||||
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
|
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
|
||||||
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
|
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
|
||||||
Title="Campaign Details">
|
Title="Campaign Details">
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
@ -53,11 +53,19 @@
|
|||||||
<Setter Property="VerticalOptions"
|
<Setter Property="VerticalOptions"
|
||||||
Value="Center" />
|
Value="Center" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="CampaignAvailabilityButtonStyle"
|
<Style x:Key="CampaignViewSiteButtonStyle"
|
||||||
TargetType="{x:Type Grid}">
|
TargetType="{x:Type Button}">
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{StaticResource WhiteColor}" />
|
||||||
<Setter Property="BackgroundColor"
|
<Setter Property="BackgroundColor"
|
||||||
Value="{StaticResource LightGreenColor}" />
|
Value="{StaticResource LightGreenColor}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CampaignAvailabilityBannerStyle"
|
||||||
|
TargetType="{x:Type Grid}">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{StaticResource GrayColor}" />
|
||||||
<Setter Property="Padding"
|
<Setter Property="Padding"
|
||||||
Value="12" />
|
Value="12" />
|
||||||
<Setter Property="VerticalOptions"
|
<Setter Property="VerticalOptions"
|
||||||
@ -69,44 +77,62 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<Grid
|
<Grid>
|
||||||
ColumnSpacing="0"
|
|
||||||
RowSpacing="0">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="60" />
|
<RowDefinition Height="60" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!-- CAMPAIGN DETAILS -->
|
|
||||||
<ScrollView>
|
<StackLayout
|
||||||
<StackLayout>
|
HeightRequest="50"
|
||||||
<Grid>
|
Grid.Column="0"
|
||||||
<Grid.RowDefinitions>
|
Grid.Row="0"
|
||||||
<RowDefinition Height="1" />
|
IsVisible="{Binding Campaign.DetailsUri,
|
||||||
<RowDefinition Height="Auto" />
|
Converter={StaticResource StringNullOrEmptyBoolConverter}}">
|
||||||
<RowDefinition Height="Auto" />
|
<Button
|
||||||
<RowDefinition Height="*" />
|
BackgroundColor="{StaticResource LightGreenColor}"
|
||||||
</Grid.RowDefinitions>
|
Command="{Binding EnableDetailsSiteCommand}"
|
||||||
<Grid
|
Text="VIEW SITE"
|
||||||
|
Style="{StaticResource CampaignViewSiteButtonStyle}">
|
||||||
|
</Button>
|
||||||
|
</StackLayout>
|
||||||
|
<Grid
|
||||||
|
ColumnSpacing="0"
|
||||||
|
RowSpacing="0"
|
||||||
|
Grid.Row="1" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- CAMPAIGN DETAILS -->
|
||||||
|
<ScrollView>
|
||||||
|
<StackLayout>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Image
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
BackgroundColor="Gray"/>
|
|
||||||
<Image
|
|
||||||
Grid.Row="1"
|
|
||||||
Source="{Binding Campaign.PictureUri, Converter={StaticResource ImageConverter}}"
|
Source="{Binding Campaign.PictureUri, Converter={StaticResource ImageConverter}}"
|
||||||
Style="{StaticResource CampaignImageStyle}"/>
|
Style="{StaticResource CampaignImageStyle}"/>
|
||||||
<Label
|
<Label
|
||||||
Grid.Row="2"
|
Grid.Row="1"
|
||||||
Text="{Binding Campaign.Name}"
|
Text="{Binding Campaign.Name}"
|
||||||
Style="{StaticResource CampaignTitleStyle}"/>
|
Style="{StaticResource CampaignTitleStyle}"/>
|
||||||
<Label
|
<Label
|
||||||
Grid.Row="3"
|
Grid.Row="2"
|
||||||
Text="{Binding Campaign.Description}"
|
Text="{Binding Campaign.Description}"
|
||||||
Style="{StaticResource CampaignDescriptionStyle}"/>
|
Style="{StaticResource CampaignDescriptionStyle}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Row="1"
|
Style="{StaticResource CampaignAvailabilityBannerStyle}"
|
||||||
Style="{StaticResource CampaignAvailabilityButtonStyle}">
|
Grid.Row="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -120,6 +146,18 @@
|
|||||||
Text="{Binding Campaign.To, StringFormat='until {0:MMMM dd, yyyy}'}"
|
Text="{Binding Campaign.To, StringFormat='until {0:MMMM dd, yyyy}'}"
|
||||||
Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/>
|
Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<AbsoluteLayout
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.RowSpan="3"
|
||||||
|
IsVisible="{Binding IsDetailsSite}">
|
||||||
|
<WebView
|
||||||
|
Source="{Binding Campaign.DetailsUri}"
|
||||||
|
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
|
||||||
|
AbsoluteLayout.LayoutFlags="All">
|
||||||
|
</WebView>
|
||||||
|
</AbsoluteLayout>
|
||||||
|
|
||||||
<!-- INDICATOR -->
|
<!-- INDICATOR -->
|
||||||
<ActivityIndicator
|
<ActivityIndicator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user