Add files via upload
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="FileReadAndWrite.View.AppDataFilePage"
|
||||
Title="Odczyt z danych aplikacji">
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout
|
||||
Padding="30,0"
|
||||
Spacing="25">
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace FileReadAndWrite.View
|
||||
{
|
||||
public partial class AppDataFilePage : ContentPage
|
||||
{
|
||||
public AppDataFilePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="FileReadAndWrite.View.MainPage">
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout
|
||||
Padding="30,0"
|
||||
Spacing="25">
|
||||
<Label Text="Jaki typ pliku chcesz przetestować?" />
|
||||
<Button Text="Plik z danych aplikacji" Command="{Binding EnterAppDataFileCmd}" />
|
||||
<Button Text="Plik z zasobów" Command="{Binding EnterRawFileCmd}" />
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,14 @@
|
||||
using FileReadAndWrite.Service;
|
||||
using FileReadAndWrite.ViewModel;
|
||||
|
||||
namespace FileReadAndWrite.View;
|
||||
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = new MainViewModel(Navigation, new FileService());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="FileReadAndWrite.View.RawFilePage"
|
||||
Title="Odczyt z Zasobów">
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout
|
||||
Padding="30,0"
|
||||
Spacing="25">
|
||||
<Label>
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<Span Text="Treść pliku " />
|
||||
<Span Text="data.txt" FontAttributes="Bold" />
|
||||
<Span Text=" znajdującego się w zasobach aplikacji:" />
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
<Label Text="{Binding RawFileContent}" />
|
||||
<Button Text="Załaduj dane" Command="{Binding LoadRawFileCmd}" />
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using FileReadAndWrite.Service;
|
||||
|
||||
namespace FileReadAndWrite.View;
|
||||
|
||||
public partial class RawFilePage : ContentPage {
|
||||
private readonly FileService _fileService;
|
||||
private string _rawFileContent = "";
|
||||
public string RawFileContent {
|
||||
get => _rawFileContent;
|
||||
set {
|
||||
_rawFileContent = value;
|
||||
OnPropertyChanged(nameof(RawFileContent));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand LoadRawFileCmd { get; }
|
||||
|
||||
public RawFilePage(FileService fileService) {
|
||||
InitializeComponent();
|
||||
_fileService = fileService;
|
||||
|
||||
BindingContext = this;
|
||||
LoadRawFileCmd = new Command(async () => await LoadRawFile());
|
||||
}
|
||||
|
||||
public async Task LoadRawFile(){
|
||||
RawFileContent = await _fileService.LoadAsset("data.txt");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user