コード例 #1
0
 //returns the value for a statistics type for a route class
 public int getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type)
 {
     if (this.Stats.ContainsKey(aClass) && this.Stats[aClass].ContainsKey(type))
         return this.Stats[aClass][type];
     else
         return 0;
 }
コード例 #2
0
        //adds the value for a statistics type to a route class
        public void addStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
        {
            RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass == aClass);

             if (item == null)
                 this.Stats.Add(new RouteStatisticsItem(aClass, type, value));
             else
                 item.Value += value;
        }
コード例 #3
0
 //adds the value for a statistics type to a route class
 public void addStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
 {
     lock (this.Stats)
     {
         if (!this.Stats.ContainsKey(aClass))
             this.Stats.Add(aClass, new Dictionary<StatisticsType, int>());
         if (!this.Stats[aClass].ContainsKey(type))
             this.Stats[aClass].Add(type, 0);
         this.Stats[aClass][type] += value;
     }
 }
コード例 #4
0
 //returns the value for a statistics type for a route class
 public int getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type)
 {
     if (this.Stats.ContainsKey(aClass) && this.Stats[aClass].ContainsKey(type))
     {
         return(this.Stats[aClass][type]);
     }
     else
     {
         return(0);
     }
 }
コード例 #5
0
        public PassengerRoute(string id, Airport destination1, Airport destination2, DateTime startDate, double farePrice) : base(RouteType.Passenger, id, destination1, destination2, startDate)
        {
            this.Classes = new List <RouteAirlinerClass>();

            foreach (AirlinerClass.ClassType ctype in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                RouteAirlinerClass cl = new RouteAirlinerClass(ctype, RouteAirlinerClass.SeatingType.Reserved_Seating, farePrice);

                this.Classes.Add(cl);
            }
        }
コード例 #6
0
        public PassengerRoute(string id, Airport destination1, Airport destination2,double farePrice)
            : base(RouteType.Passenger,id,destination1,destination2)
        {
            this.Classes = new List<RouteAirlinerClass>();

            foreach (AirlinerClass.ClassType ctype in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                RouteAirlinerClass cl = new RouteAirlinerClass(ctype, RouteAirlinerClass.SeatingType.Reserved_Seating, farePrice);

                this.Classes.Add(cl);
            }
        }
コード例 #7
0
ファイル: RouteStatistics.cs プロジェクト: petfol/tap-desktop
        //sets the value for a statistics type to a route class
        public void setStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
        {
            RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass == aClass);

            if (item == null)
            {
                this.Stats.Add(new RouteStatisticsItem(aClass, type, value));
            }
            else
            {
                item.Value = value;
            }
        }
コード例 #8
0
ファイル: RouteStatistics.cs プロジェクト: petfol/tap-desktop
        //returns the value for a statistics type for a route class
        public long getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type)
        {
            RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass.Type == aClass.Type);

            if (item == null)
            {
                return(0);
            }
            else
            {
                return(item.Value);
            }
        }
コード例 #9
0
 //adds the value for a statistics type to a route class
 public void addStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
 {
     lock (this.Stats)
     {
         if (!this.Stats.ContainsKey(aClass))
         {
             this.Stats.Add(aClass, new Dictionary <StatisticsType, int>());
         }
         if (!this.Stats[aClass].ContainsKey(type))
         {
             this.Stats[aClass].Add(type, 0);
         }
         this.Stats[aClass][type] += value;
     }
 }
コード例 #10
0
 //sets the value for a statistics type to a route class
 public void setStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
 {
     if (!this.Stats.ContainsKey(aClass))
     {
         this.Stats.Add(aClass, new Dictionary <StatisticsType, int>());
     }
     if (!this.Stats[aClass].ContainsKey(type))
     {
         this.Stats[aClass].Add(type, value);
     }
     else
     {
         this.Stats[aClass][type] = value;
     }
 }
コード例 #11
0
        //public int CabinCrew { get; set; }
        public MVVMRouteClass(AirlinerClass.ClassType type, RouteAirlinerClass.SeatingType seating, double fareprice)
        {
            this.Type = type;
            this.Seating = seating;
            this.FarePrice = 10;

            this.Facilities = new List<MVVMRouteFacility>();

            foreach (RouteFacility.FacilityType facType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
            {
                if (GameObject.GetInstance().GameTime.Year >= (int)facType)
                {

                    MVVMRouteFacility facility = new MVVMRouteFacility(facType);

                    foreach (RouteFacility fac in RouteFacilities.GetFacilities(facType))
                        facility.Facilities.Add(fac);

                    this.Facilities.Add(facility);
                }
            }
        }
コード例 #12
0
 //adds a route airliner class to the route
 public void addRouteAirlinerClass(RouteAirlinerClass aClass)
 {
     this.Classes.Add(aClass);
 }
コード例 #13
0
        //loads a route
        private static Route LoadRoute(XmlElement routeNode, Airline airline, Route.RouteType routetype = Route.RouteType.Passenger)
        {
            string id = routeNode.Attributes["id"].Value;
            Airport dest1 = Airports.GetAirport(routeNode.Attributes["destination1"].Value);
            Airport dest2 = Airports.GetAirport(routeNode.Attributes["destination2"].Value);
            Boolean isBanned = Convert.ToBoolean(routeNode.Attributes["isbanned"].Value);

            if (routeNode.HasAttribute("type"))
                routetype = (Route.RouteType)Enum.Parse(typeof(Route.RouteType), routeNode.Attributes["type"].Value);

            Route route;

            if (routetype == Route.RouteType.Passenger || routetype == Route.RouteType.Mixed)
                route = new PassengerRoute(id, dest1, dest2, DateTime.Now,0);
            else
                route = new CargoRoute(id, dest1, dest2, DateTime.Now,0);

            route.Banned = isBanned;

            /* foreach (StopoverRoute stopover in route.Stopovers)
            {
                XmlElement routeStopoverNode = xmlDoc.CreateElement("stopover");
                routeStopoverNode.SetAttribute("airport", stopover.Stopover.Profile.ID);

                XmlElement stopoverLegsNode = xmlDoc.CreateElement("legs");
                foreach (Route leg in stopover.Legs)
                {
                    XmlElement stopoverLegNode = xmlDoc.CreateElement("leg");

                    stopoverLegNode.AppendChild(SaveRoute(xmlDoc, leg));

                    stopoverLegsNode.AppendChild(stopoverLegNode);
                }
                routeStopoverNode.AppendChild(stopoverLegsNode);
                routeStopoversNode.AppendChild(routeStopoverNode);*/

            XmlNodeList routeStopoverList = routeNode.SelectNodes("stopovers/stopover");

            foreach (XmlElement routeStopoverNode in routeStopoverList)
            {
                Airport stopoverAirport = Airports.GetAirportFromID(routeStopoverNode.Attributes["airport"].Value);

                StopoverRoute stopoverRoute = new StopoverRoute(stopoverAirport);

                XmlNodeList legsList = routeStopoverNode.SelectNodes("legs/leg");

                foreach (XmlElement legNode in legsList)
                {

                    stopoverRoute.addLeg(LoadRoute((XmlElement)legNode.SelectSingleNode("route"), airline, routetype));
                }

                route.addStopover(stopoverRoute);

            }

            if (routetype == Route.RouteType.Passenger || routetype == Route.RouteType.Mixed)
            {
                ((PassengerRoute)route).Classes.Clear();

                XmlNodeList routeClassList = routeNode.SelectNodes("routeclasses/routeclass");

                foreach (XmlElement routeClassNode in routeClassList)
                {
                    AirlinerClass.ClassType airlinerClassType = (AirlinerClass.ClassType)Enum.Parse(typeof(AirlinerClass.ClassType), routeClassNode.Attributes["type"].Value);
                    double fareprice = Convert.ToDouble(routeClassNode.Attributes["fareprice"].Value,new CultureInfo("de-DE", false));
                    RouteAirlinerClass.SeatingType seatingType = (RouteAirlinerClass.SeatingType)Enum.Parse(typeof(RouteAirlinerClass.SeatingType), routeClassNode.Attributes["seating"].Value);

                    RouteAirlinerClass rClass = new RouteAirlinerClass(airlinerClassType, RouteAirlinerClass.SeatingType.Reserved_Seating, fareprice);
                    rClass.Seating = seatingType;

                    foreach (RouteFacility.FacilityType ftype in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (routeClassNode.HasAttribute(ftype.ToString()))
                        {
                            RouteFacility facility = RouteFacilities.GetFacility(routeClassNode.Attributes[ftype.ToString()].Value);
                            rClass.addFacility(facility);
                        }
                    }

                    ((PassengerRoute)route).addRouteAirlinerClass(rClass);

                }
            }
            if (routetype == Route.RouteType.Mixed || routetype == Route.RouteType.Cargo)
            {
                XmlElement routeCargoNode = (XmlElement)routeNode.SelectSingleNode("cargo");
                double unitPrice = Convert.ToDouble(routeCargoNode.Attributes["priceperunit"].Value,new CultureInfo("de-DE", false));

                ((CargoRoute)route).PricePerUnit = unitPrice;

            }

            RouteTimeTable timeTable = new RouteTimeTable(route);

            XmlNodeList timetableList = routeNode.SelectNodes("timetable/timetableentry");

            foreach (XmlElement entryNode in timetableList)
            {
                Airport entryDest = Airports.GetAirport(entryNode.Attributes["destination"].Value);
                string flightCode = entryNode.Attributes["flightcode"].Value;
                DayOfWeek day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), entryNode.Attributes["day"].Value);
                TimeSpan time = TimeSpan.Parse(entryNode.Attributes["time"].Value);
                FleetAirliner airliner = entryNode.Attributes["airliner"].Value == "-" ? null : airline.Fleet.Find(a => a.Airliner.ID == entryNode.Attributes["airliner"].Value); ;

                RouteTimeTableEntry entry = new RouteTimeTableEntry(timeTable, day, time, new RouteEntryDestination(entryDest, flightCode,null),null);

                if (entryNode.HasAttribute("id"))
                    entry.ID = entryNode.Attributes["id"].Value;

                if (entryNode.HasAttribute("mainentry")) entry.MainEntry = airline.Routes.SelectMany(r => r.TimeTable.Entries).ToList().Find(e => e.ID == entryNode.Attributes["mainentry"].Value);

                entry.Airliner = airliner;

                if (airliner != null && !airliner.Routes.Contains(route))
                    airliner.Routes.Add(route);

                timeTable.addEntry(entry);
            }
            route.TimeTable = timeTable;

            XmlNodeList routeInvoiceList = routeNode.SelectNodes("invoices/invoice");

            foreach (XmlElement routeInvoiceNode in routeInvoiceList)
            {
                Invoice.InvoiceType type = (Invoice.InvoiceType)Enum.Parse(typeof(Invoice.InvoiceType), routeInvoiceNode.Attributes["type"].Value);
                int invoiceYear = Convert.ToInt16(routeInvoiceNode.Attributes["year"].Value);
                int invoiceMonth = Convert.ToInt16(routeInvoiceNode.Attributes["month"].Value);
                double invoiceAmount = Convert.ToDouble(routeInvoiceNode.Attributes["amount"].Value, new CultureInfo("de-DE", false));

                route.setRouteInvoice(type, invoiceYear, invoiceMonth, invoiceAmount);
            }

            return route;
        }
コード例 #14
0
        //creates the panel for a new route
        private void createRoutePanel()
        {
            panelRouteInfo.Children.Clear();

            ListBox lbRouteInfo = new ListBox();
            lbRouteInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbRouteInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            panelRouteInfo.Children.Add(lbRouteInfo);

            WrapPanel panelDestination1 = new WrapPanel();

            cbDestination1 = createDestinationComboBox();
            panelDestination1.Children.Add(cbDestination1);

            txtDestination1Gates = new TextBlock();
            txtDestination1Gates.Margin = new Thickness(5, 0, 0, 0);
            txtDestination1Gates.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            panelDestination1.Children.Add(txtDestination1Gates);

            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "202"), panelDestination1));

            WrapPanel panelDestination2 = new WrapPanel();

            cbDestination2 = createDestinationComboBox();
            panelDestination2.Children.Add(cbDestination2);

            txtDestination2Gates = new TextBlock();
            txtDestination2Gates.Margin = new Thickness(5, 0, 0, 0);
            txtDestination2Gates.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            panelDestination2.Children.Add(txtDestination2Gates);

            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "203"), panelDestination2));

            ucStopover1 = new ucStopover();
            ucStopover1.ValueChanged += ucStopover_OnValueChanged;
            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "1003"), ucStopover1));

            ucStopover2 = new ucStopover();
            ucStopover2.ValueChanged += ucStopover_OnValueChanged;
            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "1003"), ucStopover2));

            txtRoute = UICreator.CreateTextBlock("");
            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "1004"), txtRoute));

            txtDistance = UICreator.CreateTextBlock("-");
            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "204"), txtDistance));
            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "205"), UICreator.CreateTextBlock(string.Format("{0:0} {1}", new NumberToUnitConverter().Convert(this.MaxDistance), new StringToLanguageConverter().Convert("km.")))));

            if (this.RouteType == Route.RouteType.Mixed || this.RouteType == Route.RouteType.Passenger)
            {
                this.Classes.Clear();
                foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
                {

                    RouteAirlinerClass rClass = new RouteAirlinerClass(type, RouteAirlinerClass.SeatingType.Reserved_Seating, 1);

                    foreach (RouteFacility.FacilityType ftype in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (GameObject.GetInstance().GameTime.Year >= (int)ftype)
                            rClass.addFacility(RouteFacilities.GetBasicFacility(ftype));
                    }

                    this.Classes.Add(type, rClass);

                    WrapPanel panelClassButtons = new WrapPanel();

                    Button btnEdit = new Button();
                    btnEdit.Background = Brushes.Transparent;
                    btnEdit.Tag = type;
                    btnEdit.Click += new RoutedEventHandler(btnEdit_Click);

                    Image imgEdit = new Image();
                    imgEdit.Width = 16;
                    imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute));
                    RenderOptions.SetBitmapScalingMode(imgEdit, BitmapScalingMode.HighQuality);

                    btnEdit.Content = imgEdit;

                    panelClassButtons.Children.Add(btnEdit);

                    Image imgInfo = new Image();
                    imgInfo.Width = 16;
                    imgInfo.Source = new BitmapImage(new Uri(@"/Data/images/info.png", UriKind.RelativeOrAbsolute));
                    imgInfo.Margin = new Thickness(5, 0, 0, 0);
                    imgInfo.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                    RenderOptions.SetBitmapScalingMode(imgInfo, BitmapScalingMode.HighQuality);

                    Border brdToolTip = new Border();
                    brdToolTip.Margin = new Thickness(-4, 0, -4, -3);
                    brdToolTip.Padding = new Thickness(5);
                    brdToolTip.SetResourceReference(Border.BackgroundProperty, "HeaderBackgroundBrush2");

                    ContentControl lblClass = new ContentControl();
                    lblClass.SetResourceReference(ContentControl.ContentTemplateProperty, "RouteAirlinerClassItem");
                    lblClass.Content = rClass;

                    brdToolTip.Child = lblClass;

                    imgInfo.ToolTip = brdToolTip;

                    panelClassButtons.Children.Add(imgInfo);

                    lbRouteInfo.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(type, null, null, null).ToString(), panelClassButtons));
                }

            }
            if (this.RouteType == Route.RouteType.Mixed || this.RouteType == Route.RouteType.Cargo)
            {
                WrapPanel panelCargo = new WrapPanel();

                txtCargo = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.CargoPrice).ToString());
                txtCargo.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                panelCargo.Children.Add(txtCargo);

                Button btnEditCargo = new Button();
                btnEditCargo.Margin = new Thickness(5, 0, 0, 0);
                btnEditCargo.Background = Brushes.Transparent;
                btnEditCargo.Click += new RoutedEventHandler(btnEditCargo_Click);

                Image imgEdit = new Image();
                imgEdit.Width = 16;
                imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute));
                RenderOptions.SetBitmapScalingMode(imgEdit, BitmapScalingMode.HighQuality);

                btnEditCargo.Content = imgEdit;

                panelCargo.Children.Add(btnEditCargo);

                lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelNewRoute", "1007"), panelCargo));
            }

            txtInvalidRoute = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PanelNewRoute", "1001"));
            txtInvalidRoute.Foreground = Brushes.DarkRed;
            txtInvalidRoute.Visibility = System.Windows.Visibility.Collapsed;
            panelRouteInfo.Children.Add(txtInvalidRoute);

            WrapPanel panelButtons = new WrapPanel();
            panelButtons.Margin = new Thickness(0, 5, 0, 0);
            panelRouteInfo.Children.Add(panelButtons);

            btnSave = new Button();
            btnSave.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnSave.Height = Double.NaN;
            btnSave.Width = Double.NaN;
            btnSave.Content = Translator.GetInstance().GetString("General", "113");
            btnSave.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnSave.Click += new RoutedEventHandler(btnSave_Click);
            btnSave.IsEnabled = false;
            panelButtons.Children.Add(btnSave);

            btnLoad = new Button();
            btnLoad.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnLoad.Height = Double.NaN;
            btnLoad.Width = Double.NaN;
            btnLoad.Content = Translator.GetInstance().GetString("General", "115");
            btnLoad.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnLoad.IsEnabled = false;
            btnLoad.Click += new RoutedEventHandler(btnLoad_Click);
            btnLoad.Margin = new Thickness(5, 0, 0, 0);
            btnLoad.Visibility = this.RouteType == Route.RouteType.Cargo ? Visibility.Collapsed : Visibility.Visible;
            panelButtons.Children.Add(btnLoad);
        }
コード例 #15
0
 public FlightAirlinerClass(RouteAirlinerClass aClass, int passengers)
 {
     this.AirlinerClass = aClass;
     this.Passengers    = passengers;
 }
コード例 #16
0
 public RouteStatisticsItem(RouteAirlinerClass routeClass, StatisticsType type, int value)
 {
     this.RouteClass = routeClass;
     this.Type = type;
     this.Value = value;
 }
コード例 #17
0
        public long getStatisticsValue(StatisticsType type)
        {
            RouteAirlinerClass aClass = new RouteAirlinerClass(AirlinerClass.ClassType.Economy_Class, RouteAirlinerClass.SeatingType.Free_Seating, 0);

            return getStatisticsValue(aClass, type);
        }
コード例 #18
0
        //returns the value for a statistics type for a route class
        public long getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type)
        {
            RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass.Type == aClass.Type);

            if (item == null)
                return 0;
            else
                return item.Value;
        }
コード例 #19
0
 //sets the value for a statistics type to a route class
 public void setStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
 {
     if (!this.Stats.ContainsKey(aClass))
         this.Stats.Add(aClass, new Dictionary<StatisticsType, int>());
     if (!this.Stats[aClass].ContainsKey(type))
         this.Stats[aClass].Add(type, value);
     else
         this.Stats[aClass][type] = value;
 }
コード例 #20
0
ファイル: RouteStatistics.cs プロジェクト: petfol/tap-desktop
 public RouteStatisticsItem(RouteAirlinerClass routeClass, StatisticsType type, int value)
 {
     this.RouteClass = routeClass;
     this.Type       = type;
     this.Value      = value;
 }
コード例 #21
0
        public void addStatisticsValue(StatisticsType type, int value)
        {
            RouteAirlinerClass aClass = new RouteAirlinerClass(AirlinerClass.ClassType.Economy_Class, RouteAirlinerClass.SeatingType.Free_Seating, 0);

            addStatisticsValue(aClass,type,value);
        }
コード例 #22
0
ファイル: RouteStatistics.cs プロジェクト: petfol/tap-desktop
        public long getStatisticsValue(StatisticsType type)
        {
            RouteAirlinerClass aClass = new RouteAirlinerClass(AirlinerClass.ClassType.Economy_Class, RouteAirlinerClass.SeatingType.Free_Seating, 0);

            return(getStatisticsValue(aClass, type));
        }
コード例 #23
0
        public static object ShowPopUp(RouteAirlinerClass aClass)
        {
            PopUpWindow window = new PopUpRouteFacilities(aClass);
            window.ShowDialog();

            return window.Selected;
        }
コード例 #24
0
ファイル: RouteStatistics.cs プロジェクト: petfol/tap-desktop
        public void setStatisticsValue(StatisticsType type, int value)
        {
            RouteAirlinerClass aClass = new RouteAirlinerClass(AirlinerClass.ClassType.Economy_Class, RouteAirlinerClass.SeatingType.Free_Seating, 0);

            setStatisticsValue(aClass, type, value);
        }
コード例 #25
0
        public PopUpRouteFacilities(RouteAirlinerClass aClass)
        {
            this.cbFacilities = new List<ComboBox>();

            this.Uid = "1000";
            this.AirlinerClass = new RouteAirlinerClass(aClass.Type,aClass.Seating, aClass.FarePrice);

            foreach (RouteFacility facility in aClass.getFacilities())
                this.AirlinerClass.addFacility(facility);

            InitializeComponent();

            this.Title = Translator.GetInstance().GetString("PopUpRouteFacilities", this.Uid);

            this.Width = 400;

            this.Height = 250;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel contentPanel = new StackPanel();

            ListBox lbRouteInfo = new ListBox();
            lbRouteInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbRouteInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            contentPanel.Children.Add(lbRouteInfo);

            foreach (RouteFacility.FacilityType type in Enum.GetValues(typeof(RouteFacility.FacilityType)))
            {
                if (GameObject.GetInstance().GameTime.Year >= (int)type)
                {
                    ComboBox cbFacility = new ComboBox();
                    cbFacility.Background = Brushes.Transparent;
                    cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                    cbFacility.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    cbFacility.DisplayMemberPath = "Name";
                    cbFacility.SelectedValuePath = "Name";
                    cbFacility.Tag = type;
                    cbFacility.Width = 150;

                    foreach (RouteFacility facility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline,type))
                        cbFacility.Items.Add(facility);

                    cbFacilities.Add(cbFacility);

                    lbRouteInfo.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(type).ToString(), cbFacility));

                    cbFacility.SelectedItem = this.AirlinerClass.getFacility(type);
                }
            }

            // chs, 2011-18-10 added for type of seating
            cbSeating = new ComboBox();
            cbSeating.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbSeating.Width = 150;
            cbSeating.ItemTemplate = this.Resources["SeatingItem"] as DataTemplate;

            foreach (RouteAirlinerClass.SeatingType sType in Enum.GetValues(typeof(RouteAirlinerClass.SeatingType)))
                cbSeating.Items.Add(sType);

            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpRouteFacilities", "1004"), cbSeating));

            WrapPanel panelPrice = new WrapPanel();

            txtPrice = new TextBox();
            txtPrice.Background = Brushes.Transparent;
            txtPrice.Width = 100;
            txtPrice.TextAlignment = TextAlignment.Right;
            txtPrice.Margin = new Thickness(2, 0, 0, 0);
            txtPrice.PreviewKeyDown += new KeyEventHandler(txtPrice_PreviewKeyDown);
            txtPrice.PreviewTextInput += new TextCompositionEventHandler(txtPrice_PreviewTextInput);
            txtPrice.TextChanged += new TextChangedEventHandler(txtPrice_TextChanged);

            panelPrice.Children.Add(txtPrice);

            CultureInfo cultureInfo = new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, false);
            CountryCurrency currency = null;

            if (GameObject.GetInstance().CurrencyCountry != null)
                currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime);

            TextBlock txtCurrencySign = UICreator.CreateTextBlock(currency == null ? cultureInfo.NumberFormat.CurrencySymbol : currency.CurrencySymbol);
            txtCurrencySign.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            panelPrice.Children.Add(txtCurrencySign);

            lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpRouteFacilities", "1005"), panelPrice));

            WrapPanel panelButtons = new WrapPanel();
            panelButtons.Margin = new Thickness(0, 5, 0, 0);

            contentPanel.Children.Add(panelButtons);

            btnOk = new Button();
            btnOk.Uid = "100";
            btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnOk.Height =Double.NaN;
            btnOk.Width = Double.NaN;
            btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid);
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            //btnOk.Margin = new System.Windows.Thickness(0, 5, 0, 0);
            btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnOk.Click += new RoutedEventHandler(btnOk_Click);
            btnOk.IsEnabled = false;

            panelButtons.Children.Add(btnOk);

            Button btnCancel = new Button();
            btnCancel.Uid = "101";
            btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCancel.Height = Double.NaN;
            btnCancel.Width = Double.NaN;
            btnCancel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnCancel.Click += new RoutedEventHandler(btnCancel_Click);
            btnCancel.Margin = new Thickness(5, 0, 0, 0);
            btnCancel.Content = Translator.GetInstance().GetString("General", btnCancel.Uid);
            btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            panelButtons.Children.Add(btnCancel);

            this.Content = contentPanel;

            double fareprice = currency == null ? this.AirlinerClass.FarePrice : this.AirlinerClass.FarePrice * currency.Rate;

             txtPrice.Text = String.Format("{0:0.##}",fareprice);
            cbSeating.SelectedItem = this.AirlinerClass.Seating;
        }
コード例 #26
0
 //adds a route airliner class to the route
 public void addRouteAirlinerClass(RouteAirlinerClass aClass)
 {
     this.Classes.Add(aClass);
 }
コード例 #27
0
 public FlightAirlinerClass(RouteAirlinerClass aClass, int passengers)
 {
     this.AirlinerClass = aClass;
     this.Passengers = passengers;
 }