/// <summary> /// Function to change user's Theme in realtime /// when user chooses a different Theme preference /// </summary> void ChangeTheme(string theme) { var appTheme = EnumsHelper.ConvertToEnum <Settings.Theme>(theme); switch (appTheme) { case Settings.Theme.LightTheme: IsLightTheme = true; ThemeHelper.ChangeToLightTheme(); break; case Settings.Theme.DarkTheme: IsDarkTheme = true; ThemeHelper.ChangeToDarkTheme(); break; case Settings.Theme.SystemPreferred: IsSystemPreferredTheme = true; ThemeHelper.ChangeToSystemPreferredTheme(); break; default: IsSystemPreferredTheme = true; ThemeHelper.ChangeToSystemPreferredTheme(); break; } }
private void TapGestureRecognizer_Tapped(object sender, EventArgs e) { var args = (TappedEventArgs)e; var theme = args.Parameter.ToString(); var appTheme = Enums.ConvertToEnum <Settings.Theme>(theme); switch (appTheme) { case Settings.Theme.LightTheme: IsLightTheme = true; ThemeHelper.ChangeToLightTheme(); break; case Settings.Theme.DarkTheme: IsDarkTheme = true; ThemeHelper.ChangeToDarkTheme(); break; case Settings.Theme.SystemPreferred: IsSystemPreferredTheme = true; ThemeHelper.ChangeToSystemPreferredTheme(); break; default: IsSystemPreferredTheme = true; ThemeHelper.ChangeToSystemPreferredTheme(); break; } }