public ForeingBoxPage(ForeingBox _foreingBox, bool isAfterReceiving = false) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); OSAppTheme currentTheme = Application.Current.RequestedTheme; BackG.CloseWhenBackgroundIsClicked = true; #region DataFill ForeingBox foreing = _foreingBox; ForeignUserImage.Source = foreing.ImageFullPath; ForeignUserName.Text = foreing.FullName; if (foreing.Edad != 0) { ForeignAge.Text = foreing.Edad + Languages.Anios; } if (foreing.Ubicacion != "") { ForeignLocation.Text = foreing.Ubicacion; } if (foreing.Ubicacion != "") { ForeignJob.Text = foreing.Ocupacion; } ForeignConnection.Text = Languages.ViewsLabel + foreing.Conexiones; #endregion }
void SetText() { UkName.Text = Settings.MobileSettings.main_name; FormattedString formattedName = new FormattedString(); OSAppTheme currentTheme = Application.Current.RequestedTheme; //if (Xamarin.Essentials.DeviceInfo.Platform == Xamarin.Essentials.DevicePlatform.iOS) // currentTheme = OSAppTheme.Dark; formattedName.Spans.Add(new Span { Text = Settings.Person.FIO, TextColor = currentTheme.Equals(OSAppTheme.Dark) ? Color.White : Color.Black, FontAttributes = FontAttributes.Bold, FontSize = 16 }); formattedName.Spans.Add(new Span { Text = AppResources.GoodDay, TextColor = currentTheme.Equals(OSAppTheme.Dark) ? Color.White : Color.Black, FontAttributes = FontAttributes.None, FontSize = 16 }); Color hexColor = (Color)Application.Current.Resources["MainColor"]; //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White); //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White); }
public static void ToggleTheme() { ICollection <ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries; if (mergedDictionaries != null) { mergedDictionaries.Clear(); switch (Settings.Current.DarkMode) { case "On": mergedDictionaries.Add(new DarkTheme()); break; case "Off": mergedDictionaries.Add(new LightTheme()); break; default: OSAppTheme currentTheme = Application.Current.RequestedTheme; if (currentTheme.ToString().Equals("Dark")) { mergedDictionaries.Add(new DarkTheme()); } else { mergedDictionaries.Add(new LightTheme()); } break; } } }
public override void OnNavigatedTo(INavigationParameters parameters) { _sortOption = (SortOption)_settingsManager.Sorting; SetSortingRadioButton(); _theme = (OSAppTheme)_settingsManager.Theme; SetThemeRadioButton(); }
public static bool SetAppTheme(OSAppTheme selectedTheme) { var statusBarManager = DependencyService.Get <IStatusBarStyleManager>(); ICollection <ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries; if (mergedDictionaries == null) { return(false); } mergedDictionaries.Clear(); switch (selectedTheme) { case OSAppTheme.Dark: var theme = new DarkTheme(); mergedDictionaries.Add(theme); statusBarManager.SetColoredStatusBar(((Color)theme["StatusBarColor"]).ToHex()); break; case OSAppTheme.Light: mergedDictionaries.Add(new LightTheme()); statusBarManager.SetWhiteStatusBar(); break; } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="App" /> class. /// </summary> public App() { #if EnableAppCenterAnalytics // AppCenter.Start( // $"ios={AppSettings.IOSSecretCode};android={AppSettings.AndroidSecretCode};uwp={AppSettings.UWPSecretCode}", // typeof(Analytics), // typeof(Crashes)); #endif // Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Please replace the license key here"); this.InitializeComponent(); OSAppTheme currentTheme = Application.Current.RequestedTheme; if (currentTheme == OSAppTheme.Light) { Application.Current.Resources.ApplyLightTheme(); } else { Application.Current.Resources.ApplyDarkTheme(); } // this.MainPage = new AppShell(); this.MainPage = new NavigationPage(new HomePage()); }
public void ApplyTheme(OSAppTheme theme) { Application.Current.UserAppTheme = theme; ICollection <ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries; var dictionaryList = mergedDictionaries.ToList(); foreach (var dictionary in dictionaryList) { if (dictionary is DarkTheme || dictionary is LightTheme) { mergedDictionaries.Remove(dictionary); } } if (mergedDictionaries != null) { switch (theme) { case OSAppTheme.Dark: mergedDictionaries.Add(new DarkTheme()); break; case OSAppTheme.Light: default: mergedDictionaries.Add(new LightTheme()); break; } } }
public MyProfilePage() { InitializeComponent(); OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } var user = MainViewModel.GetInstance().User; if (user.UserTypeId == 1) { //ExtProfile.IsVisible = false; } else { ButtonSave.IsVisible = false; ButtonChangePassw.IsVisible = false; Email.IsVisible = false; FirstNameEntry.IsReadOnly = true; LastNameEntry.IsReadOnly = true; //ExtProfile.IsVisible = true; //ChangeImage.IsVisible = false; } }
private void SetTitle() { OSAppTheme currentTheme = Application.Current.RequestedTheme; var colors = new Dictionary <string, string>(); var arrowcolor = new Dictionary <string, string>(); if (currentTheme == OSAppTheme.Light || currentTheme == OSAppTheme.Unspecified) { colors.Add("#000000", ((Color)Application.Current.Resources["MainColor"]).ToHex()); arrowcolor.Add("#000000", "#494949"); } else { colors.Add("#000000", "#FFFFFF"); arrowcolor.Add("#000000", "#FFFFFF"); } //IconViewTech.ReplaceStringMap = colors; //Arrow.ReplaceStringMap = arrowcolor; //if (Xamarin.Essentials.DeviceInfo.Platform == Xamarin.Essentials.DevicePlatform.iOS) // currentTheme = OSAppTheme.Dark; SetHeader(currentTheme); }
/// <summary> /// Sets app theme to use for platform. This ensures that platform dependent dialogs are /// themed correctly when switching themes. /// </summary> /// <param name="requestedTheme">requested theme</param> public void SetPlatformTheme(OSAppTheme requestedTheme) { // switch to UI thread; or else accessing RequestedTheme on UWP crashes if (!MainThread.IsMainThread) { MainThread.BeginInvokeOnMainThread(() => this.SetPlatformTheme(requestedTheme)); return; } try { switch (requestedTheme) { case OSAppTheme.Dark: App.Current.RequestedTheme = Windows.UI.Xaml.ApplicationTheme.Dark; break; case OSAppTheme.Light: App.Current.RequestedTheme = Windows.UI.Xaml.ApplicationTheme.Light; break; default: // ignore other requested themes break; } } catch (Exception) { // ignore errors when setting theme } }
void OnChangeTheme(object s, EventArgs e) { OSAppTheme currentTheme = Application.Current.RequestedTheme; Application.Current.UserAppTheme = (currentTheme == OSAppTheme.Light) ? OSAppTheme.Dark : OSAppTheme.Light; CurrentThemeLabel.Text = Application.Current.UserAppTheme.ToString(); }
private void HandleRequestedThemeChanged(object sender, AppThemeChangedEventArgs e) { if (e.RequestedTheme != _currentTheme) { _currentTheme = e.RequestedTheme; SetTheme(_currentTheme); } }
void SetChartTheme(OSAppTheme theme) { var textColor = theme == OSAppTheme.Dark ? SKColors.White : SKColors.Black; var chart = Chart; chart.Legend.TextColor = textColor; chart.Data.SetValueTextColor(SKColors.Black); chart.SetEntryLabelColor(SKColors.Black); }
/// <summary> /// Sets app theme to use for platform. This ensures that platform dependent dialogs are /// themed correctly when switching themes. /// </summary> /// <param name="requestedTheme">requested theme</param> public void SetPlatformTheme(OSAppTheme requestedTheme) { AppCompatDelegate.DefaultNightMode = requestedTheme switch { OSAppTheme.Dark => AppCompatDelegate.ModeNightYes, OSAppTheme.Light => AppCompatDelegate.ModeNightNo, _ => AppCompatDelegate.ModeNightFollowSystem, }; }
public SettingsViewModel() { Console.WriteLine("entro en el constructor"); changeThemeCommand = new Command(async => changeThemeClicked()); changeValueRadioButtonCommand = new Command(async => ValueRadioButtonClicked()); viewTermsAndConditionsCommand = new Command(async => viewTermsAndConditionsClickedAsync()); OSAppTheme currentTheme = Application.Current.RequestedTheme; nameTheme = currentTheme.ToString(); }
void SetChartTheme(OSAppTheme theme) { var textColor = theme == OSAppTheme.Dark ? SKColors.White : SKColors.Black; var chart = Chart; chart.AxisLeft.TextColor = textColor; chart.AxisRight.TextColor = textColor; chart.XAxis.TextColor = textColor; chart.Legend.TextColor = textColor; }
public ListOfNetworksPage(int _BoxId) { InitializeComponent(); apiService = new ApiService(); Box = new Box(); Box.BoxId = _BoxId; NavigationPage.SetHasNavigationBar(this, false); OSAppTheme currentTheme = Application.Current.RequestedTheme; BackgroundFull.CloseWhenBackgroundIsClicked = true; }
void RadioButton_CheckedChanged(System.Object sender, Xamarin.Forms.CheckedChangedEventArgs e) { OSAppTheme val = (OSAppTheme)((RadioButton)sender).Value; if (App.Current.UserAppTheme == val) { return; } App.Current.UserAppTheme = val; }
void ImageButton_Clicked(System.Object sender, System.EventArgs e) { OSAppTheme currentTheme = Application.Current.RequestedTheme; if (currentTheme == OSAppTheme.Light) { Application.Current.UserAppTheme = OSAppTheme.Dark; } else { Application.Current.UserAppTheme = OSAppTheme.Light; } }
public static string CurrentThemeToString() { OSAppTheme currentTheme = Application.Current.RequestedTheme; if (currentTheme == OSAppTheme.Light) { return("Light"); } else { return("Dark"); } }
void LoadTheme() { OSAppTheme currentTheme = Application.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { dictionary.MergedDictionaries.Add(DarkThemeStyle.SharedInstance); } else { dictionary.MergedDictionaries.Add(LightThemeStyle.SharedInstance); } }
public DetailsBoxEdithPage(Box _box) { InitializeComponent(); OSAppTheme currentTheme = Application.Current.RequestedTheme; //changeColor(); NavigationPage.SetHasNavigationBar(this, false); FullBackGround.BackgroundColor = NewColor; #region F apiService = new ApiService(); FullBackGround.CloseWhenBackgroundIsClicked = true; ProfilesSelected = new ObservableCollection <ProfileLocal>(); int BoxId = _box.BoxId; int UserID = MainViewModel.GetInstance().User.UserId; bool BoxDefault = false; var BxSaveName = new Button(); var BxBtnDelete = new ImageButton(); var bxBtnHome = new ImageButton(); var BxDefaultCheckBox = new CheckBox(); //Definir color de fondo con respecto a si la box es predeterminada if (currentTheme == OSAppTheme.Dark) { BackG.BackgroundColor = Color.FromHex("#222b3a"); bxBtnHome.BackgroundColor = Color.FromHex("#222b3a"); BxSaveName.BackgroundColor = Color.FromHex("#222b3a"); BxBtnDelete.BackgroundColor = Color.FromHex("#222b3a"); DeleteButton.Source = "trash3"; ColorBtn.Source = "pelta3"; } else { BackG.BackgroundColor = Color.FromHex("#FFFFFF"); bxBtnHome.BackgroundColor = Color.FromHex("#FFFFFF"); BxSaveName.BackgroundColor = Color.FromHex("#FFFFFF"); BxBtnDelete.BackgroundColor = Color.FromHex("#FFFFFF"); DeleteButton.Source = "trash2"; ColorBtn.Source = "paleta"; } //Acción de boton de borrado DeleteButton.Clicked += new EventHandler((sender, e) => deleteBox(sender, e, BoxId, UserID, BoxDefault)); //Acción de botón actualización de Box BoxUpdateBtn.Clicked += new EventHandler((sender, e) => UpdateBoxName(sender, e, BoxId, BxNameEntry.Text, UserID, BxNameEntry.IsReadOnly)); //Acción de cambiar color de Box ColorBtn.Clicked += new EventHandler((sender, e) => ChangeColor(sender, e, _box)); #endregion }
/// <summary> /// Changes app theme /// </summary> /// <param name="theme">new theme to use</param> /// <param name="forceUpdate">true to force update, false when not</param> public static void ChangeTheme(Theme theme, bool forceUpdate) { if (!forceUpdate && CurrentTheme == theme) { return; } // switch to UI thread; or else accessing RequestedTheme on UWP crashes if (!MainThread.IsMainThread) { MainThread.BeginInvokeOnMainThread(() => ChangeTheme(theme, forceUpdate)); return; } var platform = DependencyService.Get <IPlatform>(); if (theme == Theme.Device) { // we need to set this to Unspecified first, or RequestedTheme would just contain // the last set value, instead of the device's actual theme Application.Current.UserAppTheme = OSAppTheme.Unspecified; // we also need to reset the platform's theme, or else RequestedTheme would still // report the last set platform theme platform?.SetPlatformTheme(OSAppTheme.Unspecified); OSAppTheme appTheme = Application.Current.RequestedTheme; theme = appTheme == OSAppTheme.Dark ? Theme.Dark : Theme.Light; } ResourceDictionary newTheme = theme == Theme.Dark ? new DarkTheme() : (ResourceDictionary) new LightTheme(); var resources = Application.Current.Resources; foreach (var item in newTheme.Keys) { resources[item] = newTheme[item]; } Application.Current.UserAppTheme = OSAppThemeFromTheme(theme); // apply platform specific changes var platformAppTheme = theme == Theme.Dark ? OSAppTheme.Dark : OSAppTheme.Light; platform?.SetPlatformTheme(platformAppTheme); // remember new theme CurrentTheme = theme; }
public ChangePasswordPage() { InitializeComponent(); OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } }
public RedyToScan() { InitializeComponent(); OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } }
public ProfilesByTwitterPage() { InitializeComponent(); OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } }
public EditProfilePhonePage(int _ProfilePhoneId) { InitializeComponent(); OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } }
public CreateProfileSMPage() { InitializeComponent(); #region Logo Superior OSAppTheme currentTheme = App.Current.RequestedTheme; if (currentTheme == OSAppTheme.Dark) { Logosuperior.Source = "logo_superior2.png"; } else { Logosuperior.Source = "logo_superior3.png"; } #endregion //ProfilesEmail.Clicked += new EventHandler((sender, e) => ProfilesList_Clicked(sender, e, _BoxId, "Email", _boxDefault, _boxName)); }
private void SetTheme(OSAppTheme appTheme) { switch (appTheme) { case OSAppTheme.Dark: Current.Resources = new DarkTheme(); break; case OSAppTheme.Light: Current.Resources = new LightTheme(); break; case OSAppTheme.Unspecified: Current.Resources = new LightTheme(); break; } }
public void SetStatusBarColor(OSAppTheme theme, Color overrideColor = default) { // The SetStatusBarcolor is new since API 21 if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { var color = overrideColor == default ? theme == OSAppTheme.Dark ? (Color)Xamarin.Forms.Application.Current.Resources["black"] : (Color)Xamarin.Forms.Application.Current.Resources["white"] : overrideColor; var darkStatusBarTint = theme != OSAppTheme.Dark; var window = CrossCurrentActivity.Current.Activity.Window; window.AddFlags(Android.Views.WindowManagerFlags.DrawsSystemBarBackgrounds); window.ClearFlags(Android.Views.WindowManagerFlags.TranslucentStatus); window.SetStatusBarColor(color.ToAndroid()); var flag = (Android.Views.StatusBarVisibility)Android.Views.SystemUiFlags.LightStatusBar; window.DecorView.SystemUiVisibility = darkStatusBarTint || overrideColor != default ? flag : 0; } }