Click here to Skip to main content
15,885,244 members
Articles / Mobile Apps

Windows Mobile Password Safe

Rate me:
Please Sign up or sign in to vote.
4.87/5 (58 votes)
12 Jan 2009CPOL16 min read 159.4K   3.1K   139  
A password safe with a touch screen UI introducing Fluid Controls.
using System;

using System.Collections.Generic;
using System.Text;
using Fluid.Controls;
using System.Drawing;
using PasswordSafe.Classes;

namespace PasswordSafe
{
    public class WelcomeScreen:FluidPanel
    {
        protected override void InitControl()
        {
            base.InitControl();
            Bounds = new Rectangle(0,0,240,300);
            BackColor = Color.LightSteelBlue;
            this.GradientFill = true;
            GradientFillOffset = 30;
            ForeColor = Color.White;

            FluidLabel h1 = new FluidLabel("Welcome", 0, 0, 240, 40);
            h1.ShadowColor = Color.Black;
            h1.ForeColor = Color.White;
            h1.Alignment = StringAlignment.Center;
            h1.LineAlignment = StringAlignment.Center;
            h1.Font = new Font(FontFamily.GenericSansSerif,12f,FontStyle.Bold);
            h1.Anchor = AnchorTLR;
            Controls.Add(h1);

            string infoText = "This is the first time you started PasswordSafe and an empty database named passwords.pws is automatically" +
                " generated in the 'MyDevice' folder of your Windows Mobile.\n\n" +
                "As next step, in the Login Screen, you need to give your database a password by tapping the 'Change Password' button.\n" +
                "Notice that your current password is empty.\n\n" +
                "You should backup your database from time to time. If you remove your password.xml, this welcome screen comes again " +
                "to create a new database.\n\n" +
                "If you don't choose a password, your database is readable as xml file.\n";

            FluidLabel infoLabel = new FluidLabel(infoText, 3, 40, 240-6, 220);
            infoLabel.ForeColor = Color.Black;
            infoLabel.Font = new Font(FontFamily.GenericSansSerif, 8f, FontStyle.Regular);
            infoLabel.Alignment = StringAlignment.Near;
            infoLabel.LineAlignment = StringAlignment.Near;
            infoLabel.Format.FormatFlags = 0;
            infoLabel.Anchor = AnchorTLR;
            Controls.Add(infoLabel);

            FluidButton okBtn = new FluidButton("Start", 70, 300 - 40, 100, 32);
            this.okBtn = okBtn;
            okBtn.BackColor = Color.LightSlateGray;           
            okBtn.Click += new EventHandler(okBtn_Click);
            okBtn.ForeColor = Color.White;
            okBtn.Anchor = AnchorBL;
            Controls.Add(okBtn);

        }

        void okBtn_Click(object sender, EventArgs e)
        {
           
            DataReader.CreateDatabase();
            Close();
            if (Continue != null) Continue(this, e);
        }

        private FluidButton okBtn = new FluidButton();

        protected override void OnSizeChanged(Size oldSize, Size newSize)
        {
            base.OnSizeChanged(oldSize, newSize);
            int w = this.Width;
            okBtn.Left = (w - okBtn.Width) / 2;
        }

        public event EventHandler Continue;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Germany Germany
MCPD
Enterprise Application Developer 3.5
Windows Developer 3.5
.ASP.NET Developer 3.5
.NET 2.0 Windows Developer
.NET 2.0 Web Developer
.NET 2.0 Enterprise Application Developer


MCTS
.NET 3.5 Windows Forms Applications
.NET 3.5 ASP.NET Applications
.NET 3.5, ADO.NET Application Development
.NET 3.5 WCF
.NET 3.5 WPF
.NET 3.5 WF
Microsoft SQL Server 2008, Database Development
.NET 2.0 Windows Applications
.NET 2.0 Web Applications
.NET 2.0 Distributed Applications
SQL Server 2005
Sharepoint Services 3.0 Application Development
Windows Vista Client Configuration

Comments and Discussions