Skip to content

Commit

Permalink
Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Jan 13, 2020
1 parent cc0fe63 commit 817fde0
Show file tree
Hide file tree
Showing 17 changed files with 614 additions and 354 deletions.
8 changes: 5 additions & 3 deletions KentekenShit.Android/KentekenShit.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
668 changes: 336 additions & 332 deletions KentekenShit.Android/Resources/Resource.designer.cs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions KentekenShit.iOS/KentekenShit.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand Down
14 changes: 11 additions & 3 deletions KentekenShit/KentekenShit.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Views\DetailsPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions KentekenShit/Models/HomeMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ namespace KentekenShit.Models
{
public enum MenuItemType
{
Home,
Details,
History,
Favorites,
Settings,
Browse,
About
}
Expand Down
4 changes: 2 additions & 2 deletions KentekenShit/Services/MockDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<bool> AddItemAsync(Item item)

public async Task<bool> UpdateItemAsync(Item item)
{
var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
var oldItem = items.FirstOrDefault(arg => arg.Id == item.Id);
items.Remove(oldItem);
items.Add(item);

Expand All @@ -41,7 +41,7 @@ public async Task<bool> UpdateItemAsync(Item item)

public async Task<bool> DeleteItemAsync(string id)
{
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
var oldItem = items.FirstOrDefault(arg => arg.Id == id);
items.Remove(oldItem);

return await Task.FromResult(true);
Expand Down
41 changes: 41 additions & 0 deletions KentekenShit/Services/SQLiteDataStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using KentekenShit.Models;

namespace KentekenShit.Services
{
public class SQLiteDataStore : IDataStore<Item>
{
public SQLiteDataStore()
{
var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "database.db");
}

public Task<bool> AddItemAsync(Item item)
{
throw new System.NotImplementedException();
}

public Task<bool> UpdateItemAsync(Item item)
{
throw new System.NotImplementedException();
}

public Task<bool> DeleteItemAsync(string id)
{
throw new System.NotImplementedException();
}

public Task<Item> GetItemAsync(string id)
{
throw new System.NotImplementedException();
}

public Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
{
throw new System.NotImplementedException();
}
}
}
4 changes: 2 additions & 2 deletions KentekenShit/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Windows.Input;

using Xamarin.Essentials;
using Xamarin.Forms;

namespace KentekenShit.ViewModels
Expand All @@ -11,7 +11,7 @@ public AboutViewModel()
{
Title = "About";

OpenWebCommand = new Command(() => Device.OpenUri(new Uri("https://xamarin.com/platform")));
OpenWebCommand = new Command(() => Launcher.OpenAsync(new Uri("https://xamarin.com/platform")));
}

public ICommand OpenWebCommand { get; }
Expand Down
10 changes: 10 additions & 0 deletions KentekenShit/ViewModels/LookupViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace KentekenShit.ViewModels
{
public class LookupViewModel : BaseViewModel
{
public LookupViewModel()
{
Title = "Licence Plate Thing";
}
}
}
113 changes: 113 additions & 0 deletions KentekenShit/Views/DetailsPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="KentekenShit.Views.DetailsPage">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout Grid.Row="0">
<StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10">
<Label FontSize="22">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Info about" />
<Span Text=" " />
<Span Text="48-XR-FF" FontAttributes="Bold" FontSize="22" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</StackLayout>

<ScrollView Grid.Row="1">
<StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10">
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Make:" />
<Span Text=" " />
<Span Text="TOYOTA" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Seets:" />
<Span Text=" " />
<Span Text="5" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Cylinder Count:" />
<Span Text=" " />
<Span Text="4" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Door Count:" />
<Span Text=" " />
<Span Text="4" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Wheel Count:" />
<Span Text=" " />
<Span Text="4" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Price:" />
<Span Text="" />
<Span Text="28549" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
<Label FontSize="15">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Taxi Sign:" />
<Span Text=" " />
<Span Text="No" FontAttributes="Bold" FontSize="15" />
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</ScrollView>
</Grid>
</ContentPage.Content>
</ContentPage>
20 changes: 20 additions & 0 deletions KentekenShit/Views/DetailsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace KentekenShit.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class DetailsPage : ContentPage
{
public DetailsPage()
{
InitializeComponent();
}
}
}
5 changes: 0 additions & 5 deletions KentekenShit/Views/ItemsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
<d:ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>First Item</x:String>
<x:String>Second Item</x:String>
<x:String>Third Item</x:String>
<x:String>Fourth Item</x:String>
<x:String>Fifth Item</x:String>
<x:String>Sixth Item</x:String>
</x:Array>
</d:ListView.ItemsSource>
<ListView.ItemTemplate>
Expand Down
36 changes: 36 additions & 0 deletions KentekenShit/Views/LookupPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="{Binding Title}"
x:Class="KentekenShit.Views.LookupPage">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome"
VerticalOptions="Start"
HorizontalOptions="CenterAndExpand" />

<Label Text="Please enter a license plate to look up"
VerticalOptions="Start"
HorizontalOptions="CenterAndExpand" />

<Entry Text="48-XR-FF"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
FontSize="50"
WidthRequest="220"
BackgroundColor="Yellow"
HeightRequest="70"
VerticalOptions="Center"
HorizontalOptions="Center"
x:Name="LicencePlateDSte" />

<Button Margin="0,10,0,0" Text="Look up"
VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="220"
BackgroundColor="#2196F3"
TextColor="White" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
24 changes: 24 additions & 0 deletions KentekenShit/Views/LookupPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KentekenShit.ViewModels;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace KentekenShit.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LookupPage : ContentPage
{
LookupViewModel viewModel;

public LookupPage()
{
InitializeComponent();

BindingContext = viewModel = new LookupViewModel();
}
}
}
2 changes: 1 addition & 1 deletion KentekenShit/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</OnPlatform>
</NavigationPage.Icon>
<x:Arguments>
<views:ItemsPage />
<views:LookupPage />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
Expand Down
6 changes: 3 additions & 3 deletions KentekenShit/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public MainPage()

MasterBehavior = MasterBehavior.Popover;

MenuPages.Add((int)MenuItemType.Browse, (NavigationPage)Detail);
MenuPages.Add((int)MenuItemType.Home, (NavigationPage)Detail);
}

public async Task NavigateFromMenu(int id)
Expand All @@ -30,8 +30,8 @@ public async Task NavigateFromMenu(int id)
{
switch (id)
{
case (int)MenuItemType.Browse:
MenuPages.Add(id, new NavigationPage(new ItemsPage()));
case (int)MenuItemType.Home:
MenuPages.Add(id, new NavigationPage(new LookupPage()));
break;
case (int)MenuItemType.About:
MenuPages.Add(id, new NavigationPage(new AboutPage()));
Expand Down
Loading

0 comments on commit 817fde0

Please sign in to comment.