示例#1
0
        /// <summary>
        /// The lv flight data context menu strip_ opening.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void lvFlightDataContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            var selFlight = this.SelectedFlight;
            this.mnuBookTrip.Available = this.CanBuy(selFlight);

            if (this.mnuBookTrip.Available)
            {
                this.mnuBookTrip.ToolTipText = selFlight.SummaryString;
            }

            if (this.OnContextMenuStripOpening != null)
            {
                var args = new MenuBuilderEventArgs(selFlight);
                this.OnContextMenuStripOpening(this, args);
                e.Cancel = args.Cancel;
            }
        }
示例#2
0
        /// <summary>
        /// The lv flight data_ on context menu strip opening.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void lvFlightData_OnContextMenuStripOpening(FlightDataListView sender, MenuBuilderEventArgs e)
        {
            this.mnuSeparator.Available = this.mnuCheckThisDate.Available = this.mnuViewThisDate.Available = false;
            var selFlight = sender.SelectedFlight;
            if (selFlight != null)
            {
                if (selFlight.OutboundLeg.Departure.Date >= DateTime.Now.Date)
                {
                    this.mnuCheckThisDate.Available = true;
                    this.mnuCheckThisDate.Text = string.Format("Check latest fare for [{0}]", selFlight.TravelDateString);
                }

                this.mnuSeparator.Available = this.mnuViewThisDate.Available = true;
                this.mnuViewThisDate.Text = string.Format("View only fare for [{0}]", selFlight.TravelDateString);
            }
        }