Upload plików - początek

This commit is contained in:
Krzysztof KrzysiekSiemv Smaga
2025-03-10 19:49:55 +01:00
commit 582c0f69ab
3536 changed files with 371692 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
using System.Net.WebSockets;
using Navigation_Between.Interface;
namespace Navigation_Between.Service;
public class AlertService : IAlertService {
public async Task ShowAlert(string title, string message, string button){
// Application.Current.MainPage jest już przestarzale, dlatego stosujemy teraz..:
var currentPage = Application.Current?.Windows.FirstOrDefault()?.Page;
if(currentPage != null)
await currentPage.DisplayAlert(title, message, button);
}
// Typ okna, które pozwala na pobranie od użytkownika danych z inputa
public async Task<string> ShowPrompt(string title, string message, string accept, string cancel, string placeholder) {
var currentPage = Application.Current?.Windows.FirstOrDefault()?.Page;
return currentPage != null ? await currentPage.DisplayPromptAsync(title, message, accept, cancel, placeholder) : "error";
}
// Typ okna, w którym dajemy wybory od użytkownika
public async Task<string> ShowAction(string title, string cancel, string destruction, string[] options){
var currentPage = Application.Current?.Windows.FirstOrDefault()?.Page;
return currentPage != null ? await currentPage.DisplayActionSheet(title, cancel, destruction, options) : "error";
}
}
+28
View File
@@ -0,0 +1,28 @@
using System.Collections.ObjectModel;
using Navigation_Between.Model;
namespace Navigation_Between.Service;
// Serwis, który przechowuje dane, dzięki którym możemy przerzucać dane między oknami
public class DataService {
// Lista użytkowników
private ObservableCollection<User> users;
public DataService() {
users = new () {
new () { Id = 1, Name = "Kristiano", Description = "Someone" },
new () { Id = 2, Name = "Marian", Description = "Polak jakich mało" },
new () { Id = 3, Name = "Blanka", Description = "bejbe" }
};
}
public ObservableCollection<User> GetUsers() => users;
public void AddUser(User user) {
users.Add(user);
}
public void RemoveUser(User user) {
users.Remove(user);
}
}