Make the pEp name/logo green in the first screen. OUT-619
authorThomas
Fri, 25 Oct 2019 16:56:58 +0200
branchOUT-619
changeset 28334648c150cff8
parent 2832 430a2c90938e
child 2834 4fa3adadc41d
Make the pEp name/logo green in the first screen.
UI/Views/WizardGenericPageView.xaml
UI/Views/WizardGenericPageView.xaml.cs
     1.1 --- a/UI/Views/WizardGenericPageView.xaml	Fri Oct 25 12:48:44 2019 +0200
     1.2 +++ b/UI/Views/WizardGenericPageView.xaml	Fri Oct 25 16:56:58 2019 +0200
     1.3 @@ -3,7 +3,8 @@
     1.4               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     1.5               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
     1.6               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
     1.7 -             mc:Ignorable="d">
     1.8 +             mc:Ignorable="d"
     1.9 +             Loaded="WizardGenericPageView_Loaded">
    1.10      <StackPanel>
    1.11  
    1.12          <!--Information section-->
     2.1 --- a/UI/Views/WizardGenericPageView.xaml.cs	Fri Oct 25 12:48:44 2019 +0200
     2.2 +++ b/UI/Views/WizardGenericPageView.xaml.cs	Fri Oct 25 16:56:58 2019 +0200
     2.3 @@ -1,17 +1,8 @@
     2.4  using System;
     2.5 -using System.Collections.Generic;
     2.6 -using System.Linq;
     2.7 -using System.Text;
     2.8 -using System.Threading.Tasks;
     2.9  using System.Windows;
    2.10  using System.Windows.Controls;
    2.11 -using System.Windows.Data;
    2.12  using System.Windows.Documents;
    2.13 -using System.Windows.Input;
    2.14  using System.Windows.Media;
    2.15 -using System.Windows.Media.Imaging;
    2.16 -using System.Windows.Navigation;
    2.17 -using System.Windows.Shapes;
    2.18  
    2.19  namespace pEp.UI.Views
    2.20  {
    2.21 @@ -24,5 +15,42 @@
    2.22          {
    2.23              InitializeComponent();
    2.24          }
    2.25 +
    2.26 +        /// <summary>
    2.27 +        /// Event handler for when a generic wizard page is loaded.
    2.28 +        /// </summary>
    2.29 +        private void WizardGenericPageView_Loaded(object sender, RoutedEventArgs e)
    2.30 +        {
    2.31 +            /* Replace "p≡p" in the explanation string (if existing) with a green version of itself.
    2.32 +             * TODO: This is kind of ugly. The main reason for this solution is to be able to stay 
    2.33 +             * flexible for localized versions where the name might occur in other places than the first
    2.34 +             * position.
    2.35 +             */ 
    2.36 +            try
    2.37 +            {                
    2.38 +                string pEpName = "p≡p";
    2.39 +                TextBlock textBlock = (this.Content as StackPanel).Children[0] as TextBlock;
    2.40 +                string explanationText = textBlock.Text;
    2.41 +
    2.42 +                if (explanationText?.Contains(pEpName) == true)
    2.43 +                {
    2.44 +                    textBlock.Text = null;
    2.45 +                    string[] textArray = explanationText.Split(new string[] { pEpName }, StringSplitOptions.None);
    2.46 +                    for (int i = 0; i < textArray.Length; i++)
    2.47 +                    {
    2.48 +                        textBlock.Inlines.Add(new Run(textArray[i]));
    2.49 +
    2.50 +                        if (i < (textArray.Length - 1))
    2.51 +                        {
    2.52 +                            textBlock.Inlines.Add(new Run(pEpName) { Foreground = (Brush)(new BrushConverter()).ConvertFrom("#FF00AA2B") });
    2.53 +                        }
    2.54 +                    }
    2.55 +                }
    2.56 +            }
    2.57 +            catch (Exception ex)
    2.58 +            {
    2.59 +                Log.Error("WizardGenericPageView_Loaded: Error occured.  " + ex.ToString());
    2.60 +            }
    2.61 +        }
    2.62      }
    2.63  }