Beispiel #1
0
        /// <summary>
        /// moves to the next form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButton_Click(object sender, EventArgs e)
        {
            ProductInfoForm productInfoForm = new ProductInfoForm(this);

            productInfoForm.Show(this);
            this.Hide();
        }
        /// <summary>
        /// Read event, if the bin file is loaded without error moves onto
        /// the next form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenSavedOrderButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    MessageBox.Show(openFileDialog.FileName);
                    var ob = this.ReadFromBinaryFile <product>(openFileDialog.FileName);
                    Program.viewProduct = (product)ob; //attempt to cast, if it fails the file is either not one of mine, or incorrectly corrupt.

                    ProductInfoForm productinfoform = new ProductInfoForm(Program.viewProduct);
                    productinfoform.Show();
                    this.Dispose();
                }
                catch (Exception ex) { MessageBox.Show("File is not formatted or is corrupt!"); }
            }
        }
Beispiel #3
0
 /// <summary>
 /// default constructor, requires previous form.
 /// </summary>
 /// <param name="productinfoform"></param>
 public OrderForm(ProductInfoForm productinfoform)
 {
     this._previousForm = productinfoform;
     InitializeComponent();
 }