Skip to content
Permalink
Browse files
Add project files.
  • Loading branch information
omonighop committed Nov 19, 2020
1 parent dbe3a3f commit 55ffe53e1cb546834bc02c1730b211c89c9741cd
Show file tree
Hide file tree
Showing 27 changed files with 1,308 additions and 0 deletions.
@@ -0,0 +1,83 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee.Android", "HarPadRee.Android\HarPadRee.Android.csproj", "{C885C007-B815-476B-9EC1-92DF2C9AE53B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee.iOS", "HarPadRee.iOS\HarPadRee.iOS.csproj", "{916F00D6-588B-4960-9650-4CB67BC3EAE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee", "HarPadRee\HarPadRee.csproj", "{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.Build.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.Build.0 = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.Deploy.0 = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.ActiveCfg = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.Build.0 = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.Deploy.0 = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.ActiveCfg = Debug|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.Build.0 = Debug|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.Deploy.0 = Debug|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.ActiveCfg = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.Build.0 = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.Deploy.0 = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.ActiveCfg = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.Build.0 = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.Deploy.0 = Release|iPhone
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.Build.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.Build.0 = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.Deploy.0 = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.ActiveCfg = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.Build.0 = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.Deploy.0 = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {19FEF620-594A-4452-AFAB-B2420240C521}
EndGlobalSection
EndGlobal
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Application 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="HarPadRee.App">
<Application.Resources>

</Application.Resources>
</Application>
@@ -0,0 +1,45 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace HarPadRee
{
public partial class App : Application
{
string dbPath => FileAccessHelper.GetLocalFilePath("Cars.db3");

public static AccountsRepository AccRepo { get; private set; }
public static CarRepository CarRepo { get; private set; }
public static MillageRepository MillageRepo { get; private set; }
public static ServicesRepository ServicesRepo { get; private set; }

public App()
{
InitializeComponent();
AccRepo = new AccountsRepository(dbPath);
CarRepo = new CarRepository(dbPath);
MillageRepo = new MillageRepository(dbPath);
ServicesRepo = new ServicesRepository(dbPath);
MainPage = new MainPage();
}

protected override void OnStart()
{
if (Application.Current.Properties.ContainsKey("LoggedIn"))
{
if (App.Current.Properties["LoggedIn"].Equals(true))
{
App.Current.MainPage = new NavigationPage(new CarsPage((int)App.Current.Properties["AccID"]));
}
}
}

protected override void OnSleep()
{
}

protected override void OnResume()
{
}
}
}
@@ -0,0 +1,3 @@
using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
@@ -0,0 +1,19 @@
using Xamarin.Forms;

namespace HarPadRee.CustomControls
{
public class ExtendedViewCell : ViewCell
{
public static readonly BindableProperty SelectedBackgroundColorProperty =
BindableProperty.Create("SelectedBackgroundColor",
typeof(Color),
typeof(ExtendedViewCell),
Color.Default);

public Color SelectedBackgroundColor
{
get { return (Color)GetValue(SelectedBackgroundColorProperty); }
set { SetValue(SelectedBackgroundColorProperty, value); }
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HarPadRee
{
public static class Crypto
{
/// <summary>
/// hashed the password usng SHA256
/// </summary>
/// <param name="value">returned the hashed password</param>
/// <returns></returns>
public static string Hash(string value)
{
return Convert.ToBase64String(
System.Security.Cryptography.SHA256.Create()
.ComputeHash(Encoding.UTF8.GetBytes(value))
);
}
}
}
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace HarPadRee
{
public class EncriptionEngine
{
/// <summary>
/// encrypts the string
/// </summary>
/// <param name="input">the string to be encrypted</param>
/// <returns>encrypted string</returns>
public static string Encrypt(string input)
{
byte[] inputArray = UTF8Encoding.UTF8.GetBytes(input);
TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
tripleDES.Key = UTF8Encoding.UTF8.GetBytes("halw-3hq8-sq2219");
tripleDES.Mode = CipherMode.ECB;
tripleDES.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tripleDES.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
tripleDES.Clear();
return Convert.ToBase64String(resultArray, 0, resultArray.Length);
}
/// <summary>
/// decrypted the string
/// </summary>
/// <param name="input">the string to be decrypted</param>
/// <returns>decrypted string</returns>
public static string Decrypt(string input)
{
byte[] inputArray = Convert.FromBase64String(input);
TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
tripleDES.Key = UTF8Encoding.UTF8.GetBytes("halw-3hq8-sq2219");
tripleDES.Mode = CipherMode.ECB;
tripleDES.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tripleDES.CreateDecryptor();
byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
tripleDES.Clear();
return UTF8Encoding.UTF8.GetString(resultArray);
}
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Essentials;

namespace HarPadRee
{
class FileAccessHelper
{
public static string GetLocalFilePath(string filename)
{
return System.IO.Path.Combine(FileSystem.AppDataDirectory, filename);
}
}
}
@@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="3.1.1" />
<PackageReference Include="sqlite-net-pcl" Version="1.7.302-beta" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" />
<PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.ComponentModel.DataAnnotations.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Compile Update="Pages\AddPage.xaml.cs">
<DependentUpon>AddPage.xaml</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="MillagePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Pages\AddPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Pages\CarPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Pages\CarsPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Pages\ServicesPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
@@ -0,0 +1,34 @@
<?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"
xmlns:customControls="clr-namespace:HarPadRee.CustomControls"

x:Class="HarPadRee.MillagePage">
<ContentPage.Content>

<StackLayout Margin="10,35,10,10">
<Button Text="Add New Millage" x:Name="AddBtn" Clicked="AddBtn_Clicked"/>

<ListView x:Name="MillageList" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<customControls:ExtendedViewCell SelectedBackgroundColor="White">
<ViewCell.View>
<StackLayout Orientation="Vertical" Padding="4" Spacing="8">
<Label TextColor="Blue" FontSize="Medium" Text="{Binding Date, StringFormat='Date: {0:dd/MM/yyy}'}" />
<Label TextColor="Black" FontSize="Medium" Text="{Binding Miles, StringFormat='Miles: {0}'}" />
<Label TextColor="Green" FontSize="Medium" Text="{Binding Litres, StringFormat='Litres: {0}'}" />
</StackLayout>
</ViewCell.View>
</customControls:ExtendedViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

</StackLayout>

</ContentPage.Content>
</ContentPage>
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using HarPadRee.Models;
namespace HarPadRee
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MillagePage : ContentPage
{
int ID;
public MillagePage(int CarID, string CarName)
{
InitializeComponent();
Title = CarName + " Services";
ID = CarID;

List<MilleageModel> millage = App.MillageRepo.GetAllMillage(ID);
MillageList.ItemsSource = millage;

MessagingCenter.Subscribe<App>((App)Application.Current, "UpdateMillage", (sender) =>
{
UpdateListview();
});
}

private void AddBtn_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new AddPage(2, ID));
}
private void UpdateListview()
{
List<MilleageModel> millage = App.MillageRepo.GetAllMillage(ID);
MillageList.ItemsSource = millage;
}
}
}

0 comments on commit 55ffe53

Please sign in to comment.