productssummaryviewdialog.cs

来自「Microsoft Mobile Development Handbook的代码」· CS 代码 · 共 82 行

CS
82
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MobileDevelopersHandbook.DSAExample
{
    public partial class ProductsSummaryViewDialog : Form
    {
        public ProductsSummaryViewDialog()
        {
            InitializeComponent();
            // Attach event handlers to auto-hide controls.
            this.AttachVisibilityBindings(this.Controls);
        }

        private void editMenuItemMenuItem_Click(object sender, EventArgs e)
        {
            MobileDevelopersHandbook.DSAExample.ProductsEditViewDialog productsEditViewDialog = MobileDevelopersHandbook.DSAExample.ProductsEditViewDialog.Instance(this.productsBindingSource);
            productsEditViewDialog.ShowDialog();
            this.Close();

        }

        private void ProductsSummaryViewDialog_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                this.AutoScrollPosition = new System.Drawing.Point(0, ((0 - this.AutoScrollPosition.Y)
                                - 16));
                e.Handled = true;
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                this.AutoScrollPosition = new System.Drawing.Point(0, ((0 - this.AutoScrollPosition.Y)
                                + 16));
                e.Handled = true;
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
            }

        }

        private void orderMenuItem_Click(object sender, EventArgs e)
        {
            OrdersResultSetResultSets.OrdersResultSet ordResultSet = new OrdersResultSetResultSets.OrdersResultSet();
            using (ordResultSet)
            {
                ordResultSet.AddOrdersRecord(0, Int32.Parse(this.productIdLabel1.Text), 1);

                OrderProductDialog dlg = new OrderProductDialog(ordResultSet);
                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    // Delete the record we just added
                    ordResultSet.ReadLast();
                    ordResultSet.DeleteRecord();
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?