Update
This commit is contained in:
@@ -8,7 +8,10 @@
|
||||
<VerticalStackLayout
|
||||
Padding="30,0"
|
||||
Spacing="25">
|
||||
|
||||
<Label Text="Zawartość, która jest zapisywana w plikach aplikacji:" />
|
||||
<Entry Text="{Binding AppDataFileContent}" />
|
||||
<Button Text="Załaduj dane" Command="{Binding LoadAppDataFileCmd}" />
|
||||
<Button Text="Zapisz dane" Command="{Binding SaveAppDataFileCmd}" />
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using FileReadAndWrite.Service;
|
||||
using FileReadAndWrite.ViewModel;
|
||||
|
||||
namespace FileReadAndWrite.View
|
||||
{
|
||||
public partial class AppDataFilePage : ContentPage
|
||||
{
|
||||
public AppDataFilePage()
|
||||
public AppDataFilePage(FileService fileService)
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = new AppDataFilePageVM(fileService);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using FileReadAndWrite.Service;
|
||||
using FileReadAndWrite.ViewModel;
|
||||
|
||||
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");
|
||||
BindingContext = new RawFilePageVM(fileService);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user