This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from DanteDeRuwe/uwp
Merge UWP into master
- Loading branch information
Showing
69 changed files
with
760 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+262 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+411 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.94 KB
Vecto.UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+596 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+945 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png
Oops, something went wrong.
Binary file added
BIN
+262 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+596 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
Oops, something went wrong.
Binary file added
BIN
+945 Bytes
Vecto.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
-844 Bytes
(33%)
Vecto.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<Page | ||
x:Class="Vecto.UWP.Pages.Sections.PackingSectionPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:entities="using:Vecto.Core.Entities" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
<StackPanel> | ||
<ListView ItemsSource="{x:Bind _items}" > | ||
<ListView.ItemTemplate> | ||
<DataTemplate x:DataType="entities:PackingItem"> | ||
<CheckBox | ||
IsChecked="{x:Bind Checked}" | ||
Checked="CheckBox_Toggle" | ||
Unchecked="CheckBox_Toggle" | ||
Tag="{x:Bind Id}" | ||
RightTapped="ItemRightTapped"> | ||
<CheckBox.ContentTemplate> | ||
<DataTemplate x:DataType="entities:PackingItem"> | ||
<StackPanel Orientation="Horizontal"> | ||
<Border Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" CornerRadius="5" Padding="10 1 10 1" Margin="5 0 10 0"> | ||
<TextBlock Text="{x:Bind Amount}"/> | ||
</Border> | ||
<TextBlock Text="{x:Bind Title}"/> | ||
</StackPanel> | ||
</DataTemplate> | ||
</CheckBox.ContentTemplate> | ||
<FlyoutBase.AttachedFlyout> | ||
<MenuFlyout> | ||
<MenuFlyoutItem Text="Edit" Icon="Edit" Click="EditItem_Click" /> | ||
<MenuFlyoutItem Text="Delete" Icon="Delete" Click="DeleteItem_Click" /> | ||
</MenuFlyout> | ||
</FlyoutBase.AttachedFlyout> | ||
</CheckBox> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
<Button Content="Add Packing Item" Click="AddItem_Button_OnClick"></Button> | ||
|
||
<ContentDialog | ||
Name="AddItemDialog" | ||
Title="Add Packing Item" | ||
PrimaryButtonText="Add" | ||
CloseButtonText="Cancel"> | ||
<StackPanel Spacing="12" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> | ||
<TextBox Name="AddItemName" Header="Title" /> | ||
<TextBox Name="AddItemDesc" Header="Description" /> | ||
<muxc:NumberBox x:Name="AddItemAmount" | ||
Header="Amount" | ||
Value="1" | ||
SpinButtonPlacementMode="Inline" | ||
SmallChange="1" | ||
LargeChange="10" /> | ||
</StackPanel> | ||
</ContentDialog> | ||
|
||
<ContentDialog | ||
Name="EditItemDialog" | ||
Title="Edit Packing Item" | ||
PrimaryButtonText="Apply" | ||
CloseButtonText="Cancel"> | ||
<StackPanel Spacing="12" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> | ||
<TextBox Name="EditItemName" Header="Title" /> | ||
<TextBox Name="EditItemDesc" Header="Description" /> | ||
<muxc:NumberBox x:Name="EditItemAmount" | ||
Header="Amount" | ||
Value="1" | ||
SpinButtonPlacementMode="Inline" | ||
SmallChange="1" | ||
LargeChange="10" /> | ||
</StackPanel> | ||
</ContentDialog> | ||
</StackPanel> | ||
</Page> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using Vecto.Application.Items; | ||
using Vecto.Core.Entities; | ||
using Vecto.UWP.Services; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
namespace Vecto.UWP.Pages.Sections | ||
{ | ||
public sealed partial class PackingSectionPage : Page | ||
{ | ||
private readonly IApiService _service = CustomRefitService.ForAuthenticated<IApiService>(); | ||
private TripDetailsPage _tripDetailsPage; | ||
private ObservableCollection<PackingItem> _items; | ||
private Guid _tripId, _sectionId; | ||
|
||
protected override async void OnNavigatedTo(NavigationEventArgs e) | ||
{ | ||
base.OnNavigatedTo(e); | ||
|
||
dynamic parameter = e.Parameter; | ||
_tripId = parameter.TripId; | ||
_sectionId = parameter.SectionId; | ||
_tripDetailsPage = parameter.TripDetailsPage; | ||
|
||
var items = await _service.GetPackingItems(_tripId, _sectionId); | ||
_items = new ObservableCollection<PackingItem>(items); | ||
|
||
InitializeComponent(); | ||
//AddItemAmount.NumberFormatter = new DecimalFormatter() { FractionDigits = 0 }; | ||
} | ||
|
||
private async void CheckBox_Toggle(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
var itemId = GetItemIdFromCheckBox(sender as CheckBox); | ||
await _service.ToggleItem(_tripId, _sectionId, itemId); | ||
Bindings.Update(); | ||
_tripDetailsPage.UpdateProgressBar(); | ||
} | ||
catch | ||
{ | ||
// | ||
// error handling | ||
} | ||
} | ||
|
||
private Guid GetItemIdFromCheckBox(CheckBox cb) | ||
{ | ||
if (cb is null || cb.Tag is null) throw new Exception(); | ||
|
||
var success = Guid.TryParse(cb.Tag.ToString(), out var itemId); | ||
return success ? itemId : throw new Exception(); | ||
} | ||
|
||
|
||
private async void AddItem_Button_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
AddItemName.Text = ""; | ||
AddItemName.Description = ""; | ||
AddItemAmount.Value = 1; | ||
|
||
if (await AddItemDialog.ShowAsync() != ContentDialogResult.Primary) return; | ||
|
||
try | ||
{ | ||
var item = new ItemDTO() | ||
{ | ||
Title = AddItemName.Text, | ||
Description = AddItemDesc.Text, | ||
Amount = (int) Math.Ceiling(AddItemAmount.Value) | ||
}; | ||
|
||
var newItem = await _service.AddPackingItem(_tripId, _sectionId, item); | ||
_items.Add(newItem); | ||
_tripDetailsPage.UpdateProgressBar(); | ||
Bindings.Update(); | ||
} | ||
catch | ||
{ | ||
//TODO exception handling | ||
} | ||
} | ||
|
||
private async void EditItem_Click(object sender, RoutedEventArgs e) | ||
{ | ||
var item = (sender as MenuFlyoutItem).DataContext as PackingItem; | ||
|
||
EditItemName.Text = item.Title; | ||
EditItemDesc.Text = item.Description; | ||
EditItemAmount.Value = item.Amount; | ||
|
||
if (await EditItemDialog.ShowAsync() != ContentDialogResult.Primary) return; | ||
|
||
try | ||
{ | ||
var editedItem = new ItemDTO() | ||
{ | ||
Title = EditItemName.Text, | ||
Description = EditItemDesc.Text, | ||
Amount= (int)EditItemAmount.Value | ||
}; | ||
|
||
var updated = (PackingItem)await _service.UpdatePackingItem(_tripId, _sectionId, item.Id, editedItem); | ||
var index = _items.IndexOf(item); | ||
if (index != -1) _items[index] = updated; | ||
} | ||
catch | ||
{ | ||
//TODO exception handling | ||
} | ||
} | ||
|
||
private async void DeleteItem_Click(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
var item = (sender as MenuFlyoutItem).DataContext as PackingItem; | ||
await _service.DeleteItem(_tripId, _sectionId, item.Id); | ||
_items.Remove(item); | ||
_tripDetailsPage.UpdateProgressBar(); | ||
Bindings.Update(); | ||
} | ||
catch | ||
{ | ||
//TODO error handling | ||
} | ||
} | ||
|
||
private void ItemRightTapped(object sender, RightTappedRoutedEventArgs e) | ||
{ | ||
FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement); | ||
} | ||
} | ||
} |
Oops, something went wrong.