public PopUpAirlinerRoutes(FleetAirliner airliner, Boolean isEditable) { this.Entries = new Dictionary <Route, List <RouteTimeTableEntry> >(); this.EntriesToDelete = new Dictionary <Route, List <RouteTimeTableEntry> >(); this.Airliner = airliner; this.IsEditable = isEditable; InitializeComponent(); this.Title = this.Airliner.Name; this.Width = 1200; this.Height = this.IsEditable ? 325 : 275; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; ScrollViewer scroller = new ScrollViewer(); //scroller.Margin = new Thickness(10, 10, 10, 10); scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scroller.MaxHeight = this.Height; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); scroller.Content = mainPanel; Grid grdFlights = UICreator.CreateGrid(2); grdFlights.ColumnDefinitions[1].Width = new GridLength(200); mainPanel.Children.Add(grdFlights); lbFlights = new ListBox(); lbFlights.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbFlights.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); lbFlights.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; Grid.SetColumn(lbFlights, 0); grdFlights.Children.Add(lbFlights); ScrollViewer panelRoutes = createRoutesPanel(); Grid.SetColumn(panelRoutes, 1); grdFlights.Children.Add(panelRoutes); if (this.IsEditable) { mainPanel.Children.Add(createNewEntryPanel()); mainPanel.Children.Add(createButtonsPanel()); } this.Content = scroller; showFlights(); }
//creates the panel for arrivals private ScrollViewer createArrivalsPanel() { ScrollViewer svArrivals = new ScrollViewer(); svArrivals.Margin = new Thickness(0, 10, 0, 0); svArrivals.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; svArrivals.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; svArrivals.MaxHeight = GraphicsHelpers.GetContentHeight() / 3; StackPanel panelArrivals = new StackPanel(); panelArrivals.Margin = new Thickness(0, 10, 0, 0); Grid grdType = UICreator.CreateGrid(2); grdType.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; panelArrivals.Children.Add(grdType); Image imgLogo = new Image(); imgLogo.Source = new BitmapImage(new Uri(@"/Data/images/Arrivals.png", UriKind.RelativeOrAbsolute)); imgLogo.Height = 20; RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality); Grid.SetColumn(imgLogo, 0); grdType.Children.Add(imgLogo); TextBlock txtType = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PageAirport", "1002")); txtType.FontStyle = FontStyles.Oblique; txtType.FontSize = 16; Grid.SetColumn(txtType, 1); grdType.Children.Add(txtType); ContentControl txtHeader = new ContentControl(); txtHeader.Uid = "1003"; txtHeader.ContentTemplate = this.Resources["FlightHeader"] as DataTemplate; txtHeader.Content = Translator.GetInstance().GetString("PageAirport", txtHeader.Uid); txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; panelArrivals.Children.Add(txtHeader); lbArrivals = new ListBox(); lbArrivals.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbArrivals.ItemTemplate = this.Resources["FlightItem"] as DataTemplate; panelArrivals.Children.Add(lbArrivals); svArrivals.Content = panelArrivals; return(svArrivals); }
//show current month private void showMonth() { if (this.MonthViewGrid != null) { this.MonthViewGrid.Children.Clear(); int daysInMonth = DateTime.DaysInMonth(this.Date.Year, this.Date.Month); DateTime startDate = new DateTime(this.Date.Year, this.Date.Month, 1); int startDayOfWeek = (int)startDate.DayOfWeek; Grid grdDays = UICreator.CreateGrid(7, 6); for (int i = 0; i < 7; i++) { for (int j = 0; j < 6; j++) { int day = i + 7 * j + 1; DayBoxControl dbcDay = new DayBoxControl(); if (day > startDayOfWeek && day <= daysInMonth + startDayOfWeek) { dbcDay.Day = day - startDayOfWeek; DateTime currentDate = new DateTime(this.Date.Year, this.Date.Month, dbcDay.Day); foreach (CalendarItem item in getCalendarItems(currentDate)) { AppointmentControl aControl = new AppointmentControl(); aControl.Item = item; dbcDay.DayAppointmentsStack.Children.Add(aControl); } } else { dbcDay.DayVisibility = System.Windows.Visibility.Collapsed; } Grid.SetColumn(dbcDay, i); Grid.SetRow(dbcDay, j); grdDays.Children.Add(dbcDay); } } MonthViewGrid.Children.Add(grdDays); } }
public PopUpTimeTable(Route route) { InitializeComponent(); this.Uid = "1000"; this.Route = route; this.Title = string.Format("{0} - {1}", this.Route.Destination1.Profile.IATACode, this.Route.Destination2.Profile.IATACode); this.Width = 800; this.Height = 450; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel panelMain = new StackPanel(); panelMain.Margin = new Thickness(10, 10, 10, 10); Grid grdMain = UICreator.CreateGrid(2); StackPanel panelOutbound = createDestinationPanel(route.Destination1); Grid.SetColumn(panelOutbound, 0); grdMain.Children.Add(panelOutbound); StackPanel panelInbound = createDestinationPanel(route.Destination2); Grid.SetColumn(panelInbound, 1); grdMain.Children.Add(panelInbound); panelMain.Children.Add(grdMain); panelMain.Children.Add(createCPUButtonsPanel()); this.Content = panelMain; showEntries(); }
//create the slider indicator private Grid createIndicator() { Grid grdIndicator = UICreator.CreateGrid(3); grdIndicator.Width = 200; TextBlock txtEasy = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Easy").Name); TextBlock txtNormal = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Normal").Name); TextBlock txtHard = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Hard").Name); Grid.SetColumn(txtEasy, 0); grdIndicator.Children.Add(txtEasy); txtNormal.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; Grid.SetColumn(txtNormal, 1); grdIndicator.Children.Add(txtNormal); Grid.SetColumn(txtHard, 2); txtHard.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; grdIndicator.Children.Add(txtHard); return(grdIndicator); }
public PopUpSelectOpponents(Airline human, int opponents, int startyear, Region region, Continent continent) { this.Human = human; this.Opponents = opponents; this.StartYear = startyear; InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpSelectOpponents", this.Uid); this.Width = 500; this.Height = 500; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel panelMain = new StackPanel(); Grid grdMain = UICreator.CreateGrid(2); panelMain.Children.Add(grdMain); StackPanel panelSelectAirlines = new StackPanel(); panelSelectAirlines.Margin = new Thickness(5, 0, 5, 0); TextBlock txtSelectedHeader = new TextBlock(); txtSelectedHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtSelectedHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush"); txtSelectedHeader.FontWeight = FontWeights.Bold; txtSelectedHeader.Uid = "1001"; txtSelectedHeader.Text = string.Format(Translator.GetInstance().GetString("PopUpSelectOpponents", txtSelectedHeader.Uid), this.Opponents); panelSelectAirlines.Children.Add(txtSelectedHeader); lbSelectedAirlines = new ListBox(); lbSelectedAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbSelectedAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem"); lbSelectedAirlines.MaxHeight = 400; lbSelectedAirlines.SelectionChanged += lbSelectedAirlines_SelectionChanged; panelSelectAirlines.Children.Add(lbSelectedAirlines); Grid.SetColumn(panelSelectAirlines, 0); grdMain.Children.Add(panelSelectAirlines); StackPanel panelOpponents = new StackPanel(); panelOpponents.Margin = new Thickness(5, 0, 5, 0); TextBlock txtOpponentsHeader = new TextBlock(); txtOpponentsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtOpponentsHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush"); txtOpponentsHeader.FontWeight = FontWeights.Bold; txtOpponentsHeader.Uid = "1002"; txtOpponentsHeader.Text = Translator.GetInstance().GetString("PopUpSelectOpponents", txtOpponentsHeader.Uid); panelOpponents.Children.Add(txtOpponentsHeader); lbOpponentAirlines = new ListBox(); lbOpponentAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbOpponentAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem"); lbOpponentAirlines.MaxHeight = 400; lbOpponentAirlines.SelectionChanged += lbOpponentAirlines_SelectionChanged; panelOpponents.Children.Add(lbOpponentAirlines); foreach (Airline airline in Airlines.GetAirlines(a => a.Profile.Founded <= startyear && a.Profile.Folded > startyear && a != this.Human && (a.Profile.Country.Region == region || (continent != null && (continent.Uid == "100" || continent.hasRegion(a.Profile.Country.Region)))))) { lbOpponentAirlines.Items.Add(airline); } Grid.SetColumn(panelOpponents, 1); grdMain.Children.Add(panelOpponents); Button 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.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnOk.Margin = new Thickness(5, 5, 0, 0); btnOk.Click += btnOk_Click; btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelMain.Children.Add(btnOk); this.Content = panelMain; }
//creates the panel for destination flights private StackPanel createDestinationFlightsPanel() { panelDestinationFlights = new StackPanel(); panelDestinationFlights.Margin = new Thickness(0, 10, 0, 0); panelDestinationFlights.Visibility = System.Windows.Visibility.Collapsed; ScrollViewer svFlights = new ScrollViewer(); svFlights.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; svFlights.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; svFlights.MaxHeight = GraphicsHelpers.GetContentHeight() / 2; panelDestinationFlights.Children.Add(svFlights); StackPanel panelFlights = new StackPanel(); svFlights.Content = panelFlights; TextBlock txtDestinationHeader = new TextBlock(); txtDestinationHeader.Uid = "1004"; txtDestinationHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtDestinationHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtDestinationHeader.FontWeight = FontWeights.Bold; txtDestinationHeader.Text = Translator.GetInstance().GetString("PageAirportFlights", txtDestinationHeader.Uid); panelFlights.Children.Add(txtDestinationHeader); Grid grdArrivalsHeader = UICreator.CreateGrid(2); grdArrivalsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; panelFlights.Children.Add(grdArrivalsHeader); Image imgArrivalsHeader = new Image(); imgArrivalsHeader.Source = new BitmapImage(new Uri(@"/Data/images/Arrivals.png", UriKind.RelativeOrAbsolute)); imgArrivalsHeader.Height = 20; RenderOptions.SetBitmapScalingMode(imgArrivalsHeader, BitmapScalingMode.HighQuality); Grid.SetColumn(imgArrivalsHeader, 0); grdArrivalsHeader.Children.Add(imgArrivalsHeader); TextBlock txtArrivalsHeader = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PageAirportFlights", "1002")); txtArrivalsHeader.FontStyle = FontStyles.Oblique; txtArrivalsHeader.FontSize = 16; Grid.SetColumn(txtArrivalsHeader, 1); grdArrivalsHeader.Children.Add(txtArrivalsHeader); lbDestinationArrivals = new ListBox(); lbDestinationArrivals.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbDestinationArrivals.ItemTemplate = this.Resources["AirportDestinationItem"] as DataTemplate; panelFlights.Children.Add(lbDestinationArrivals); Grid grdDeparturesHeader = UICreator.CreateGrid(2); grdDeparturesHeader.Margin = new Thickness(0, 5, 0, 0); grdDeparturesHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; panelFlights.Children.Add(grdDeparturesHeader); Image imgDeparturesHeader = new Image(); imgDeparturesHeader.Source = new BitmapImage(new Uri(@"/Data/images/Departures.png", UriKind.RelativeOrAbsolute)); imgDeparturesHeader.Height = 20; RenderOptions.SetBitmapScalingMode(imgDeparturesHeader, BitmapScalingMode.HighQuality); Grid.SetColumn(imgDeparturesHeader, 0); grdDeparturesHeader.Children.Add(imgDeparturesHeader); TextBlock txtDeparturesHeader = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PageAirportFlights", "1003")); txtDeparturesHeader.FontStyle = FontStyles.Oblique; txtDeparturesHeader.FontSize = 16; Grid.SetColumn(txtDeparturesHeader, 1); grdDeparturesHeader.Children.Add(txtDeparturesHeader); lbDestinationDepartures = new ListBox(); lbDestinationDepartures.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbDestinationDepartures.ItemTemplate = this.Resources["AirportDestinationItem"] as DataTemplate; //lbDestinationDepartures.MaxHeight = GraphicsHelpers.GetContentHeight() / 2 - 100; panelFlights.Children.Add(lbDestinationDepartures); return(panelDestinationFlights); }
//shows the gates information private void showGatesInformation() { panelGates.Children.Clear(); //GameObject.HumanAirline TextBlock txtGatesInfoHeader = new TextBlock(); txtGatesInfoHeader.Uid = "1002"; txtGatesInfoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtGatesInfoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtGatesInfoHeader.FontWeight = FontWeights.Bold; txtGatesInfoHeader.Text = Translator.GetInstance().GetString("PageAirportGates", txtGatesInfoHeader.Uid); panelGates.Children.Add(txtGatesInfoHeader); ListBox lbGatesInfo = new ListBox(); lbGatesInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbGatesInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); lbGatesInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirportGates", "1003"), UICreator.CreateTextBlock(this.Airport.Terminals.getNumberOfGates().ToString()))); lbGatesInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirportGates", "1004"), UICreator.CreateTextBlock((this.Airport.Terminals.getNumberOfGates() - this.Airport.Terminals.getFreeGates()).ToString()))); lbGatesInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirportGates", "1005"), UICreator.CreateTextBlock(this.Airport.Terminals.getFreeGates().ToString()))); lbGatesInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirportGates", "1006"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getGatePrice()).ToString())));//string.Format("{0:c}", this.Airport.getGatePrice())))); /* * if (this.Airport.AirlineContract != null) * { * ContentControl ccAirline = new ContentControl(); * ccAirline.SetResourceReference(ContentControl.ContentTemplateProperty, "AirlineLogoItem"); * ccAirline.Content = this.Airport.AirlineContract.Airline; * * lbGatesInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirportGates","1009"), ccAirline)); * }*/ panelGates.Children.Add(lbGatesInfo); Grid grdGatesHubs = UICreator.CreateGrid(2); grdGatesHubs.Margin = new Thickness(0, 10, 0, 0); panelGates.Children.Add(grdGatesHubs); StackPanel panelTerminals = new StackPanel(); panelTerminals.Margin = new Thickness(0, 0, 5, 0); TextBlock txtTerminalsInfoHeader = new TextBlock(); txtTerminalsInfoHeader.Uid = "1001"; txtTerminalsInfoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtTerminalsInfoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtTerminalsInfoHeader.FontWeight = FontWeights.Bold; txtTerminalsInfoHeader.Text = Translator.GetInstance().GetString("PageAirportGates", txtTerminalsInfoHeader.Uid); panelTerminals.Children.Add(txtTerminalsInfoHeader); lbTerminals = new ListBox(); lbTerminals.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbTerminals.ItemTemplate = this.Resources["TerminalItem"] as DataTemplate; panelTerminals.Children.Add(lbTerminals); Grid.SetColumn(panelTerminals, 0); grdGatesHubs.Children.Add(panelTerminals); StackPanel panelHubs = new StackPanel(); panelHubs.Margin = new Thickness(5, 0, 0, 0); TextBlock txtAirportHubs = new TextBlock(); txtAirportHubs.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtAirportHubs.FontWeight = FontWeights.Bold; txtAirportHubs.Uid = "1008"; txtAirportHubs.Text = Translator.GetInstance().GetString("PageAirportGates", txtAirportHubs.Uid); panelHubs.Children.Add(txtAirportHubs); lbHubs = new ListBox(); lbHubs.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbHubs.ItemTemplate = this.Resources["HubItem"] as DataTemplate; panelHubs.Children.Add(lbHubs); Grid.SetColumn(panelHubs, 1); grdGatesHubs.Children.Add(panelHubs); }
public PopUpAirlinerAutoRoutes(FleetAirliner airliner) { this.Entries = new Dictionary <Route, List <RouteTimeTableEntry> >(); this.EntriesToDelete = new Dictionary <Route, List <RouteTimeTableEntry> >(); this.NewestEntries = new List <RouteTimeTableEntry>(); this.Airliner = airliner; InitializeComponent(); this.Title = this.Airliner.Name; this.Width = 1200; this.Height = 350; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; ScrollViewer scroller = new ScrollViewer(); //scroller.Margin = new Thickness(10, 10, 10, 10); scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scroller.MaxHeight = this.Height; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); scroller.Content = mainPanel; Grid grdFlights = UICreator.CreateGrid(2); grdFlights.ColumnDefinitions[1].Width = new GridLength(200); // mainPanel.Children.Add(grdFlights); lbFlights = new ListBox(); lbFlights.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbFlights.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); lbFlights.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; //Grid.SetColumn(lbFlights, 0); //grdFlights.Children.Add(lbFlights); mainPanel.Children.Add(lbFlights); ScrollViewer panelRoutes = createRoutesPanel(); Grid.SetColumn(panelRoutes, 1); grdFlights.Children.Add(panelRoutes); this.RouteFrame = new Frame(); this.RouteFrame.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; mainPanel.Children.Add(this.RouteFrame); //mainPanel.Children.Add(createAutoGeneratePanel()); mainPanel.Children.Add(createButtonsPanel()); this.Content = scroller; showFlights(); PageAirlinerAutoRoute pageRoute = new PageAirlinerAutoRoute(this.Airliner, this, PopUpAirlinerAutoRoutes_RouteChanged); this.RouteFrame.Navigate(pageRoute); }