//creates a popup with a text
        //creates the splash window
        private Border createSplashWindow(string text)
        {
            Border brdSplasInner = new Border();

            brdSplasInner.BorderBrush     = Brushes.Black;
            brdSplasInner.BorderThickness = new Thickness(2, 2, 0, 0);

            Border brdSplashOuter = new Border();

            brdSplashOuter.BorderBrush     = Brushes.White;
            brdSplashOuter.BorderThickness = new Thickness(0, 0, 2, 2);

            brdSplasInner.Child = brdSplashOuter;

            TextBlock txtSplash = UICreator.CreateTextBlock(text);

            txtSplash.Width         = 200;
            txtSplash.Height        = 100;
            txtSplash.TextAlignment = TextAlignment.Center;
            txtSplash.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtSplash.FontWeight = FontWeights.Bold;

            brdSplashOuter.Child = txtSplash;


            return(brdSplasInner);
        }
Exemplo n.º 2
0
        //creates the a town panel
        public static WrapPanel CreateTownPanel(Town town)
        {
            WrapPanel townPanel = new WrapPanel();

            if (town.State != null)
            {
                TextBlock txtTown = UICreator.CreateTextBlock(string.Format("{0}, {1}", town.Name, town.State.ShortName));
                txtTown.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                townPanel.Children.Add(txtTown);

                if (town.State.Flag != null)
                {
                    Image imgFlag = new Image();
                    imgFlag.Source = new BitmapImage(new Uri(town.State.Flag, UriKind.RelativeOrAbsolute));
                    imgFlag.Height = 24;
                    RenderOptions.SetBitmapScalingMode(imgFlag, BitmapScalingMode.HighQuality);

                    imgFlag.Margin = new Thickness(5, 0, 0, 0);

                    townPanel.Children.Add(imgFlag);
                }
            }
            else if (town.Country is TerritoryCountry && town.State == null)
            {
                TextBlock txtTown = UICreator.CreateTextBlock(string.Format("{0}", town.Name));
                txtTown.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                townPanel.Children.Add(txtTown);

                Image imgFlag = new Image();
                imgFlag.Source = new BitmapImage(new Uri(town.Country.Flag, UriKind.RelativeOrAbsolute));
                imgFlag.Height = 24;
                RenderOptions.SetBitmapScalingMode(imgFlag, BitmapScalingMode.HighQuality);

                imgFlag.Margin = new Thickness(5, 0, 0, 0);

                townPanel.Children.Add(imgFlag);
            }
            else
            {
                townPanel.Children.Add(UICreator.CreateTextBlock(town.Name));
            }

            return(townPanel);
        }
Exemplo n.º 3
0
        public PageBottomMenu()
        {
            this.SetResourceReference(Page.BackgroundProperty, "BackgroundBottom");

            Border frameBorder = new Border();

            frameBorder.BorderBrush     = Brushes.White;
            frameBorder.BorderThickness = new Thickness(2);


            Grid panelMain = UICreator.CreateGrid(3, 1);

            panelMain.Margin            = new Thickness(5, 0, 5, 0);
            panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            TextBlock txtHuman = new TextBlock();

            txtHuman.FontWeight        = FontWeights.Bold;
            txtHuman.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            txtHuman.Text = string.Format(Translator.GetInstance().GetString("PageBottomMenu", "1000"), GameObject.GetInstance().HumanAirline.Profile.CEO, GameObject.GetInstance().HumanAirline.Profile.Name);

            Grid.SetColumn(txtHuman, 0);
            Grid.SetRow(txtHuman, 0);
            panelMain.Children.Add(txtHuman);

            WrapPanel panelTime = new WrapPanel();

            Image imgCalendar = new Image();

            imgCalendar.Width      = 24;
            imgCalendar.Source     = new BitmapImage(new Uri(@"/Data/images/calendar.png", UriKind.RelativeOrAbsolute));
            imgCalendar.MouseDown += imgCalendar_MouseDown;
            RenderOptions.SetBitmapScalingMode(imgCalendar, BitmapScalingMode.HighQuality);
            imgCalendar.ToolTip = UICreator.CreateToolTip("1013");

            panelTime.Children.Add(imgCalendar);

            txtTime       = new TextBlock();
            txtTime.Width = 300;

            if (GameObject.GetInstance().DayRoundEnabled)
            {
                txtTime.Text = GameObject.GetInstance().GameTime.ToLongDateString() + " " + GameObject.GetInstance().TimeZone.ShortDisplayName;
            }
            else
            {
                txtTime.Text = GameObject.GetInstance().GameTime.ToLongDateString() + " " + GameObject.GetInstance().GameTime.ToShortTimeString() + " " + GameObject.GetInstance().TimeZone.ShortDisplayName;//GameObject.GetInstance().GameTime.ToString("dddd MMMM dd, yyyy HH:mm", CultureInfo.CreateSpecificCulture("en-US")) + " " + GameObject.GetInstance().TimeZone.ShortDisplayName;
            }
            txtTime.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txtTime.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
            txtTime.FontWeight          = FontWeights.Bold;

            panelTime.Children.Add(txtTime);

            Grid.SetColumn(panelTime, 1);
            Grid.SetRow(panelTime, 0);
            panelMain.Children.Add(panelTime);

            txtMoney = new TextBlock();

            //txtMoney.Text = string.Format("{0:c}", GameObject.GetInstance().HumanAirline.Money);
            txtMoney.Text       = new ValueCurrencyConverter().Convert(GameObject.GetInstance().HumanAirline.Money).ToString();
            txtMoney.Foreground = new Converters.ValueIsMinusConverter().Convert(GameObject.GetInstance().HumanAirline.Money, null, null, null) as Brush;

            txtMoney.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            txtMoney.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
            txtMoney.FontWeight          = FontWeights.Bold;

            Grid.SetColumn(txtMoney, 2);
            Grid.SetRow(txtMoney, 0);
            panelMain.Children.Add(txtMoney);

            /*
             * txtNews = UICreator.CreateTextBlock("Test");
             * txtNews.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
             * txtNews.VerticalAlignment = System.Windows.VerticalAlignment.Center;
             * txtNews.Visibility = System.Windows.Visibility.Collapsed;
             *
             * Grid.SetColumnSpan(txtNews, 3);
             * Grid.SetRow(txtNews, 0);
             * Grid.SetColumn(txtNews, 0);
             *
             * panelMain.Children.Add(txtNews);*/

            frameBorder.Child = panelMain;

            this.Content = frameBorder;

            currentNews = new List <NewsFeed>();
        }
Exemplo n.º 4
0
        public StandardPage()
        {
            if (GameObject.GetInstance().PagePerformanceCounterEnabled)
            {
                sw = new Stopwatch();
                sw.Start();

                this.Loaded += new RoutedEventHandler(StandardPage_Loaded);
            }



            this.Width  = SystemParameters.PrimaryScreenWidth;
            this.Height = SystemParameters.PrimaryScreenHeight;

            int sideMargin       = 200;
            int regularMargin    = 25;
            int menuHeight       = 25;
            int bottomMenuHeight = 25;

            ImageBrush imgBackground = new ImageBrush();

            BitmapImage img = (BitmapImage)App.Current.Resources["BackgroundImage"];

            imgBackground.ImageSource   = (BitmapImage)FindResource("BackgroundImage");
            imgBackground.Viewport      = new Rect(0, 0, this.Width, this.Height);
            imgBackground.ViewportUnits = BrushMappingMode.Absolute;
            imgBackground.TileMode      = TileMode.Tile;

            this.Background = imgBackground;

            mainPanel = new Canvas();

            frameTopMenu        = new Frame();
            frameTopMenu.Height = menuHeight;
            frameTopMenu.Width  = this.Width;
            frameTopMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            frameTopMenu.Navigate(new PageStandardMenuTop());

            Canvas.SetTop(frameTopMenu, 0);
            Canvas.SetLeft(frameTopMenu, 0);
            mainPanel.Children.Add(frameTopMenu);

            panelNavigation        = new DockPanel();
            panelNavigation.Margin = new Thickness(0, 5, 0, 0);

            btnPrevious = new Button();
            btnPrevious.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnPrevious.Height  = 24;
            btnPrevious.Width   = 32;
            btnPrevious.Content = "<-";
            btnPrevious.Margin  = new Thickness(2, 0, 0, 0);
            btnPrevious.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnPrevious.Click += new RoutedEventHandler(btnPrevious_Click);
            panelNavigation.Children.Add(btnPrevious);
            btnPrevious.ToolTip = UICreator.CreateToolTip("1001");

            btnNext = new Button();
            btnNext.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnNext.Height  = 24;
            btnNext.Margin  = new Thickness(2, 0, 0, 0);
            btnNext.Width   = 32;
            btnNext.Content = "->";
            btnNext.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnNext.Click += new RoutedEventHandler(btnNext_Click);
            panelNavigation.Children.Add(btnNext);
            btnNext.ToolTip = UICreator.CreateToolTip("1002");

            btnPause = new Button();
            btnPause.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnPause.Height  = 24;
            btnPause.Width   = 32;
            btnPause.Margin  = new Thickness(2, 0, 0, 0);
            btnPause.Content = "||";
            btnPause.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnPause.Click += new RoutedEventHandler(btnPause_Click);
            panelNavigation.Children.Add(btnPause);
            btnPause.ToolTip = UICreator.CreateToolTip("1003");

            btnStart = new Button();
            btnStart.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnStart.Height  = 24;
            btnStart.Width   = 32;
            btnStart.Margin  = new Thickness(2, 0, 0, 0);
            btnStart.Content = ">";
            btnStart.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnStart.Click += new RoutedEventHandler(btnStart_Click);
            panelNavigation.Children.Add(btnStart);
            btnStart.ToolTip = UICreator.CreateToolTip("1004");

            Button btnThreadState = new Button();

            btnThreadState.Visibility = System.Windows.Visibility.Collapsed;
            btnThreadState.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnThreadState.Height  = Double.NaN;
            btnThreadState.Width   = Double.NaN;
            btnThreadState.Margin  = new Thickness(2, 0, 0, 0);
            btnThreadState.Content = "Thread state";
            btnThreadState.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnThreadState.Click += btnThreadState_Click;
            panelNavigation.Children.Add(btnThreadState);

            Canvas.SetTop(panelNavigation, frameTopMenu.Height);
            Canvas.SetLeft(panelNavigation, 0);
            mainPanel.Children.Add(panelNavigation);


            Frame frameTop = new Frame();

            frameTop.Height = 75;
            frameTop.Width  = this.Width - 2 * sideMargin;
            frameTop.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            this.PageHeader = new PageHeader();
            frameTop.Navigate(this.PageHeader);

            Canvas.SetTop(frameTop, frameTopMenu.Height + regularMargin);
            Canvas.SetRight(frameTop, sideMargin);
            mainPanel.Children.Add(frameTop);

            Frame frameContent = new Frame();

            frameContent.SizeChanged           += new SizeChangedEventHandler(frameContent_SizeChanged);
            frameContent.Height                 = this.Height - Canvas.GetTop(frameTop) - 150;
            frameContent.Width                  = this.Width - 2 * sideMargin;
            frameContent.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            this.PageContent = new PageContent();
            frameContent.Navigate(this.PageContent);

            Canvas.SetTop(frameContent, Canvas.GetTop(frameTop) + frameTop.Height + regularMargin);
            Canvas.SetLeft(frameContent, sideMargin);
            mainPanel.Children.Add(frameContent);

            frameInformation        = new Frame();
            frameInformation.Height = frameTopMenu.Height;
            frameInformation.Width  = 125;
            frameInformation.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            frameInformation.Navigate(new PageInformation());

            Canvas.SetTop(frameInformation, 0);
            Canvas.SetRight(frameInformation, 0);
            mainPanel.Children.Add(frameInformation);

            frameBottomMenu        = new Frame();
            frameBottomMenu.Height = bottomMenuHeight;
            frameBottomMenu.Width  = this.Width;
            frameBottomMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            frameBottomMenu.Navigate(new PageBottomMenu());

            Canvas.SetBottom(frameBottomMenu, 0);
            Canvas.SetLeft(frameBottomMenu, 0);
            mainPanel.Children.Add(frameBottomMenu);

            this.Content = this.mainPanel;
        }
Exemplo n.º 5
0
        public PageSettings()
        {
            InitializeComponent();

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

            StackPanel settingsPanel = new StackPanel();

            settingsPanel.Margin = new Thickness(10, 0, 10, 0);

            StandardContentPanel panelContent = new StandardContentPanel();

            panelContent.setContentPage(settingsPanel, StandardContentPanel.ContentLocation.Left);

            ListBox lbSettings = new ListBox();

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

            settingsPanel.Children.Add(lbSettings);

            WrapPanel panelSpeed = new WrapPanel();

            slGameSpeed                      = new Slider();
            slGameSpeed.Minimum              = (int)GeneralHelpers.GameSpeedValue.Fastest;
            slGameSpeed.Maximum              = (int)GeneralHelpers.GameSpeedValue.Slowest;
            slGameSpeed.Width                = 100;
            slGameSpeed.IsDirectionReversed  = true;
            slGameSpeed.IsSnapToTickEnabled  = true;
            slGameSpeed.IsMoveToPointEnabled = true;
            slGameSpeed.TickFrequency        = 500;
            slGameSpeed.ToolTip              = UICreator.CreateToolTip("1005");


            slGameSpeed.ValueChanged += new RoutedPropertyChangedEventHandler <double>(slGameSpeed_ValueChanged);

            panelSpeed.Children.Add(slGameSpeed);

            txtGameSpeed.Margin            = new Thickness(5, 0, 0, 0);
            txtGameSpeed.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelSpeed.Children.Add(txtGameSpeed);

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1001"), panelSpeed));

            cbTurnMinutes       = new ComboBox();
            cbTurnMinutes.Width = 100;
            cbTurnMinutes.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbTurnMinutes.Items.Add(15);
            cbTurnMinutes.Items.Add(30);
            cbTurnMinutes.Items.Add(60);
            cbTurnMinutes.ToolTip = UICreator.CreateToolTip("1006");

            cbTurnMinutes.SelectedItem = Settings.GetInstance().MinutesPerTurn;

            if (!GameObject.GetInstance().DayRoundEnabled)
            {
                lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1006"), cbTurnMinutes));
            }


            cbLanguage       = new ComboBox();
            cbLanguage.Width = 200;
            cbLanguage.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            // chs, 2011-10-11 changed to display flag together with language
            cbLanguage.ItemTemplate = this.Resources["LanguageItem"] as DataTemplate;
            cbLanguage.ToolTip      = UICreator.CreateToolTip("1007");


            foreach (Language language in Languages.GetLanguages().FindAll(l => l.IsEnabled))
            {
                cbLanguage.Items.Add(language);
            }

            cbLanguage.SelectedItem = AppSettings.GetInstance().getLanguage();

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1002"), cbLanguage));


            cbSkin = new ComboBox();
            cbSkin.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbSkin.Width             = 200;
            cbSkin.SelectedValuePath = "Name";
            cbSkin.DisplayMemberPath = "Name";
            cbSkin.ToolTip           = UICreator.CreateToolTip("1008");

            foreach (Skin skin in Skins.GetSkins())
            {
                cbSkin.Items.Add(skin);
            }

            cbSkin.SelectedItem = SkinObject.GetInstance().CurrentSkin;

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1003"), cbSkin));

            cbMailOnLandings           = new CheckBox();
            cbMailOnLandings.IsChecked = Settings.GetInstance().MailsOnLandings;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1004"), cbMailOnLandings));
            cbMailOnLandings.ToolTip = UICreator.CreateToolTip("1009");

            cbMailOnBadWeather           = new CheckBox();
            cbMailOnBadWeather.IsChecked = Settings.GetInstance().MailsOnBadWeather;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1007"), cbMailOnBadWeather));
            cbMailOnBadWeather.ToolTip = UICreator.CreateToolTip("1010");

            cbShortenCurrency           = new CheckBox();
            cbShortenCurrency.IsChecked = Settings.GetInstance().CurrencyShorten;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1008"), cbShortenCurrency));
            cbShortenCurrency.ToolTip = UICreator.CreateToolTip("1011");

            rbAirportCodes = new RadioButton[Enum.GetValues(typeof(Settings.AirportCode)).Length];

            WrapPanel panelAirpodeCode = new WrapPanel();
            int       i = 0;

            foreach (Settings.AirportCode code in Enum.GetValues(typeof(Settings.AirportCode)))
            {
                rbAirportCodes[i]           = new RadioButton();
                rbAirportCodes[i].Content   = code.ToString();
                rbAirportCodes[i].GroupName = "AirportCode";
                rbAirportCodes[i].Tag       = code;
                rbAirportCodes[i].Margin    = new Thickness(0, 0, 5, 0);
                rbAirportCodes[i].IsChecked = code == Settings.GetInstance().AirportCodeDisplay;
                rbAirportCodes[i].ToolTip   = UICreator.CreateToolTip("1012");

                panelAirpodeCode.Children.Add(rbAirportCodes[i]);
                i++;
            }
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1005"), panelAirpodeCode));


            WrapPanel buttonsPanel = new WrapPanel();

            buttonsPanel.Margin = new Thickness(0, 10, 0, 0);
            settingsPanel.Children.Add(buttonsPanel);

            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.Click += new RoutedEventHandler(btnOk_Click);
            btnOk.Click += new RoutedEventHandler(btnOk_Click);
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            buttonsPanel.Children.Add(btnOk);

            Button btnUndo = new Button();

            btnUndo.Uid = "103";
            btnUndo.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnUndo.Height  = Double.NaN;
            btnUndo.Margin  = new Thickness(5, 0, 0, 0);
            btnUndo.Width   = Double.NaN;
            btnUndo.Click  += new RoutedEventHandler(btnUndo_Click);
            btnUndo.Content = Translator.GetInstance().GetString("General", btnUndo.Uid);
            btnUndo.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            buttonsPanel.Children.Add(btnUndo);

            base.setContent(panelContent);

            base.setHeaderContent(this.Title);


            showPage(this);
        }