| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using YJMPD_UWP.Helpers;
- using System;
- using System.ComponentModel;
- using Windows.UI.Core;
- namespace YJMPD_UWP.ViewModels
- {
- public class TemplateVM : INotifyPropertyChanged
- {
- protected CoreDispatcher dispatcher;
- public TemplateVM(string title)
- {
- dispatcher = App.Dispatcher;
- Settings.OnLanguageUpdate += Settings_OnLanguageUpdate;
- if (App.MainPage != null)
- App.MainPage.Title = title;
- }
- private void Settings_OnLanguageUpdate(EventArgs e)
- {
- dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
- {
- UpdatePropertiesToNewLanguage();
- });
- }
- protected virtual void UpdatePropertiesToNewLanguage()
- {
- //to implement in underlying class
- }
- public event PropertyChangedEventHandler PropertyChanged;
- protected void NotifyPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
|