// frmSplash.cs
// Copyright (C) 2008 Karel Jordaan karel_jordaan@yahoo.com.au
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System;
using System.ComponentModel;
using System.Threading;
using System.Windows.Forms;

#region Copyright and Licensing Information

/*
Copyright (C) 2002, 2003 Clint Heyer.
This file is part of Naanou.

Naanou is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Naanou is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Naanou; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#endregion

namespace ZANZIClient
{
    public class frmSplash : Form
    {
        private readonly clsStartupManager main;
        private Container components;
        private Label lblProgress;

        /// <summary>
        /// Splash screen
        /// </summary>
        public frmSplash(clsStartupManager main)
        {
            this.main = main;
            InitializeComponent();
        }

        public void SetProgress(string msg)
        {
            lblProgress.Text = msg;
        }

        public new void Show()
        {
            base.Show();
            Application.DoEvents();
            while (Visible)
            {
                Application.DoEvents();
                Thread.Sleep(1000);
            }
        }

        private void frmSplash_Load(object sender, EventArgs e)
        {
        }

        private void Abort()
        {
            //main.WindowState = FormWindowState.Normal;
            main.SetSplashOff();
        }

        private void frmSplash_Click(object sender, EventArgs e)
        {
            Abort();
        }

        private void lblProgress_Clickl(object sender, EventArgs e)
        {
            Abort();
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof (frmSplash));
            this.lblProgress = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // lblProgress
            // 
            this.lblProgress.AccessibleDescription = resources.GetString("lblProgress.AccessibleDescription");
            this.lblProgress.AccessibleName = resources.GetString("lblProgress.AccessibleName");
            this.lblProgress.Anchor = ((System.Windows.Forms.AnchorStyles) (resources.GetObject("lblProgress.Anchor")));
            this.lblProgress.AutoSize = ((bool) (resources.GetObject("lblProgress.AutoSize")));
            this.lblProgress.BackColor = System.Drawing.Color.FromArgb(((System.Byte) (112)), ((System.Byte) (128)),
                                                                       ((System.Byte) (144)));
            this.lblProgress.Dock = ((System.Windows.Forms.DockStyle) (resources.GetObject("lblProgress.Dock")));
            this.lblProgress.Enabled = ((bool) (resources.GetObject("lblProgress.Enabled")));
            this.lblProgress.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.lblProgress.Font = ((System.Drawing.Font) (resources.GetObject("lblProgress.Font")));
            this.lblProgress.ForeColor = System.Drawing.Color.Beige;
            this.lblProgress.Image = ((System.Drawing.Image) (resources.GetObject("lblProgress.Image")));
            this.lblProgress.ImageAlign =
                ((System.Drawing.ContentAlignment) (resources.GetObject("lblProgress.ImageAlign")));
            this.lblProgress.ImageIndex = ((int) (resources.GetObject("lblProgress.ImageIndex")));
            this.lblProgress.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("lblProgress.ImeMode")));
            this.lblProgress.Location = ((System.Drawing.Point) (resources.GetObject("lblProgress.Location")));
            this.lblProgress.Name = "lblProgress";
            this.lblProgress.RightToLeft =
                ((System.Windows.Forms.RightToLeft) (resources.GetObject("lblProgress.RightToLeft")));
            this.lblProgress.Size = ((System.Drawing.Size) (resources.GetObject("lblProgress.Size")));
            this.lblProgress.TabIndex = ((int) (resources.GetObject("lblProgress.TabIndex")));
            this.lblProgress.Text = resources.GetString("lblProgress.Text");
            this.lblProgress.TextAlign =
                ((System.Drawing.ContentAlignment) (resources.GetObject("lblProgress.TextAlign")));
            this.lblProgress.Visible = ((bool) (resources.GetObject("lblProgress.Visible")));
            this.lblProgress.Click += new System.EventHandler(this.lblProgress_Clickl);
            // 
            // frmSplash
            // 
            this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
            this.AccessibleName = resources.GetString("$this.AccessibleName");
            this.AutoScaleBaseSize = ((System.Drawing.Size) (resources.GetObject("$this.AutoScaleBaseSize")));
            this.AutoScroll = ((bool) (resources.GetObject("$this.AutoScroll")));
            this.AutoScrollMargin = ((System.Drawing.Size) (resources.GetObject("$this.AutoScrollMargin")));
            this.AutoScrollMinSize = ((System.Drawing.Size) (resources.GetObject("$this.AutoScrollMinSize")));
            this.BackColor = System.Drawing.Color.LightSlateGray;
            this.BackgroundImage = ((System.Drawing.Image) (resources.GetObject("$this.BackgroundImage")));
            this.ClientSize = ((System.Drawing.Size) (resources.GetObject("$this.ClientSize")));
            this.Controls.Add(this.lblProgress);
            this.Enabled = ((bool) (resources.GetObject("$this.Enabled")));
            this.Font = ((System.Drawing.Font) (resources.GetObject("$this.Font")));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
            this.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("$this.ImeMode")));
            this.Location = ((System.Drawing.Point) (resources.GetObject("$this.Location")));
            this.MaximizeBox = false;
            this.MaximumSize = ((System.Drawing.Size) (resources.GetObject("$this.MaximumSize")));
            this.MinimizeBox = false;
            this.MinimumSize = ((System.Drawing.Size) (resources.GetObject("$this.MinimumSize")));
            this.Name = "frmSplash";
            this.Opacity = 0.800000011920929;
            this.RightToLeft = ((System.Windows.Forms.RightToLeft) (resources.GetObject("$this.RightToLeft")));
            this.ShowInTaskbar = false;
            this.StartPosition = ((System.Windows.Forms.FormStartPosition) (resources.GetObject("$this.StartPosition")));
            this.Text = resources.GetString("$this.Text");
            this.Click += new System.EventHandler(this.frmSplash_Click);
            this.Load += new System.EventHandler(this.frmSplash_Load);
            this.ResumeLayout(false);
        }

        #endregion
    }
}

//using System;
//using System.Drawing;
//using System.Collections;
//using System.ComponentModel;
//using System.Windows.Forms;
//
//namespace ZANZIClient
//{
//	/// <summary>
//	/// Summary description for frmSplash.
//	/// </summary>
//	public class frmSplash : System.Windows.Forms.Form
//	{
//
//		#region Variable declaration
//
//		private System.Windows.Forms.PictureBox picSplash;
//		/// <summary>
//		/// Required designer variable.
//		/// </summary>
//		private System.ComponentModel.Container components = null;
//
//		public frmSplash()
//		{
//			//
//			// Required for Windows Form Designer support
//			//
//			InitializeComponent();
//
//			//
//			// TODO: Add any constructor code after InitializeComponent call
//			//
//
//			
//		}
//#endregion
//
//		#region Functions
//
//		/// <summary>
//		/// Clean up any resources being used.
//		/// </summary>
//		protected override void Dispose( bool disposing )
//		{
//			if( disposing )
//			{
//				if(components != null)
//				{
//					components.Dispose();
//				}
//			}
//			base.Dispose( disposing );
//		}
//#endregion
//
//		#region Windows Form Designer generated code
//		/// <summary>
//		/// Required method for Designer support - do not modify
//		/// the contents of this method with the code editor.
//		/// </summary>
//		private void InitializeComponent()
//		{
//			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmSplash));
//			this.picSplash = new System.Windows.Forms.PictureBox();
//			this.SuspendLayout();
//			// 
//			// picSplash
//			// 
//			this.picSplash.AccessibleDescription = resources.GetString("picSplash.AccessibleDescription");
//			this.picSplash.AccessibleName = resources.GetString("picSplash.AccessibleName");
//			this.picSplash.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("picSplash.Anchor")));
//			this.picSplash.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("picSplash.BackgroundImage")));
//			this.picSplash.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
//			this.picSplash.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("picSplash.Dock")));
//			this.picSplash.Enabled = ((bool)(resources.GetObject("picSplash.Enabled")));
//			this.picSplash.Font = ((System.Drawing.Font)(resources.GetObject("picSplash.Font")));
//			this.picSplash.Image = ((System.Drawing.Image)(resources.GetObject("picSplash.Image")));
//			this.picSplash.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("picSplash.ImeMode")));
//			this.picSplash.Location = ((System.Drawing.Point)(resources.GetObject("picSplash.Location")));
//			this.picSplash.Name = "picSplash";
//			this.picSplash.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("picSplash.RightToLeft")));
//			this.picSplash.Size = ((System.Drawing.Size)(resources.GetObject("picSplash.Size")));
//			this.picSplash.SizeMode = ((System.Windows.Forms.PictureBoxSizeMode)(resources.GetObject("picSplash.SizeMode")));
//			this.picSplash.TabIndex = ((int)(resources.GetObject("picSplash.TabIndex")));
//			this.picSplash.TabStop = false;
//			this.picSplash.Text = resources.GetString("picSplash.Text");
//			this.picSplash.Visible = ((bool)(resources.GetObject("picSplash.Visible")));
//			// 
//			// frmSplash
//			// 
//			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
//			this.AccessibleName = resources.GetString("$this.AccessibleName");
//			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
//			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
//			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
//			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
//			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
//			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
//			this.Controls.Add(this.picSplash);
//			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
//			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
//			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
//			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
//			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
//			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
//			this.MaximizeBox = false;
//			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
//			this.MinimizeBox = false;
//			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
//			this.Name = "frmSplash";
//			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
//			this.ShowInTaskbar = false;
//			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
//			this.Text = resources.GetString("$this.Text");
//			this.TopMost = true;
//			this.ResumeLayout(false);
//
//		}
//		#endregion
//	}
//}