Beispiel #1
0
        /// <summary>
        /// Loads /creates encryption keys and file data based on what was selected
        /// on the selection screen
        /// </summary>
        /// <param name="sender">The selected metro tile.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void SetDisplayMode(object sender, EventArgs e)
        {
            if (!InitialDisplayModeSelected)
            {
                PasswordManagement.EnableTab(InfoManagementTab);
                PasswordManagement.EnableTab(InfoAddTab);
            }

            if (notification != null)
            {
                notification.Close();
            }

            ClearApplicationData();
            cbWebsites.DataSource = null;
            var tile = (MetroFramework.Controls.MetroTile)sender;

            switch (tile.Name)
            {
            case "mtWork":
                this.Text  = Constants.InformationSelectionScreen.WorkManagement;
                this.Style = MetroFramework.MetroColorStyle.Default;
                Display    = new DisplayMode(AppDomain.CurrentDomain.BaseDirectory + Constants.FilePaths.WorkInformation);
                break;

            case "mtPersonal":
                this.Text  = Constants.InformationSelectionScreen.PersonalManagement;
                this.Style = MetroFramework.MetroColorStyle.Yellow;
                Display    = new DisplayMode(AppDomain.CurrentDomain.BaseDirectory + Constants.FilePaths.PersonalInformation);
                break;

            case "mtSocialMedia":
                this.Text  = Constants.InformationSelectionScreen.SocialMediaManagement;
                this.Style = MetroFramework.MetroColorStyle.Purple;
                Display    = new DisplayMode(AppDomain.CurrentDomain.BaseDirectory + Constants.FilePaths.SocialMediaInformation);
                break;

            case "mtSharedContent":
                this.Text  = Constants.InformationSelectionScreen.SharedContentManagement;
                this.Style = MetroFramework.MetroColorStyle.Green;
                Display    = new DisplayMode(AppDomain.CurrentDomain.BaseDirectory + Constants.FilePaths.SharedInformation);
                break;

            case "mtOther":
                this.Text  = Constants.InformationSelectionScreen.OtherManagement;
                this.Style = MetroFramework.MetroColorStyle.Orange;
                Display    = new DisplayMode(AppDomain.CurrentDomain.BaseDirectory + Constants.FilePaths.OtherInformation);
                break;

            default:
                break;
            }

            this.Refresh();
            UserSessionData = new UserData(Display);
            if (UserSessionData.LoadOrCreateEncryptionKey())
            {
                if (UserSessionData.LoadData())
                {
                    PasswordManagement.SelectTab(InfoManagementTab);
                    BindDescriptionMenu();
                }
                else
                {
                    PasswordManagement.SelectTab(InfoAddTab);
                    notification = new DialogBox(Constants.InformationSelectionScreen.NoData, this.Style, this.DesktopLocation);
                    notification.Show();
                }
            }
            else
            {
                PasswordManagement.SelectTab(InfoAddTab);
                notification = new DialogBox(Constants.InformationSelectionScreen.FirstTimeUseMessage, this.Style, this.DesktopLocation);
                notification.Show();
            }
        }