using System.Diagnostics;

namespace MauiUI
{
    public partial class MainPage : ContentPage
    {
        public const double MyFontSize = 28;

        private string _fileName = Path.Combine(FileSystem.AppDataDirectory, "notes.txt");

        public MainPage()
        {
            InitializeComponent();
            if (File.Exists(_fileName))
                editor.Text = File.ReadAllText(_fileName);
        }

        private void LoginButton_Clicked(object sender, EventArgs e)
        {
            Debug.WriteLine("Clicked!");
        }

        private void OnSaveButton_Clicked(object sender, EventArgs e)
        {
            File.WriteAllText(_fileName, editor.Text);
        }

        private void OnDeleteButton_Clicked(object sender, EventArgs e)
        {
            editor.Text = ""; 
            File.WriteAllText(_fileName, editor.Text);
        }
    }
}
