示例#1
0
        /// <summary>
        /// Value of blue track-bar is changed
        /// </summary>
        private void TrbBlueChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            // Change label text
            lblBlue.Text = trbBlue.Value.ToString();

            // Get color tint
            Color c = Color.FromArgb(int.Parse(lblRed.Text), int.Parse(lblGreen.Text), int.Parse(lblBlue.Text));

            // Update tint
            Minimal.SetTint(this, c);
            tintColor = c;
        }
示例#2
0
        /// <summary>
        /// Click on color box from color palette
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ColorBoxClick(object sender, EventArgs e)
        {
            // Get color box from sender
            MColorBox box = (MColorBox)sender;

            // Set tint
            Minimal.SetTint(this, box.Color);
            tintColor = box.Color;

            // Change track-bars
            trbRed.Value   = box.Color.R;
            trbGreen.Value = box.Color.G;
            trbBlue.Value  = box.Color.B;
        }
示例#3
0
        private void SetCustomColorClick(object sender, EventArgs e)
        {
            Color color = Color.FromArgb((int)trbRed.Value, (int)trbGreen.Value, (int)trbBlue.Value);

            Minimal.SetTint(this, color);

            // Update configuration
            Config c = User.GetConfig();

            User.UpdateConfig(new Config(c.AppTheme, c.DrawerTheme, color));

            // Set tint color for homepage
            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);
        }
示例#4
0
        /// <summary>
        /// Update of tint color
        /// </summary>

        private void PaletteClick(object sender, EventArgs e)
        {
            // Get color
            MColorBox box = (MColorBox)sender;

            Minimal.SetTint(this, box.Color);

            // Update configuration
            Config c = User.GetConfig();

            User.UpdateConfig(new Config(c.AppTheme, c.DrawerTheme, box.Color));

            // Set tint color for homepage
            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);

            trbRed.Value   = box.Color.R;
            trbGreen.Value = box.Color.G;
            trbBlue.Value  = box.Color.B;
        }
示例#5
0
        /// <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;
            }
        }