Commit deaf0599 authored by HankG's avatar HankG

Change interface to ribbon style

parent a7ec3b7c
Pipeline #101294821 failed with stage
in 60 minutes
......@@ -9,5 +9,6 @@
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
<StyleInclude Source="avares://Avalonia.Controls.Ribbon/Styles/RibbonStyles.xaml" />
</Application.Styles>
</Application>
......@@ -25,6 +25,7 @@
<PackageReference Include="Avalonia" Version="0.9.0-preview8" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.0-preview8" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.0-preview8" />
<PackageReference Include="AvaloniaRibbon" Version="1.1.0-build181119-01" />
<PackageReference Include="MySocialPortalLib" Version="1.0.0-alpha3" />
</ItemGroup>
</Project>
......@@ -29,6 +29,8 @@ namespace MySocialPortalDesktop.ViewModels
public Bitmap Image { get; protected set; }
public bool IsAvailable { get; protected set; }
public int ImageMaxHeight
{
get => _imageMaxHeight;
......@@ -47,6 +49,7 @@ namespace MySocialPortalDesktop.ViewModels
public ExternalLinkViewModel()
{
HasPreview = false;
IsAvailable = false;
ImageMaxHeight = DefaultMaxHeight;
ImageMaxWidth = DefaultMaxWidth;
}
......@@ -61,6 +64,7 @@ namespace MySocialPortalDesktop.ViewModels
vm.Description = item.Description ?? "";
vm.HasPreview = true;
vm.Url = item.RequestUrl;
vm.IsAvailable = true;
if (!item.HasPreviewImage)
{
return vm;
......
......@@ -40,6 +40,21 @@ namespace MySocialPortalDesktop.ViewModels
var app = Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime;
app?.Shutdown();
}
public void GoHome()
{
PostTimelineViewModel.GoHome();
}
public void LoadNewer()
{
PostTimelineViewModel.LoadNewer();
}
public void LoadOlder()
{
PostTimelineViewModel.LoadOlder();
}
public async void ImportPosts()
{
......
......@@ -38,8 +38,7 @@ namespace MySocialPortalDesktop.ViewModels
get => _date;
set => _date = this.RaiseAndSetIfChanged(ref _date, value);
}
public bool HasLinks => Links.Count > 0;
public ObservableCollection<ExternalLinkViewModel> Links { get; private set; }
public string OriginalSocialMediaSystem
......@@ -79,6 +78,19 @@ namespace MySocialPortalDesktop.ViewModels
FillLinkVMs();
}
public ExternalLinkViewModel PreviewLink
{
get
{
if (Links.Any())
{
return Links[0];
}
return new ExternalLinkViewModel();
}
}
protected Post Post { get; set; }
protected async void FillLinkVMs()
......
......@@ -25,13 +25,15 @@
</UserControl.Styles>
<Grid Name="MainGrid" RowDefinitions="Auto, *" ColumnDefinitions="*" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" Background="AliceBlue">
<Image Grid.Row="0" Grid.Column="0" Source="{Binding Image}" HorizontalAlignment="Center" MaxWidth="{Binding ImageMaxWidth}" MaxHeight="{Binding ImageMaxHeight}" Stretch="UniformToFill" IsVisible="{Binding HasImage}"/>
<Grid Grid.Row="1" Grid.Column="0" RowDefinitions="Auto, Auto, Auto" ColumnDefinitions="*" Margin="10,1">
<TextBlock Grid.Row="0" Grid.Column="0" Classes="Title" Text="{Binding Title}" TextWrapping="Wrap" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Description}" TextWrapping="Wrap"/>
<TextBlock Grid.Row="2" Grid.Column="0" Classes="Url" Text="{Binding Url}"/>
<Border CornerRadius="4" Background="WhiteSmoke" IsVisible="{Binding IsAvailable}">
<Grid Name="MainGrid" RowDefinitions="Auto, *" ColumnDefinitions="*" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Grid.Row="0" Grid.Column="0" Source="{Binding Image}" HorizontalAlignment="Center" MaxWidth="{Binding ImageMaxWidth}" MaxHeight="{Binding ImageMaxHeight}" Stretch="UniformToFill" IsVisible="{Binding HasImage}"/>
<Grid Grid.Row="1" Grid.Column="0" RowDefinitions="Auto, Auto, Auto" ColumnDefinitions="*" Margin="10,1">
<TextBlock Grid.Row="0" Grid.Column="0" Classes="Title" Text="{Binding Title}" TextWrapping="Wrap" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Description}" TextWrapping="Wrap"/>
<TextBlock Grid.Row="2" Grid.Column="0" Classes="Url" Text="{Binding Url}"/>
</Grid>
</Grid>
</Grid>
</Border>
</UserControl>
......@@ -15,14 +15,51 @@
</Design.DataContext>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Posts Import" Command="{Binding ImportPosts}" HotKey="CTRL+P"/>
<MenuItem Header="P_eople Import" Command="{Binding ImportPeople}" HotKey="CTRL+E"/>
<Separator/>
<MenuItem Header="Exit" Command="{Binding DoExit}"/>
</MenuItem>
</Menu>
<RibbonControl DockPanel.Dock="Top" Margin="0,0,0,5">
<RibbonTab Header="Main">
<StackPanel Orientation="Horizontal">
<RibbonTabGroup Text="Navigation">
<StackPanel Orientation="Horizontal">
<RibbonButton IconPath="/Assets/RibbonIcons/home.png" Text="Home" Command="{Binding GoHome}"/>
</StackPanel>
</RibbonTabGroup>
<RibbonTabGroup Text="Feeds">
<StackPanel Orientation="Horizontal">
<RibbonButton IconPath="/Assets/RibbonIcons/arrow-left-bold-box.png" Command="{Binding LoadOlder}">
<ToolTip.Tip>
<TextBlock Text="Load Older Posts"></TextBlock>
</ToolTip.Tip>
</RibbonButton>
<RibbonButton IconPath="/Assets/RibbonIcons/arrow-right-bold-box.png" Command="{Binding LoadNewer}">
<ToolTip.Tip>
<TextBlock Text="Load Latest Posts"></TextBlock>
</ToolTip.Tip>
</RibbonButton>
</StackPanel>
</RibbonTabGroup>
<RibbonTabGroup Text="Import">
<StackPanel Orientation="Horizontal">
<RibbonButton IconPath="/Assets/RibbonIcons/account-arrow-right.png" Text="People" Command="{Binding ImportPeople}"/>
<RibbonButton IconPath="/Assets/RibbonIcons/file-document-box-multiple.png" Text="Posts" Command="{Binding ImportPosts}"/>
</StackPanel>
</RibbonTabGroup>
</StackPanel>
</RibbonTab>
<RibbonTab Header="Settings">
<StackPanel Orientation="Horizontal">
<RibbonTabGroup Text="Application">
<StackPanel Orientation="Horizontal">
<RibbonButton IconPath="/Assets/RibbonIcons/settings.png" Text="Application"/>
</StackPanel>
</RibbonTabGroup>
<RibbonTabGroup Text="User">
<StackPanel Orientation="Horizontal">
<RibbonButton IconPath="/Assets/RibbonIcons/account-edit.png" Text="User Data"/>
</StackPanel>
</RibbonTabGroup>
</StackPanel>
</RibbonTab>
</RibbonControl>
<Grid Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
......@@ -32,9 +69,9 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<views:PeopleListView Grid.Row="0" Grid.Column="0" DataContext="{Binding PeopleListViewModel}"/>
<views:PeopleListView Grid.Row="0" Grid.Column="0" Margin="2" DataContext="{Binding PeopleListViewModel}"/>
<GridSplitter Grid.Row="0" Grid.Column="1"/>
<views:PostTimelineView Grid.Row="0" Grid.Column="2" DataContext="{Binding PostTimelineViewModel}"/>
<views:PostTimelineView Grid.Row="0" Grid.Column="2" Margin="5" DataContext="{Binding PostTimelineViewModel}"/>
</Grid>
</DockPanel>
</Window>
......@@ -6,10 +6,6 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="MySocialPortalDesktop.Views.PostTimelineView">
<Grid Grid.Row="0" Grid.Column="0" Name="TimelineGrid" RowDefinitions="Auto,*,Auto" ColumnDefinitions="*">
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Width="100" Content="Load Newer" Command="{Binding LoadNewer}"/>
<Button Width="100" Content="Home" Command="{Binding GoHome}"/>
</StackPanel>
<ListBox Grid.Row="1" Grid.Column="0" Items="{Binding PostViewModels}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
......@@ -17,6 +13,5 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2" Grid.Column="0" Width="100" Content="Load Older" Command="{Binding LoadOlder}"/>
</Grid>
</UserControl>
......@@ -24,16 +24,14 @@
</Style>
</UserControl.Styles>
<Border BorderThickness="1" BorderBrush="Gray" Padding="1">
<Grid RowDefinitions="*" ColumnDefinitions="Auto,*">
<Border BorderThickness="1" BorderBrush="LightGray" Padding="1" CornerRadius="8">
<Grid RowDefinitions="*" ColumnDefinitions="Auto,*" Margin="5">
<Image Grid.Row="0" Grid.Column="0" Source="{Binding ProfileImage}" Width="30" Height="30" Stretch="UniformToFill" VerticalAlignment="Top"/>
<Grid Grid.Row="0" Grid.Column="1" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*">
<TextBlock Grid.Row="0" Grid.Column="0" Name="Title" Classes="Title" Text="{Binding Title}" />
<TextBlock Grid.Row="1" Grid.Column="0" Name="Date" Classes="SocialMediaName" Text="{Binding Date}" HorizontalAlignment="Right" />
<TextBlock Grid.Row="2" Grid.Column="0" Name="Body" Classes="Body" Text="{Binding Body}" TextWrapping="Wrap" />
<views:ExternalLinkView Grid.Row="3" Grid.Column="0" Name="Links" DataContext="{Binding Links[0]}" Margin="3" IsVisible="{Binding HasLinks}" />
<TextBlock Grid.Row="4" Grid.Column="0" Name="Count" Classes="Body" Text="{Binding Links.Count}" TextWrapping="Wrap" />
<TextBlock Grid.Row="5" Grid.Column="0" Name="Source" Classes="SocialMediaName" Text="{Binding OriginalSocialMediaSystem}" HorizontalAlignment="Right" />
<views:ExternalLinkView Grid.Row="3" Grid.Column="0" Name="Links" DataContext="{Binding PreviewLink}" Margin="3"/><TextBlock Grid.Row="5" Grid.Column="0" Name="Source" Classes="SocialMediaName" Text="{Binding OriginalSocialMediaSystem}" HorizontalAlignment="Right" />
</Grid>
</Grid>
</Border>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment