private void loadDarkTheme() { DarkTheme dt = new DarkTheme(); //Set the theme for all the tabControl pages BackColor = dt.formBackgroundColor; ForeColor = dt.infoLabelColor; preferencedPage.ForeColor = dt.infoLabelColor; preferencedPage.BackColor = dt.formBackgroundColor; tellemtryPage.ForeColor = dt.labelColor; tellemtryPage.BackColor = dt.formBackgroundColor; thirdPartyPage.ForeColor = dt.infoLabelColor; thirdPartyPage.BackColor = dt.formBackgroundColor; //Set the themes for the rest of the view doneBtn.ForeColor = dt.infoLabelColor; doneBtn.BackColor = dt.formBackgroundColor; applyBtn.ForeColor = dt.infoLabelColor; applyBtn.BackColor = dt.formBackgroundColor; aboutLabel.ForeColor = dt.labelColor; aboutLabel.BackColor = dt.formBackgroundColor; theme.ForeColor = dt.labelColor; theme.BackColor = dt.formBackgroundColor; tellemtry.ForeColor = dt.labelColor; tellemtry.BackColor = dt.formBackgroundColor; }
static void Zadatak5() { DarkTheme darkTheme = new DarkTheme(); ReminderNote note = new ReminderNote("buy milk lol", darkTheme); note.Show(); }
private void applyTheme() { LightTheme lt = new LightTheme(); DarkTheme dt = new DarkTheme(); if (Preferences.Default.DarkTheme == false) { backgroundColour = lt.formBackgroundColor; infolabelColour = lt.infoLabelColor; labelColour = lt.labelColor; } else if (Preferences.Default.DarkTheme == true) { backgroundColour = dt.formBackgroundColor; infolabelColour = dt.infoLabelColor; labelColour = dt.labelColor; } BackColor = backgroundColour; specsverLabel.BackColor = backgroundColour; specsverLabel.ForeColor = infolabelColour; buildLabel.BackColor = backgroundColour; buildLabel.ForeColor = infolabelColour; aluminiumcoreLibVersionLabel.BackColor = backgroundColour; aluminiumcoreLibVersionLabel.ForeColor = infolabelColour; ossLabel.BackColor = backgroundColour; ossLabel.ForeColor = labelColour; }
static void Main(string[] args) { var darkTheme = new DarkTheme(); var about = new About(darkTheme); var careers = new Careers(darkTheme); Console.WriteLine(about.GetContent()); Console.WriteLine(careers.GetContent()); Console.ReadLine(); }
private static void ApplyTheme(ThemeSetting theme) { var environment = DependencyService.Get <IEnvironment>(); ResourceDictionary themeDict; SystemTheme systemTheme = environment.GetOperatingSystemTheme(); switch (theme) { case ThemeSetting.System: if (systemTheme == SystemTheme.Dark) { themeDict = new DarkTheme(); } else { themeDict = new LightTheme(); } break; case ThemeSetting.Light: themeDict = new LightTheme(); systemTheme = SystemTheme.Light; break; case ThemeSetting.Dark: themeDict = new DarkTheme(); systemTheme = SystemTheme.Dark; break; default: throw new NotImplementedException(); } var styleDict = new ElementStyles(); ICollection <ResourceDictionary> mergedDictionaries = currentApplication?.Resources.MergedDictionaries; if (mergedDictionaries != null) { mergedDictionaries.Clear(); mergedDictionaries.Add(themeDict); // Need to merge theme into style dict before adding as style dict depends on theme styleDict.MergedDictionaries.Add(themeDict); mergedDictionaries.Add(styleDict); // Just add font dict since it doesn't depend on any others mergedDictionaries.Add(new AppFonts()); } // Set system theme for platform-specific theming. environment.ApplyTheme(systemTheme); }
public AboutBox() { InitializeComponent(); DarkTheme.Initialize(this); Text = String.Format("关于 {0}", AssemblyTitle); labelProductName.Text = AssemblyProduct; labelVersion.Text = String.Format("版本 {0}", AssemblyVersion); labelCopyright.Text = AssemblyCopyright; labelCompanyName.Text = AssemblyCompany; textBoxDescription.Text = AssemblyDescription; }
/// <summary> /// Changes the application GUI's theme. /// </summary> /// <param name="theme">The theme to switch to.</param> /// <returns>Whether the theme change occurred or not (e.g. in case of changing to a theme that's already active, or in case of a failure, this method returns <c>false</c>).</returns> public bool ChangeTheme(string theme) { if (theme.NullOrEmpty() || theme.Equals(CurrentTheme)) { #if DEBUG if (theme.NullOrEmpty()) { logger.LogError($"{nameof(App)}::{nameof(ChangeTheme)}: Attempted to change theme with a null or empty theme identifier parameter. Please only provide a valid theme parameter to this method!"); } #endif return(false); } ResourceDictionary themeDictionary = null; switch (theme) { case Themes.DARK_THEME: themeDictionary = new DarkTheme(); break; case Themes.LIGHT_THEME: themeDictionary = new LightTheme(); break; case Themes.OLED_THEME: themeDictionary = new OLEDTheme(); break; } if (themeDictionary is null) { logger?.LogWarning($"Theme \"{theme}\" couldn't be found/does not exist."); return(false); } try { Resources.Clear(); Resources.Add(themeDictionary); Resources.Add(new Theme()); Resources.Add(new ControlTemplates()); CurrentTheme = theme; return(true); } catch (Exception e) { logger?.LogWarning($"Theme \"{themeDictionary}\" couldn't be applied. Reverting to default theme... Thrown exception: {e.ToString()}"); return(false); } }
public ArrayParser() { InitializeComponent(); DarkTheme.Initialize(this); frameRoot.ValueChanged += (object sender, EventArgs e) => { if (!isSettingValue) { SaveEditedValue(); } }; }
static void Zadatak7() { DarkTheme darkTheme = new DarkTheme(); LightTheme lightTheme = new LightTheme(); ReminderNote note1 = new ReminderNote("buy milk lol", lightTheme); ReminderNote note2 = new ReminderNote("buy milk again lol", darkTheme); Notebook notebook = new Notebook(darkTheme); notebook.AddNote(note1, lightTheme); notebook.AddNote(note2); notebook.Display(); }
private void EnableThemeToggling() { this.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.T, null, () => { if (Theme is DefaultTheme) { Theme = new DarkTheme(); } else { Theme = new DefaultTheme(); } }, this); }
public static void ChangeTheme(string theme) { // don't change to the same theme if (theme == CurrentTheme) { return; } // clear all the resources Application.Current.Resources.MergedDictionaries.Clear(); Application.Current.Resources.Clear(); ResourceDictionary applicationResourceDictionary = Application.Current.Resources; ResourceDictionary newTheme = null; switch (theme.ToLowerInvariant()) { case "light": newTheme = new LightTheme(); break; case "dark": newTheme = new DarkTheme(); break; case "rose": newTheme = new RoseTheme(); break; default: newTheme = new BaseStyleResources(); break; } foreach (var merged in newTheme.MergedDictionaries) { applicationResourceDictionary.MergedDictionaries.Add(merged); } ManuallyCopyThemes(newTheme, applicationResourceDictionary); CurrentTheme = theme; var platformManager = DependencyService.Get <IPlatformThemeManager>(); if (platformManager != null) { platformManager.ChangeTheme(theme); } }
private void SetTheme() { DarkTheme.Initialize(this); fctbJson.BackColor = DarkTheme.PressedColor; fctbJson.ServiceColors.CollapseMarkerBackColor = DarkTheme.BackColor; fctbJson.ServiceColors.CollapseMarkerBorderColor = DarkTheme.ForeColor; fctbJson.ServiceColors.CollapseMarkerForeColor = DarkTheme.ForeColor; fctbJson.ServiceColors.ExpandMarkerBackColor = DarkTheme.BackColor; fctbJson.ServiceColors.ExpandMarkerBorderColor = DarkTheme.ForeColor; fctbJson.ServiceColors.ExpandMarkerBorderColor = DarkTheme.ForeColor; fctbJson.IndentBackColor = DarkTheme.BackColor; fctbJson.ChangeFontSize(6); }
public static void ChangeTheme(Theme theme, bool forceTheme = false) { if ((theme != CurrentTheme) || forceTheme) { var appResourceDictionary = Application.Current.Resources; ResourceDictionary newTheme; var environment = DependencyService.Get <IEnvironment>(); if (theme == Theme.Default) { theme = environment?.GetOSTheme() ?? Theme.Light; } switch (theme) { case Theme.Light: newTheme = new LightTheme(); break; case Theme.Dark: newTheme = new DarkTheme(); break; case Theme.NordDark: newTheme = new NordDarkTheme(); break; case Theme.NordLight: newTheme = new NordLightTheme(); break; default: newTheme = new LightTheme(); break; } foreach (var merged in newTheme.MergedDictionaries) { appResourceDictionary.MergedDictionaries.Add(merged); } ManuallyCopyThemes(newTheme, appResourceDictionary); CurrentTheme = theme; var statusBarColor = (Color)App.Current.Resources["brandColor"]; environment?.SetStatusBarColor(statusBarColor, true); } }
static void Zadatak6() { DarkTheme darkTheme = new DarkTheme(); LightTheme lightTheme = new LightTheme(); ReminderList list1 = new ReminderList("buy more milk plz", darkTheme); list1.AddToList("mihael"); list1.AddToList("bilo ko drugi"); list1.Show(); ReminderList list2 = new ReminderList("get work done", lightTheme); list2.AddToList("mihael"); list2.AddToList("somebodyelse"); list2.Show(); }
public Editor() { InitializeComponent(); DarkTheme.Initialize(this); // 你tm有本事写在一行啊!!! frameParserRoot.ValueChanged += (object sender, EventArgs e) => { if (!isSettingJson) { MainForm.GetInstance().IsChanged = true; } }; }
private void DefaultThemeChanged(DependencyPropertyChangedEventArgs e) { switch (DefaultTheme) { case DefaultThemesEnum.DarkTheme: Theme = new DarkTheme(ProgrammingLanguage); break; case DefaultThemesEnum.LightTheme: Theme = new LightTheme(ProgrammingLanguage); break; default: Theme = new BlueTheme(ProgrammingLanguage); break; } Theme.SetTheme(this, CustomCompletionControl.Theme); }
public static void ChangeTheme(Theme theme, bool forceTheme = false) { // don't change to the same theme if (theme == CurrentTheme && !forceTheme) { return; } //// clear all the resources var applicationResourceDictionary = Application.Current.Resources; if (theme == Theme.Default) { theme = AppInfo.RequestedTheme == AppTheme.Dark ? Theme.Dark : Theme.Light; } ResourceDictionary newTheme; switch (theme) { case Theme.Light: newTheme = new LightTheme(); break; case Theme.Dark: newTheme = new DarkTheme(); break; case Theme.Default: default: newTheme = new LightTheme(); break; } CurrentTheme = theme; ManuallyCopyThemes(newTheme, applicationResourceDictionary); ChangeStatusBarColor(theme); }
private void applyTheme() { if (Preferences.Default.DarkTheme == false) { LightTheme lt = new LightTheme(); BackColor = lt.formBackgroundColor; okBtn.BackColor = lt.formBackgroundColor; okBtn.ForeColor = lt.infoLabelColor; } else if (Preferences.Default.DarkTheme == true) { DarkTheme dt = new DarkTheme(); BackColor = dt.formBackgroundColor; okBtn.BackColor = dt.formBackgroundColor; okBtn.ForeColor = dt.infoLabelColor; } }
private void SetTheme() { DarkTheme.Initialize(this); menuTop.Renderer = new BetterMenuStripRenderer(); lblFuckGdi.BackColor = DarkTheme.HoverColor; foreach (ToolStripItem i in menuTop.Items) { i.BackColor = BackColor; i.ForeColor = ForeColor; } foreach (ToolStripItem i in smnuDataPack.DropDownItems) { i.BackColor = BackColor; i.ForeColor = ForeColor; } foreach (ToolStripItem i in smnuHelp.DropDownItems) { i.BackColor = BackColor; i.ForeColor = ForeColor; } lblInfoBar.Font = new Font(lblInfoBar.Font.FontFamily, 15f); }
public TextParser() { InitializeComponent(); DarkTheme.Initialize(this); }
public NullBooleanParser() { InitializeComponent(); DarkTheme.Initialize(this); }
private async Task OnLogin() { IsBusy = true; try { if (!await Validate()) { return; } var result = await ApiService.Instance.GetToken(_email, _password, _isDriver, null, _selectedCompany.Key); if (string.IsNullOrWhiteSpace(result?.access_token)) { await Alert.ShowMessage(Translate.Get(nameof(AppResources.CouldNotLoginMessage))); return; } Settings.PushNotificationEmail = _email; Settings.IsImpersonatingCustomer = false; Settings.IsDriver = _isDriver; Settings.Password = _password; Settings.Email = _email; Settings.RememberMe = _rememberMe; Settings.Token = result.access_token; Settings.TokenExpiration = DateTime.Now.AddSeconds(result.expires_in); Settings.IsPortalSuperUser = false; var infoResult = await ApiService.Instance.GetMyInfo(null); if (infoResult.Data == null) { await Alert.ShowMessage(Translate.Get(nameof(AppResources.CouldNotReceiveInformationFromServer))); return; } var mainPageMode = MainPageMode.Default; var infoData = infoResult.Data; if (infoData.CurrentUser?.IsDriver.GetValueOrDefault() ?? false) { Settings.ApplicationMode = ApplicationModeEnum.Driver; } else if (infoData.CurrentUser?.IsSalesRep.GetValueOrDefault() ?? false) { Settings.ApplicationMode = ApplicationModeEnum.Pipeline; } else { Settings.ApplicationMode = ApplicationModeEnum.Portal; if (infoData.CurrentUser.IsTruliteUser) { Settings.IsPortalSuperUser = true; mainPageMode = MainPageMode.PortalSuperUser; } } //Currently only portal has Light/Dark mode if (Settings.ApplicationMode == ApplicationModeEnum.Portal) { if (SettingsService.Instance.IsDarkTheme) { var dt = new DarkTheme(); App.Current.Resources.MergedDictionaries.Add(dt); } } Settings.Company = _selectedCompany.Key; Settings.CustomerId = infoData?.CurrentUser?.ActiveCustomerId; Settings.AxCustomerId = infoData?.CustomerInfo?.Key; Settings.MasterAxCustomerId = infoData?.CustomerInfo?.Key; Settings.MyInfo = infoData; if (Settings.MyPreferences == null) { Settings.MyPreferences = infoData.AppPreferences; } await PushNotificationService.Instance.RegisterTokenWithServer(); var permissions = await Api.GetAccountPermissions(); Settings.AccountPermissions = permissions.Data; SetLanguage(); Analytics.TrackEvent("Logged", new Dictionary <string, string> { { "User", _email } }); if (infoData.CurrentUser.HasAgreedToTerms.GetValueOrDefault()) { var mainpage = new NavigationPage(new MasterDetailPage1(mainPageMode)); App.Current.MainPage = mainpage; NavigationService.Instance.Init(mainpage.Navigation); } else { await NavigateTo(new TermsPage(mainPageMode), true); } //Crashes.GenerateTestCrash(); } catch (Exception e) { await Alert.DisplayError(e); } finally { IsBusy = false; } }
private void KeppySynthMixerWindow_Load(object sender, EventArgs e) { try { base.DoubleBuffered = true; SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); Delegate = this; CPUSpeed(); if (Channels == null) { Registry.CurrentUser.CreateSubKey("SOFTWARE\\OmniMIDI\\Channels"); return; } for (int i = 0; i <= 15; ++i) { RegValInt[i] = Convert.ToInt32(Channels.GetValue(RegValName[i], 100)); if (RegValInt[i] > 100) { RegValInt[i] = 100; } } CH1VOL.Value = RegValInt[0]; CH2VOL.Value = RegValInt[1]; CH3VOL.Value = RegValInt[2]; CH4VOL.Value = RegValInt[3]; CH5VOL.Value = RegValInt[4]; CH6VOL.Value = RegValInt[5]; CH7VOL.Value = RegValInt[6]; CH8VOL.Value = RegValInt[7]; CH9VOL.Value = RegValInt[8]; CH10VOL.Value = RegValInt[9]; CH11VOL.Value = RegValInt[10]; CH12VOL.Value = RegValInt[11]; CH13VOL.Value = RegValInt[12]; CH14VOL.Value = RegValInt[13]; CH15VOL.Value = RegValInt[14]; CH16VOL.Value = RegValInt[15]; MainVol.Value = RegValInt.Max(); if (Convert.ToInt32(Settings.GetValue("VolumeMonitor")) == 1) { VolumeMonitor.Checked = true; MeterFunc.EnableLEDs(); VUStatus = true; } else { VolumeMonitor.Checked = false; MeterFunc.DisableLEDs(); VUStatus = false; } ChannelVolume.Enabled = true; GarbageCollector.RunWorkerAsync(); Meter.ContextMenu = PeakMeterMenu; VolumeCheck.Interval = Convert.ToInt32((1.0 / Properties.Settings.Default.VolUpdateHz) * 1000.0); if (Properties.Settings.Default.CurrentTheme == 0) { ClassicTheme.PerformClick(); } else if (Properties.Settings.Default.CurrentTheme == 1) { DarkTheme.PerformClick(); } else if (Properties.Settings.Default.CurrentTheme == 2) { ItsThe80sTheme.PerformClick(); } else { ClassicTheme.PerformClick(); } } catch (Exception ex) { MessageBox.Show("Can not read settings from the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
public NumberParser() { InitializeComponent(); DarkTheme.Initialize(this); }