コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: JoaCed/Bookstore
        private void ButtonPlaceOrder_Click(object sender, RoutedEventArgs e)
        {
            WindowOrder OrderDlg = new WindowOrder();

            OrderDlg.Owner = this;
            // Copy to order list and calculate missing in stock
            foreach (BookSelected BS in _SelectedBooks)
            {
                BookOrder BO = new BookOrder();
                int       Missing;

                BO.Title    = BS.Title;
                BO.Author   = BS.Author;
                BO.Price    = BS.Price;
                BO.Quantity = BS.Quantity;
                Missing     = (int)BS.Quantity - BookInStock(BS.Title, BS.Author);
                BO.Missing  = Missing > 0?Missing:0;
                OrderDlg.SelectedBooks.Add(BO);
            }
            if (OrderDlg.ShowDialog() == true)
            {
                // If users clicked OK clear list
                _SelectedBooks.Clear();
                ButtonPlaceOrder.IsEnabled = false;
            }
            UpdateTotalPrice();
        }
コード例 #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.window = ((BookstoreClient.WindowOrder)(target));

            #line 8 "..\..\WindowOrder.xaml"
                this.window.Loaded += new System.Windows.RoutedEventHandler(this.window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.LabelTotalPrice = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.ButtonOK = ((System.Windows.Controls.Button)(target));

            #line 46 "..\..\WindowOrder.xaml"
                this.ButtonOK.Click += new System.Windows.RoutedEventHandler(this.ButtonOK_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.ButtonCancel = ((System.Windows.Controls.Button)(target));

            #line 47 "..\..\WindowOrder.xaml"
                this.ButtonCancel.Click += new System.Windows.RoutedEventHandler(this.ButtonCancel_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }