/// <summary> /// Application theme changed /// </summary> private void AppThemeChanged(object sender, EventArgs e) { if (rbAppThemeLight.Checked) { Minimal.SetTheme(this, Minimal.Light); User.UpdateConfig(new Config(Minimal.Light, User.GetConfig().DrawerTheme, User.GetConfig().Tint)); } if (rbAppThemeDark.Checked) { Minimal.SetTheme(this, Minimal.Dark); User.UpdateConfig(new Config(Minimal.Dark, User.GetConfig().DrawerTheme, User.GetConfig().Tint)); } }
/// <summary> /// Theme changed /// </summary> private void ThemeChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { // Light theme if (cbTheme.SelectedItem.PrimaryText == "Light") { Minimal.SetTheme(this, Minimal.Light); } // Dark theme if (cbTheme.SelectedItem.PrimaryText == "Dark") { Minimal.SetTheme(this, Minimal.Dark); } }
/// <summary> /// Constructor /// </summary> public Main(User loggedUser) { // Initialize component InitializeComponent(); // Variables User = loggedUser; // Load user config file Config config = User.GetConfig(); // Apply settings from config Minimal.SetTheme(this, config.AppTheme); drawer.UsedTheme = config.DrawerTheme; Minimal.SetTint(this, config.Tint); lblPasswordCount.Tint = lblGroupsCount.Tint = lblWarningsCount.Tint = Color.White; lblPasswords.Tint = lblGroups.Tint = lblWarnings.Tint = Color.White; btnAddPasswordShortcut.Tint = Color.FromArgb(76, 175, 80); btnAddGroupShortcut.Tint = Color.FromArgb(255, 152, 0); btnShowWarningsShortcut.Tint = Color.FromArgb(211, 47, 47); // Initialize drawer InitializeDrawer(); // Turn on double buffer DoubleBuffered = true; // Hide all error labels lblErrorMessagePassword.Visible = false; lblErrorMessagePasswordEdit.Visible = false; // User name and last name lblUser.Text = User.Name + " " + User.Lastname; // Dashboard int passwordsCount = 0; int groupsCount = 0; foreach (Group group in User.GetGroups()) { int count = 0; // Get group items foreach (Password password in User.GetPasswords()) { if (password.Group == group.Name) { count++; } } passwordsCount += count; groupsCount++; } lblPasswordCount.Text = passwordsCount.ToString(); lblGroupsCount.Text = groupsCount.ToString(); // Settings if (config.AppTheme == Minimal.Light) { rbAppThemeLight.Checked = true; } if (config.AppTheme == Minimal.Dark) { rbAppThemeDark.Checked = true; } if (config.DrawerTheme == Minimal.Light) { rbDrawerThemeLight.Checked = true; } if (config.DrawerTheme == Minimal.Dark) { rbDrawerThemeDark.Checked = true; } }