Ejemplo n.º 1
0
 public OrderGridView(Order document)
     : this()
 {
     // Store a reference to the document, attach the event handler,
     // and refresh the display.
     Document = document;
 }
Ejemplo n.º 2
0
		private void cmdOpen(object sender, EventArgs e)
		{
			OpenFileDialog dlgOpen = new OpenFileDialog();
			dlgOpen.InitialDirectory = lastDir;
			dlgOpen.Filter = "Order Files (*.ord)|*.ord";

			// Show the open dialog.
			if (dlgOpen.ShowDialog() == DialogResult.OK)
			{
				Order doc = new Order();

				try
				{
					doc.Open(dlgOpen.FileName);
				}
				catch (Exception err)
				{
					// All exceptions bubble up to this level.
					MessageBox.Show(err.ToString());
					return;
				}

				// Create the child form for the selected file.
				Child frmChild = new Child(doc, Child.ViewType.ItemGrid);
				frmChild.MdiParent = this;
				frmChild.Show();
			}
		}
Ejemplo n.º 3
0
		public void Open()
		{
			OpenFileDialog dlgOpen = new OpenFileDialog();
			dlgOpen.InitialDirectory = lastDir;
			dlgOpen.Filter = "Order Files (*.ord)|*.ord";

			// Show the open dialog.
			if (dlgOpen.ShowDialog() == DialogResult.OK)
			{
				Order doc = new Order();

				try
				{
					doc.Open(dlgOpen.FileName);
				}
				catch (Exception err)
				{
					// All exceptions bubble up to this level.
					MessageBox.Show(err.ToString());
					return;
				}

				// Create the child form for the selected file.
				Child frmChild = new Child(doc, Child.ViewType.ItemGrid);
                Program.DocumentManager.AddForm(frmChild);
				frmChild.Show();
			}
		}
Ejemplo n.º 4
0
		public Child(Order doc, ViewType viewType)
			: this()
		{
			// Configure the title.
			this.Text = doc.LastFileName;
			this.Document = doc;

			// Create a reference for the view.
			// This reference can accomodate any type of control.
			Control view = null;

			// Instantiate the appropriate view.
			switch (viewType)
			{
				case ViewType.ItemGrid:
					view = new OrderGridView(doc);
					break;
				case ViewType.PrintPreview:
					view = new OrderPrintPreview(doc);
					break;
			}

			// Add the view to the form.
			view.Dock = DockStyle.Fill;
			this.Controls.Add(view);
		}
Ejemplo n.º 5
0
		public OrderPrintPreview(Order document)
			: this()
		{
			// Store a reference to the document, attach the document event handlers,
			// and refresh the display.
			Document = document;

		}
Ejemplo n.º 6
0
		private void cmdNew(object sender, EventArgs e)
		{
			// Create a new order.
			Order doc = new Order();
			Child frmChild = new Child(doc, Child.ViewType.ItemGrid);
			frmChild.MdiParent = this;
			frmChild.Show();
		}
Ejemplo n.º 7
0
		public void New()
		{
			// Create a new order.
			Order doc = new Order();
			Child frmChild = new Child(doc, Child.ViewType.ItemGrid);
			Program.DocumentManager.AddForm(frmChild);
			frmChild.Show();
		}
Ejemplo n.º 8
0
		public Child(Order doc, ViewType viewType)		
		{
            InitializeComponent();
            
            toolStrip1.Items[0].Image = imgButtons.Images[0];
            toolStrip1.Items[1].Image = imgButtons.Images[1];
            toolStrip1.Items[2].Image = imgButtons.Images[2];
            toolStrip1.Items[3].Image = imgButtons.Images[3];
            toolStrip1.Items[5].Image = imgButtons.Images[4];            

            // Set up window list.
            Program.DocumentManager.WindowListChanged +=
                new EventHandler<WindowListChangedEventArgs>(WindowListChanged);

			// Configure the title.
			this.Text = doc.LastFileName;
			this.Document = doc;

			// Create a reference for the view.
			// This reference can accomodate any type of control.
			Control view = null;

			// Instantiate the appropriate view.
			switch (viewType)
			{
				case ViewType.ItemGrid:
					view = new OrderGridView(doc);
					break;
				case ViewType.PrintPreview:
					view = new OrderPrintPreview(doc);
					this.Text += " (Preview)";
                    toolStrip1.Visible = false;
                    menuStrip1.Visible = false;
					break;
			}

		    // Add the view to the form.
			view.Dock = DockStyle.Fill;
            
			this.Controls.Add(view);
            view.BringToFront();
		}