using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using ImageContainer;


namespace Image_Viewer
{
    public partial class Form1 : Form
    {
        //private readonly string initialImageDirectory="C:\\Documents and Settings\\spannm\\Desktop\\Personal Stuff\\Images";
        private Image loadedImage = null;
        private ImageForm imageForm;

        public Form1()
        {
            InitializeComponent();
            //initialImageDirectory = openFileDialog1.InitialDirectory;
         }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Open image file dialog box and load an image
            openFileDialog1.ShowDialog();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Exit application

            Application.Exit();
        }

        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (imageForm != null)
                imageForm.Close();
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            string fileName = openFileDialog1.FileName;

            if (fileName.Length != 0)
            {
                // Display the loaded image
                loadedImage = Image.FromFile(fileName);
                imageForm = new ImageForm(loadedImage);
                imageForm.Show();
            }
        }
       
    }
}