From 01f9c3aa2fb6826d924f043ec251e2eb95c36f72 Mon Sep 17 00:00:00 2001 From: synzr Date: Fri, 21 Nov 2025 10:41:52 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Intersvyaz.Core/Intersvyaz.Core.csproj | 2 ++ .../Services/ISettingsService.cs | 24 +++++++++++++++++++ .../Services/SettingsService.cs | 24 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/Intersvyaz.Core/Services/ISettingsService.cs create mode 100644 src/Intersvyaz.Core/Services/SettingsService.cs diff --git a/src/Intersvyaz.Core/Intersvyaz.Core.csproj b/src/Intersvyaz.Core/Intersvyaz.Core.csproj index 1e6ba33..fa80de6 100644 --- a/src/Intersvyaz.Core/Intersvyaz.Core.csproj +++ b/src/Intersvyaz.Core/Intersvyaz.Core.csproj @@ -123,7 +123,9 @@ + + diff --git a/src/Intersvyaz.Core/Services/ISettingsService.cs b/src/Intersvyaz.Core/Services/ISettingsService.cs new file mode 100644 index 0000000..fb25a9a --- /dev/null +++ b/src/Intersvyaz.Core/Services/ISettingsService.cs @@ -0,0 +1,24 @@ +using System; + +namespace Intersvyaz.Core.Services +{ + public interface ISettingsService + { + /// + /// Событие об изменении текущего пользователя. + /// + event EventHandler CurrentUserChanged; + + /// + /// Получить текущего пользователя. + /// + /// Имя пользователя. + string GetCurrentUser(); + + /// + /// Установить нового текущего пользователя. + /// + /// Имя нового пользователя. + void SetCurrentUser(string value); + } +} diff --git a/src/Intersvyaz.Core/Services/SettingsService.cs b/src/Intersvyaz.Core/Services/SettingsService.cs new file mode 100644 index 0000000..446c4ce --- /dev/null +++ b/src/Intersvyaz.Core/Services/SettingsService.cs @@ -0,0 +1,24 @@ +using System; +using Windows.Storage; + +namespace Intersvyaz.Core.Services +{ + public class SettingsService : ISettingsService + { + /// + public event EventHandler CurrentUserChanged; + + /// + public string GetCurrentUser() + { + return (string)ApplicationData.Current.LocalSettings.Values["CurrentUser"] ?? null; + } + + /// + public void SetCurrentUser(string value) + { + ApplicationData.Current.LocalSettings.Values["CurrentUser"] = value; + CurrentUserChanged?.Invoke(this, value); + } + } +}