View Issue Details

IDProjectCategoryView StatusLast Update
0002579NoesisGUIUnity3Dpublic2023-06-06 17:37
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeveritycrashReproducibilityrandom
Status closedResolutionduplicate 
Product Version3.2.0 
Target Version3.2.2 
Summary0002579: Unity Crash After Modifying Resource XAML
DescriptionUnity crashed when I hit play after editing theme resource xaml.

=================================================================
    Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at Noesis.NoesisGUI_PINVOKE:FrameworkElement_Resources_get <0x000f8>
      at Noesis.FrameworkElement:get_Resources <0x000d2>
      at StellarConquest.Presentation.Unity.UI.FrameworkElementExtensionMethods:FadeIn <0x004fa>
      at StellarConquest.Presentation.Unity.UI.UIStateMachine:ScreenTransition <0x0047a>
      at StellarConquest.Presentation.Unity.UI.UIStateMachine:ScreenTransition <0x000e2>
      at StellarConquest.Presentation.Unity.UI.UIStateMachine:ShowCharacterSelectionScreen <0x0035a>
      at StellarConquest.Presentation.Unity.GameStateMachine:SetState <0x007f2>
      at <>c__DisplayClass15_0:<Login>b__0 <0x004ba>
      at <ActionWrapper>d__9:MoveNext <0x000af>
      at UnityEngine.SetupCoroutine:InvokeMoveNext <0x001b0>
      at <Module>:runtime_invoke_void_object_intptr <0x0019f>
      at <unknown> <0xffffffff>
      at UnityEngine.MonoBehaviour:StartCoroutineManaged2 <0x00153>
      at UnityEngine.MonoBehaviour:StartCoroutine <0x00212>
      at <>c__DisplayClass10_0:<Invoke>b__0 <0x0007a>
      at StellarConquest.Presentation.Unity.UnityDispatcher:Update <0x002cd>
      at System.Object:runtime_invoke_void__this__ <0x00187>
=================================================================
Received signal SIGSEGV
Obtained 47 stack frames
0x00007ffec722e46e (Noesis) Boxed_Color_GetStaticType
0x0000023fe526b379 (Mono JIT Code) (wrapper managed-to-native) Noesis.NoesisGUI_PINVOKE:FrameworkElement_Resources_get (System.Runtime.InteropServices.HandleRef)
0x0000023fe526b153 (Mono JIT Code) Noesis.FrameworkElement:get_Resources () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.0/Runtime/API/Proxies/FrameworkElement.cs:834)
0x0000023fe5e18e9b (Mono JIT Code) StellarConquest.Presentation.Unity.UI.FrameworkElementExtensionMethods:FadeIn (Noesis.FrameworkElement,Noesis.FrameworkElement,System.TimeSpan,System.Action) (at D:/Source/StellarConquest/StellarConquest.Presentation.Unity/Assets/User Interface/Controls/FrameworkElementExtensionMethods.cs:67)
0x0000023fea485fdb (Mono JIT Code) StellarConquest.Presentation.Unity.UI.UIStateMachine:ScreenTransition (System.TimeSpan,System.TimeSpan,System.Action,System.Action) (at D:/Source/StellarConquest/StellarConquest.Presentation.Unity/Assets/User Interface/UIStateMachine.cs:183)
Steps To ReproduceRandom. I can't reproduce race conditions. After Unity crashed, I reloaded, and the problem did not reoccur. The steps were:

1) Stop playback.
2) Edit resource.xaml file
3) Hit play
4) Crash with above stack trace.
TagsNo tags attached.
PlatformAny

Relationships

duplicate of 0002571 closedsfernandez FrameworkElement_Resources_get Crash 
duplicate of 0002611 assignedsfernandez Crash using singleton instance after reloading xaml 

Activities

stonstad

stonstad

2023-04-23 20:37

reporter  

stonstad

stonstad

2023-04-23 20:44

reporter   ~0008444

Again
stonstad

stonstad

2023-04-23 20:48

reporter   ~0008445

It is fairly repeatable.

1) Stop playback.
2) Edit resource.xaml file
3) Hit play
4) Crash with above stack trace.

It looks like I am back to crashing every five minutes while trying to edit Noesis XAML.
stonstad

stonstad

2023-04-23 20:53

reporter   ~0008446

Last edited: 2023-04-23 20:53

Here is the XAML I am editing. Changing XAML, even if incorrectly, should not crash the Unity editor.

<!-- Item Template and Styles (Inventory) -->
    <ControlTemplate x:Key="ItemButtonTemplate" TargetType="Button">
        <Grid>
            <Border x:Name="PART_Background"
                        Background="{TemplateBinding Background}"
                        BorderBrush="Transparent"
                        BorderThickness="0"
                        Padding="0"
                        CornerRadius="0"
                        Margin="0, 0, 0, 0" >
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/>
                    <Rectangle x:Name="PART_DisabledRectangle" Stretch="Fill"/>
                </Grid>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <!--<Trigger Property="IsMouseOver" Value="False">
                <Setter TargetName="PART_Background" Property="Background" Value="#00000000"/>
            </Trigger>-->
            <!--<Trigger Property="IsFocused" Value="False">
                <Setter TargetName="PART_Background" Property="Background" Value="#00000000"/>
            </Trigger>-->

            <!-- mouse behavior -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="#6694AD00"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <!-- gamepad behavior -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                     <Condition Property="IsMouseOver" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="#6694AD00"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <!-- gamepad behavior -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="#6694AD00"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <!-- Disabled because it creates a white rectangle around empty weapon and device bays -->
                <!-- it is unclear where this might be benificial elsewhere -->

                <!--<Setter TargetName="PART_Background" Property="Background" Value="#00000000"/>
                <Setter TargetName="PART_DisabledRectangle" Property="Fill" Value="#99333333"/>-->
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
sfernandez

sfernandez

2023-04-24 10:49

manager   ~0008450

This is a duplicate of 0002571.

As I mentioned in the previous issue, can you post the code of UIStateMachine:ScreenTransition and FrameworkElementExtensionMethods:FadeIn?
The crash is because the FrameworkElement is null (or at least its native pointer is). Are you calling the Dispose() method defined in BaseComponent by any chance?
stonstad

stonstad

2023-04-24 18:10

reporter   ~0008457

Last edited: 2023-04-24 18:10

> Are you calling Dispose()
No, not that I am aware of.

> The crash is because the FrameworkElement is null
The crash occurs on after XAML reload. If I explicitly navigate to the file I modified and select Reload on it, a crash is avoided.

- UIStateMachine.cs. Contains the ScreenTransition method.
- FrameworkElementExtensionMethods. Contains the fade method.
- ResourcesTheme.xaml. Contains the file that is modified when a crash occurs. It does not matter what the actual modification is.
UIStateMachine.cs (16,648 bytes)   
using Noesis;
using System;
using System.Collections.Generic;
using UnityEngine;
using Grid = Noesis.Grid;
using GUI = Noesis.GUI;
using NoesisEventArgs = Noesis.EventArgs;

namespace StellarConquest.Presentation.Unity.UI
{
    public partial class UIStateMachine : UserControl
    {
        public static UIStateMachine Instance;
        public GameScreen GameScreen { get; private set; }
        public Grid BaseLayer { get; private set; }
        public OverlayLayer OverlayLayer { get; private set; }
        public TransitionControl TransitionLayer { get; private set; }
        public IGameScreenInputProvider CurrentScreen { get; private set; }
        public NoesisView NoesisView { get; private set; }
        public Camera Camera { get; private set; }

        private FrameworkElement _Root;
        private Rectangle _ConnectionRectangle;
        private Grid _SplashScreen;
        private bool _SplashShown = false;

        private List<IGameScreenInputProvider> _InputProviders = new List<IGameScreenInputProvider>();
       
        public UIStateMachine()
        {
            if (!Application.isPlaying)
                return;

            Initialized += OnInitialized;
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            Instance = this;

            GUI.LoadComponent(this, "Assets/User Interface/UIStateMachine.xaml");
            _Root = Content as FrameworkElement;
            BaseLayer = _Root.FindName("_BaseLayer") as Grid;
            _ConnectionRectangle = _Root.FindName("_ConnectionRectangle") as Rectangle;
            _SplashScreen = _Root.FindName("_SplashScreen") as Grid;

            TransitionLayer = _Root.FindName("_TransitionLayer") as TransitionControl;
            OverlayLayer = _Root.FindName("_OverlayLayer") as OverlayLayer;
            NoesisView = GameState.Instance.UserInterfaceGameObject.GetComponentInChildren<NoesisView>();
            Camera = GameState.Instance.UserInterfaceGameObject.GetComponentInChildren<Camera>();
        }

        private void OnInitialized(object sender, NoesisEventArgs args)
        {
        }

        public void ShowTitleScreen(bool fadePrevious = false)
        {
            _InputProviders.Clear();

            SetConnectionIssue(false);
            TransitionLayer.CutToTransparent();

            if (BaseLayer.Children.Count > 0 && BaseLayer.Children[0] is LoginScreen)
                return;

            if (!fadePrevious)
                BaseLayer.Children.Clear();

            if (!_SplashShown)
            {
                _SplashShown = true;

                LoginScreen loginScreen = new LoginScreen();
                loginScreen.Opacity = 0;

                CurrentScreen = loginScreen;
                BaseLayer.Children.Add(loginScreen);

                float splashScreenDuration = 1.5f;
                if (RuntimeSettings.Instance.IsDemoMode)
                    splashScreenDuration = 5.0f;

                UnityDispatcher.Instance.Invoke(TimeSpan.FromSeconds(splashScreenDuration), () =>
                {
                    Soundtrack.Instance.Play(ScoreType.Login, true);
                    _SplashScreen.FadeOut(this, TimeSpan.FromSeconds(3), () =>
                    {
                        _SplashScreen.Children.Clear(); // clear memory
                        loginScreen.Opacity = 1;
                        loginScreen.FadeIn(this, TimeSpan.FromMilliseconds(700));
                    });
                });
            }
            else
            {
                ScreenTransition(() =>
                {
                    Soundtrack.Instance.Play(ScoreType.Login, true);

                    LoginScreen loginScreen = new LoginScreen();
                    loginScreen.Opacity = 1;

                    CurrentScreen = loginScreen;
                    BaseLayer.Children.Add(loginScreen);

                    loginScreen.FadeIn(this, TimeSpan.FromMilliseconds(700));
                });
            }
        }

        public void ShowCharacterSelectionScreen()
        {
            TransitionLayer.CutToTransparent();

            if (BaseLayer.Children.Count > 0 && BaseLayer.Children[0] is CharacterSelectionScreen)
                return;

            ScreenTransition(() =>
            {
                CharacterSelectionScreen characterSelectionScreen = new CharacterSelectionScreen();
                CurrentScreen = characterSelectionScreen;
                characterSelectionScreen.SetPlayers(SessionState.Instance.AuthenticatedPlayers);
                BaseLayer.Children.Add(characterSelectionScreen);
            });

        }

        public void ShowCharacterCreationScreen()
        {
            TransitionLayer.CutToTransparent();

            if (BaseLayer.Children.Count > 0 && BaseLayer.Children[0] is CharacterCreationScreen)
                return;

            ScreenTransition(() =>
            {
                CharacterCreationScreen characterCreationScreen = new CharacterCreationScreen();
                CurrentScreen = characterCreationScreen;
                BaseLayer.Children.Add(characterCreationScreen);
            });
        }

        public void LoadGameScreen()
        {
            if (BaseLayer.Children.Count > 0 && BaseLayer.Children[0] is CharacterCreationScreen)
                return;

            GameScreen = new GameScreen();
            CurrentScreen = GameScreen;
            GameScreen.Visibility = Visibility.Collapsed;
            BaseLayer.Children.Add(GameScreen);
        }

        public void ShowGameScreen()
        {
            TransitionLayer.FadeFromBlack();
            GameScreen.Visibility = Visibility.Visible;
            GameScreen.FadeIn(this, FrameworkElementExtensionMethods.ScreenSlowFadeTime);
            Soundtrack.Instance.StaticAudioListener.enabled = false;
            Soundtrack.Instance.PlayContextual(SessionState.Instance.Player, SessionState.Instance.StarSystem);
        }

        /// <summary>
        /// Fades out the previous screen, if one exists.
        /// </summary>
        /// <param name="createScreenAction"></param>
        public void ScreenTransition(Action createScreenAction, Action completed = null)
        {
            ScreenTransition(FrameworkElementExtensionMethods.ScreenSlowFadeTime, FrameworkElementExtensionMethods.ScreenFastFadeTime, createScreenAction, completed);
        }

        public void ScreenTransition(TimeSpan fadeInDuration, TimeSpan fadeOutDuration, Action createScreenAction, Action completed = null)
        {
            FrameworkElement screen;

            if (BaseLayer.Children.Count == 0) // no existing screen
            {
                if (createScreenAction != null)
                    createScreenAction.Invoke(); // create screen
                screen = BaseLayer.Children[0] as FrameworkElement;
                screen.FadeIn(this, fadeInDuration, completed);
            }
            else // screen exists
            {
                screen = BaseLayer.Children[0] as FrameworkElement;
                screen.FadeOut(this, fadeOutDuration, new Action(() =>
                {
                    BaseLayer.Children.Clear();
                    if (createScreenAction != null)
                        createScreenAction.Invoke(); // create screen
                    if (BaseLayer.Children.Count > 0)
                    {
                        screen = BaseLayer.Children[0] as FrameworkElement;
                        screen.FadeIn(this, fadeInDuration, completed);
                    }
                }));
            }
        }

        public bool CursorVisible
        {
            get
            {
                return UnityEngine.Cursor.visible && UnityEngine.Cursor.lockState == CursorLockMode.None;
            }
            set
            {
                if (!Input.mousePresent)
                    return;

                if (value)
                {
                    if (!UnityEngine.Cursor.visible)
                        UpdateCursor(CursorType.Arrow);
                    UnityEngine.Cursor.visible = true;
                    UnityEngine.Cursor.lockState = CursorLockMode.None;  
                }
                else
                {
                    UnityEngine.Cursor.lockState = CursorLockMode.Locked;
                    UnityEngine.Cursor.visible = false;
                }
            }
        }

        public void SetConnectionIssue(bool value)
        {
            if (value)
            {
                _ConnectionRectangle.Visibility = Visibility.Visible;
                _ConnectionRectangle.FadeIn(this, TimeSpan.FromSeconds(1));
            }
            else
                _ConnectionRectangle.FadeOutScreen(this, () => _ConnectionRectangle.Visibility = Visibility.Collapsed);
        }

        public void AddInputProvider(IGameScreenInputProvider inputProvider)
        {
            if (!_InputProviders.Contains(inputProvider))
                _InputProviders.Add(inputProvider);
        }

        public void RemoveInputProvider(IGameScreenInputProvider inputProvider)
        {
            _InputProviders.Remove(inputProvider);
        }

        public void UpdateInput()
        {
            // show logo transition screen
            if (RuntimeSettings.Instance.DeveloperMode)
                if (Input.GetKeyDown(KeyCode.ScrollLock))
                {
                    if (!TransitionLayer.Opaque)
                    {
                        TransitionLayer.LogoImageEnabled = true;
                        TransitionLayer.LoadingImageEnabled = false;
                        TransitionLayer.FadeToBlack(TimeSpan.FromSeconds(1.5f));
                    }
                    else
                    {
                        TransitionLayer.LogoImageEnabled = true;
                        TransitionLayer.LoadingImageEnabled = false;
                        TransitionLayer.FadeFromBlack(TimeSpan.FromSeconds(0.5f));
                    }
                }

            // update screeen UI
            if (CurrentScreen != null && !OverlayLayer.IsOverlayActive)
                CurrentScreen.UpdateInput();

            // update overlay UI
            for (int i = 0; i < _InputProviders.Count; i++)
                _InputProviders[i].UpdateInput();
        }

        public void SetBlur(bool? isUIBlurEnabled, bool? isCameraBlurEnabled)
        {
            if (isUIBlurEnabled.HasValue)
            {
                if (isUIBlurEnabled.Value)
                    BaseLayer.Blur(this, 25, TimeSpan.FromMilliseconds(200));
                else
                    BaseLayer.Unblur(this, TimeSpan.FromMilliseconds(200));
            }

            if (isCameraBlurEnabled.HasValue)
                PostProcessingManager.Instance.SetBlur(isCameraBlurEnabled.Value, TimeSpan.FromMilliseconds(200));
        }

        public static void UpdateCursor(CursorType cursor)
        {
            NoesisSettings settings = NoesisSettings.Get();

            switch (cursor)
            {
                case CursorType.AppStarting:
                    UnityEngine.Cursor.SetCursor(settings.AppStarting.Texture, settings.AppStarting.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Arrow:
                    UnityEngine.Cursor.SetCursor(settings.Arrow.Texture, settings.Arrow.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ArrowCD:
                    UnityEngine.Cursor.SetCursor(settings.ArrowCD.Texture, settings.ArrowCD.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Cross:
                    UnityEngine.Cursor.SetCursor(settings.Cross.Texture, settings.Cross.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Hand:
                    UnityEngine.Cursor.SetCursor(settings.Hand.Texture, settings.Hand.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Help:
                    UnityEngine.Cursor.SetCursor(settings.Help.Texture, settings.Help.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.IBeam:
                    UnityEngine.Cursor.SetCursor(settings.IBeam.Texture, settings.IBeam.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.No:
                    UnityEngine.Cursor.SetCursor(settings.No.Texture, settings.No.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.None:
                    UnityEngine.Cursor.SetCursor(settings.None.Texture, settings.None.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Pen:
                    UnityEngine.Cursor.SetCursor(settings.Pen.Texture, settings.Pen.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollAll:
                    UnityEngine.Cursor.SetCursor(settings.ScrollAll.Texture, settings.ScrollAll.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollE:
                    UnityEngine.Cursor.SetCursor(settings.ScrollE.Texture, settings.ScrollE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollN:
                    UnityEngine.Cursor.SetCursor(settings.ScrollN.Texture, settings.ScrollN.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollNE:
                    UnityEngine.Cursor.SetCursor(settings.ScrollNE.Texture, settings.ScrollNE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollNS:
                    UnityEngine.Cursor.SetCursor(settings.ScrollNS.Texture, settings.ScrollNS.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollNW:
                    UnityEngine.Cursor.SetCursor(settings.ScrollNW.Texture, settings.ScrollNW.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollS:
                    UnityEngine.Cursor.SetCursor(settings.ScrollS.Texture, settings.ScrollS.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollSE:
                    UnityEngine.Cursor.SetCursor(settings.ScrollSE.Texture, settings.ScrollSE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollSW:
                    UnityEngine.Cursor.SetCursor(settings.ScrollSW.Texture, settings.ScrollSW.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollW:
                    UnityEngine.Cursor.SetCursor(settings.ScrollW.Texture, settings.ScrollW.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.ScrollWE:
                    UnityEngine.Cursor.SetCursor(settings.ScrollWE.Texture, settings.ScrollWE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.SizeAll:
                    UnityEngine.Cursor.SetCursor(settings.SizeAll.Texture, settings.SizeAll.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.SizeNESW:
                    UnityEngine.Cursor.SetCursor(settings.SizeNESW.Texture, settings.SizeNESW.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.SizeNS:
                    UnityEngine.Cursor.SetCursor(settings.SizeNS.Texture, settings.SizeNS.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.SizeNWSE:
                    UnityEngine.Cursor.SetCursor(settings.SizeNWSE.Texture, settings.SizeNWSE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.SizeWE:
                    UnityEngine.Cursor.SetCursor(settings.SizeWE.Texture, settings.SizeWE.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.UpArrow:
                    UnityEngine.Cursor.SetCursor(settings.UpArrow.Texture, settings.UpArrow.HotSpot, CursorMode.Auto);
                    break;
                case CursorType.Wait:
                    UnityEngine.Cursor.SetCursor(settings.Wait.Texture, settings.Wait.HotSpot, CursorMode.Auto);
                    break;
            }
        }
    }
}
UIStateMachine.cs (16,648 bytes)   
UIStateMachine.xaml (3,243 bytes)   
<UserControl
    x:Class="StellarConquest.Presentation.Unity.UI.UIStateMachine"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:noesis="clr-namespace:NoesisGUIExtensions"
    xmlns:local="clr-namespace:StellarConquest.Presentation.Unity.UI"
    x:Name="_UIStateMachine"
    d:DesignWidth="1280" d:DesignHeight="720">
    <noesis:Xaml.Dependencies>
        <noesis:Dependency Source="/Assets/User Interface/Controls/Input Control/InputControl.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Controls/Transition Control/TransitionControl.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Controls/Radial Range Control/RadialRangeControl.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Screens/Login/LoginScreen.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Screens/Character Selection/CharacterSelectionScreen.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Screens/Character Creation/CharacterCreationScreen.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Screens/Game/GameScreen.xaml"/>
        <noesis:Dependency Source="/Assets/User Interface/Screens/Overlay Layer/OverlayLayer.xaml"/>
    </noesis:Xaml.Dependencies>
    <Grid>
        <Grid x:Name="_SplashScreen">
            <Grid.RowDefinitions>
                <RowDefinition Height="4*"/>
                <RowDefinition Height="4*"/>
                <RowDefinition Height="3*"/>
            </Grid.RowDefinitions>
            <Rectangle x:Name="_SplashRectangle" Grid.RowSpan="3"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{StaticResource splash1}"/>

            <Viewbox Grid.Row="2" VerticalAlignment="Top" Margin="200, -50, 100, 200">
                <Grid>
                    <Grid.Effect>
                        <DropShadowEffect BlurRadius="10" ShadowDepth="3" Opacity="1"/>
                    </Grid.Effect>
                    <Image x:Name="_LogoEllipse" Source="{StaticResource ellipse}" Width="550" Stretch="Uniform" Margin="0, 0, 0, 100"/>
                    <TextBlock x:Name="_LogoText" HorizontalAlignment="Center" FontFamily="{StaticResource Agency}" FontSize="95" VerticalAlignment="Bottom" Margin="0, 0, 0, 0" Foreground="White" Opacity="0.9" noesis:Text.CharacterSpacing="350" Text="STELLAR CONQUEST"/>
                </Grid>
            </Viewbox>
        </Grid>

        <Grid x:Name="_BaseLayer"/>
        <Rectangle x:Name="_ConnectionRectangle" Height="128" Width="128" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="9" Fill="{StaticResource connection}" IsHitTestVisible="False" Visibility="Collapsed">
            <Rectangle.Effect>
                <DropShadowEffect BlurRadius="15" ShadowDepth="0" Opacity="1"/>
            </Rectangle.Effect>
        </Rectangle>
        <local:OverlayLayer x:Name="_OverlayLayer"/>
        <local:TransitionControl x:Name="_TransitionLayer"/>
    </Grid>
</UserControl>
UIStateMachine.xaml (3,243 bytes)   
FrameworkElementExtensionMethods.cs (12,601 bytes)   
using Noesis;
using System;
using System.Diagnostics;
using StoryboardTag = System.Tuple<Noesis.Storyboard, int>;

namespace StellarConquest.Presentation.Unity.UI
{
    public static class FrameworkElementExtensionMethods
    {
        public static TimeSpan ScreenSlowFadeTime = TimeSpan.FromMilliseconds(400);
        public static TimeSpan ScreenFastFadeTime = TimeSpan.FromMilliseconds(125);

        public static void StopStoryboard(this FrameworkElement frameworkElement)
        {
            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
            }
        }

        public static Storyboard FadeOscillate(this FrameworkElement frameworkElement, FrameworkElement parent, TimeSpan duration, float fromOpacity, float toOpacity)
        {
            string key = "FadeOscillate" + frameworkElement.GetHashCode();

            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            DoubleAnimation doubleAnimation = new DoubleAnimation();
            doubleAnimation.Duration = new Duration(duration);
            doubleAnimation.From = fromOpacity;
            doubleAnimation.To = toOpacity;
            //doubleAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
            
            Storyboard storyboard = new Storyboard();

            parent.Resources.Add(key, storyboard);
            frameworkElement.Tag = new StoryboardTag(storyboard, 1);
            storyboard.RepeatBehavior = RepeatBehavior.Forever;
            storyboard.AutoReverse = true;
            storyboard.Duration = doubleAnimation.Duration;
            storyboard.Children.Add(doubleAnimation);
            Storyboard.SetTarget(doubleAnimation, frameworkElement);
            Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("Opacity"));
            storyboard.Begin();
            return storyboard;
        }

        public static void FadeInScreen(this FrameworkElement frameworkElement, FrameworkElement parent, Action completed = null)
        {
            FadeIn(frameworkElement, parent, ScreenSlowFadeTime, completed);
        }

        public static void FadeIn(this FrameworkElement frameworkElement, FrameworkElement parent, TimeSpan duration, Action completed = null)
        {
            frameworkElement.Opacity = 0;
            string key = "Fade" + frameworkElement.GetHashCode();

            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            if (parent.Resources.Contains(key))
            {
                UnityEngine.Debug.LogWarning("Resource already exists");
                return;
            }

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = new Duration(duration);
            animation.AutoReverse = false;
            animation.FillBehavior = FillBehavior.Stop;

            Storyboard storyboard = new Storyboard();
            storyboard.AutoReverse = false;
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;
            storyboard.Children.Add(animation);

            parent.Resources.Add(key, storyboard);
            frameworkElement.Tag = new StoryboardTag(storyboard, 1);

            Storyboard.SetTarget(animation, frameworkElement);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Opacity"));
            animation.From = frameworkElement.Opacity;
            animation.To = 1;
            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                frameworkElement.Tag = null;
                frameworkElement.Opacity = 1.0f;
                completed?.Invoke();
            };

            storyboard.Begin();
        }

        public static void FadeOutScreen(this FrameworkElement frameworkElement, FrameworkElement parent, Action completed = null)
        {
            FadeOut(frameworkElement, parent, ScreenFastFadeTime, completed);
        }

        public static void FadeOut(this FrameworkElement frameworkElement, FrameworkElement parent, TimeSpan duration, Action completed = null)
        {
            frameworkElement.Opacity = 1;

            string key = "Fade" + frameworkElement.GetHashCode();
            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = new Duration(duration);
            animation.AutoReverse = false;
            animation.FillBehavior = FillBehavior.Stop;

            Storyboard storyboard = new Storyboard();
            parent.Resources.Add(key, storyboard);

            frameworkElement.Tag = new StoryboardTag(storyboard, 0);
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;

            storyboard.Children.Add(animation);
            Storyboard.SetTarget(animation, frameworkElement);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Opacity"));
            animation.From = frameworkElement.Opacity;
            animation.To = 0;
            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                frameworkElement.Opacity = 0;
                frameworkElement.Tag = null;
                completed?.Invoke();

            };
            storyboard.Begin();
        }

        public static void FadeTo(this FrameworkElement frameworkElement, FrameworkElement parent, TimeSpan duration, float value, Action completed = null)
        {
            string key = "Fade" + frameworkElement.GetHashCode();

            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            if (parent.Resources.Contains(key))
            {
                UnityEngine.Debug.LogWarning("Resource already exists");
                return;
            }

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = new Duration(duration);
            animation.AutoReverse = false;
            animation.FillBehavior = FillBehavior.Stop;

            Storyboard storyboard = new Storyboard();
            storyboard.AutoReverse = false;
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;
            storyboard.Children.Add(animation);

            parent.Resources.Add(key, storyboard);
            frameworkElement.Tag = new StoryboardTag(storyboard, 1);

            Storyboard.SetTarget(animation, frameworkElement);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Opacity"));
            animation.From = frameworkElement.Opacity;
            animation.To = value;
            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                frameworkElement.Tag = null;
                frameworkElement.Opacity = value;
                completed?.Invoke();
            };

            storyboard.Begin();
        }

        public static bool IsFadeActive(this FrameworkElement frameworkElement)
        {
            return frameworkElement.Tag != null;
        }

        public static void Start(this ProgressBar progressBar, FrameworkElement parent, float startValue, float endValue, TimeSpan duration, Action completed = null)
        {
            StopStoryboard(progressBar);

            string key = "ProgressBar" + progressBar.GetHashCode();

            DoubleAnimation animation = new DoubleAnimation();
            //animation.EnableDependentAnimation = true;
            animation.Duration = new Duration(duration);
            Storyboard storyboard = new Storyboard();
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;
            storyboard.Children.Add(animation);
            Storyboard.SetTarget(animation, progressBar);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Value"));
            animation.From = startValue;
            animation.To = endValue;
            animation.FillBehavior = FillBehavior.Stop;

            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                completed?.Invoke();
            };
            progressBar.Tag = storyboard;
            parent.Resources.Add(key, storyboard);
            storyboard.Begin();
        }

        public static void Unblur(this FrameworkElement frameworkElement, FrameworkElement parent, TimeSpan duration, Action completed = null)
        {
            if (!(frameworkElement.Effect is BlurEffect blurEffect))
                return;

            string key = "Blur" + frameworkElement.GetHashCode();

            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            float from = blurEffect.Radius;

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = new Duration(duration);
            animation.AutoReverse = false;
            animation.FillBehavior = FillBehavior.Stop;

            Storyboard storyboard = new Storyboard();
            storyboard.AutoReverse = false;
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;
            storyboard.Children.Add(animation);

            parent.Resources.Add(key, storyboard);
            frameworkElement.Tag = new StoryboardTag(storyboard, 1);

            Storyboard.SetTarget(animation, frameworkElement);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Effect.Radius"));
            animation.From = from;
            animation.To = 0;
            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                frameworkElement.Tag = null;
                blurEffect.Radius = 0;
                frameworkElement.Effect = null;
                completed?.Invoke();
            };

            storyboard.Begin();
        }

        public static void Blur(this FrameworkElement frameworkElement, FrameworkElement parent, float radius, TimeSpan duration, Action completed = null)
        {
            if (!(frameworkElement.Effect is BlurEffect blurEffect))
            {
                blurEffect = new BlurEffect();
                frameworkElement.Effect = blurEffect;
            }

            string key = "Blur" + frameworkElement.GetHashCode();

            if (frameworkElement.Tag is StoryboardTag tag)
            {
                tag.Item1.Stop();
                parent.Resources.Remove(key);
            }

            float from = blurEffect.Radius;

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = new Duration(duration);
            animation.AutoReverse = false;
            animation.FillBehavior = FillBehavior.Stop;

            Storyboard storyboard = new Storyboard();
            storyboard.AutoReverse = false;
            storyboard.Duration = animation.Duration;
            storyboard.FillBehavior = FillBehavior.Stop;
            storyboard.Children.Add(animation);

            parent.Resources.Add(key, storyboard);
            frameworkElement.Tag = new StoryboardTag(storyboard, 1);

            Storyboard.SetTarget(animation, frameworkElement);
            Storyboard.SetTargetProperty(animation, new PropertyPath("Effect.Radius"));
            animation.From = from;
            animation.To = radius;
            storyboard.Completed += (sender2, e2) =>
            {
                parent.Resources.Remove(key);
                frameworkElement.Tag = null;
                blurEffect.Radius = radius;
                completed?.Invoke();
            };

            storyboard.Begin();
        }

    }
}
ResourcesTheme.xaml (55,794 bytes)   
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:noesis="clr-namespace:NoesisGUIExtensions"
  xmlns:local="clr-namespace:StellarConquest.Presentation.Unity.UI"
  >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ResourcesImages.xaml"/>
        <ResourceDictionary Source="ResourcesCommon.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!-- Screen -->
    <Style x:Key="Screen" TargetType="{x:Type Grid}">
        <Setter Property="Margin" Value="20, 105, 20, 20"/>
    </Style>

    <!-- Button Template -->
    <ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type ButtonBase}">
        <Grid x:Name="TemplateRoot" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
                <ScaleTransform />
            </Grid.RenderTransform>
            <Grid Background="{TemplateBinding Background}">
                <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Grid>
            <Border x:Name="Bg" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0"/>
        </Grid>
        <!--<ControlTemplate.Resources>
            <Storyboard x:Key="Anim.Press">
                <DoubleAnimation Storyboard.TargetName="TemplateRoot" Storyboard.TargetProperty="RenderTransform.ScaleX" To="0.99" Duration="0:0:0.1" DecelerationRatio="0.25"/>
                <DoubleAnimation Storyboard.TargetName="TemplateRoot" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0.99" Duration="0:0:0.1" DecelerationRatio="0.25"/>
            </Storyboard>
            <Storyboard x:Key="Anim.Release">
                <DoubleAnimation Storyboard.TargetName="TemplateRoot" Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2" DecelerationRatio="1"/>
                <DoubleAnimation Storyboard.TargetName="TemplateRoot" Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2" DecelerationRatio="1"/>
            </Storyboard>
        </ControlTemplate.Resources>-->
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Normal}"/>
                    <Setter Property="Background" Value="{DynamicResource Brush.Background.Normal}"/>
                    <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}"/>
                    <Setter Property="BorderThickness" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Pressed}"/>
                    <Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}"/>
                    <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}"/>
                    <Setter Property="BorderThickness" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <!--<Condition Property="IsMouseOver" Value="False"/>-->
                    <Condition Property="IsFocused" Value="True"/>
                    <!--<Condition Property="IsPressed" Value="False"/>-->
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Focus}"/>
                    <Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}"/>
                    <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}"/>
                    <Setter Property="BorderThickness" Value="2"/>
                </MultiTrigger.Setters>
                <MultiTrigger.EnterActions>
                    <BeginStoryboard x:Name="PART_Focus_Storyboard">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Opacity)" From="1.0" To="0.4" Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True"/>
                        </Storyboard>
                    </BeginStoryboard>
                </MultiTrigger.EnterActions>
                <MultiTrigger.ExitActions>
                    <StopStoryboard BeginStoryboardName="PART_Focus_Storyboard"/>
                </MultiTrigger.ExitActions>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                </MultiTrigger.Conditions>
                <!--<Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource Anim.Press}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource Anim.Release}"/>
                </Trigger.ExitActions>-->
                <MultiTrigger.Setters>
                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Pressed}"/>
                    <Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}"/>
                    <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}"/>
                    <Setter Property="BorderThickness" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Opacity" Value="0.4"/>
                    <Setter Property="BorderBrush" Value="{DynamicResource Border.Background.Disabled}"/>
                    <Setter Property="Background" Value="{DynamicResource Brush.Border.Disabled}"/>
                    <Setter Property="Foreground" Value="{DynamicResource Brush.Foreground.Disabled}"/>
                    <Setter Property="BorderThickness" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--Button Style-->
    <Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Padding" Value="6,4"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <!--<Setter Property="FocusVisualStyle" Value="{x:Null}"/>-->
        <Setter Property="Template" Value="{StaticResource ButtonTemplate}"/>

        <Setter Property="FontFamily" Value="{StaticResource Trebuchet MS}"/>
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
        <Setter Property="Padding" Value="8,6" />
        <Setter Property="noesis:Text.Stroke" Value="#EE000000" />
        <Setter Property="noesis:Text.StrokeThickness" Value="3" />
    </Style>


    <ControlTemplate x:Key="DialogButtonTemplate" TargetType="{x:Type Button}">
        <Border x:Name="Bd"
            Background="Transparent"
            BorderBrush="Transparent"
            BorderThickness="0">
            <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="Center"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="ContextMenuButton" TargetType="{x:Type Button}">
        <Setter Property="Padding" Value="6,4"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template" Value="{StaticResource ButtonTemplate}"/>
        <Setter Property="FontFamily" Value="{StaticResource Trebuchet MS}"/>
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
    </Style>

    <!-- Standard Button -->
    <ControlTemplate x:Key="StandardButtonTemplate" TargetType="Button">
        <Grid x:Name="PART_Grid" noesis:Element.PPAAMode="Disabled">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="35"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="35"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="70"/>
            </Grid.RowDefinitions>

            <Rectangle x:Name="PART_Image_L" Grid.Column="0" Fill="{StaticResource buttonup_l}"/>
            <Rectangle x:Name="PART_Image_M" Grid.Column="1" Fill="{StaticResource buttonup_m}"/>
            <Rectangle x:Name="PART_Image_R" Grid.Column="2" Fill="{StaticResource buttonup_r}"/>

            <ContentPresenter x:Name="PART_ContentPresenter" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{DynamicResource _ContentPresenterMargin}" Opacity="1" RenderTransformOrigin="0.5, 0.5"/>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Image_L" Property="Fill" Value="{StaticResource buttonup_l}"/>
                    <Setter TargetName="PART_Image_M" Property="Fill" Value="{StaticResource buttonup_m}"/>
                    <Setter TargetName="PART_Image_R" Property="Fill" Value="{StaticResource buttonup_r}"/>
                    <Setter TargetName="PART_Image_L" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_M" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_R" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.75"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Image_L" Property="Fill" Value="{StaticResource buttonover_l}"/>
                    <Setter TargetName="PART_Image_M" Property="Fill" Value="{StaticResource buttonover_m}"/>
                    <Setter TargetName="PART_Image_R" Property="Fill" Value="{StaticResource buttonover_r}"/>
                    <Setter TargetName="PART_Image_L" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_M" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_R" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Image_L" Property="Fill" Value="{StaticResource buttonfocused_l}"/>
                    <Setter TargetName="PART_Image_M" Property="Fill" Value="{StaticResource buttonfocused_m}"/>
                    <Setter TargetName="PART_Image_R" Property="Fill" Value="{StaticResource buttonfocused_r}"/>
                    <Setter TargetName="PART_Image_L" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_M" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_R" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
                <MultiTrigger.EnterActions>
                    <BeginStoryboard x:Name="PART_Focus_Storyboard">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="PART_Image_L" Storyboard.TargetProperty="(Rectangle.Opacity)" From="1.0" To="0.5" Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True"/>
                            <DoubleAnimation Storyboard.TargetName="PART_Image_M" Storyboard.TargetProperty="(Rectangle.Opacity)" From="1.0" To="0.5" Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True"/>
                            <DoubleAnimation Storyboard.TargetName="PART_Image_R" Storyboard.TargetProperty="(Rectangle.Opacity)" From="1.0" To="0.5" Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True"/>
                        </Storyboard>
                    </BeginStoryboard>
                </MultiTrigger.EnterActions>
                <MultiTrigger.ExitActions>
                    <StopStoryboard BeginStoryboardName="PART_Focus_Storyboard"/>
                </MultiTrigger.ExitActions>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Image_L" Property="Fill" Value="{StaticResource buttondown_l}"/>
                    <Setter TargetName="PART_Image_M" Property="Fill" Value="{StaticResource buttondown_m}"/>
                    <Setter TargetName="PART_Image_R" Property="Fill" Value="{StaticResource buttondown_r}"/>
                    <Setter TargetName="PART_Image_L" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_M" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_R" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.9"/>
                    <Setter TargetName="PART_ContentPresenter" Property="RenderTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Image_L" Property="Fill" Value="{StaticResource buttondisabled_l}"/>
                    <Setter TargetName="PART_Image_M" Property="Fill" Value="{StaticResource buttondisabled_m}"/>
                    <Setter TargetName="PART_Image_R" Property="Fill" Value="{StaticResource buttondisabled_r}"/>
                    <Setter TargetName="PART_Image_L" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_M" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_Image_R" Property="Opacity" Value="1"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.45"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="StandardButton" TargetType="{x:Type Button}">
        <Setter Property="Template" Value="{StaticResource StandardButtonTemplate}"/>
        <Setter Property="FontFamily" Value="{StaticResource Teko}"/>
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="FontSize" Value="30"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="noesis:Text.Stroke" Value="#4400ccff" />
        <Setter Property="noesis:Text.StrokeThickness" Value="2" />
    </Style>

    <!-- Image Button Templates and Styles -->
    <ControlTemplate x:Key="ImageButtonTemplate" TargetType="Button">
        <Grid x:Name="PART_Grid" RenderTransformOrigin="0.5, 0.5">
            <Rectangle x:Name="PART_Rectangle" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Rectangle" Property="Fill" Value="{DynamicResource _UpImage}"/>
                    <Setter TargetName="PART_Rectangle" Property="Opacity" Value="0.5"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Rectangle" Property="Fill" Value="{DynamicResource _OverImage}"/>
                    <Setter TargetName="PART_Rectangle" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Rectangle" Property="Fill" Value="{DynamicResource _FocusedImage}"/>
                    <Setter TargetName="PART_Rectangle" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
                <MultiTrigger.EnterActions>
                    <BeginStoryboard x:Name="PART_Focus_Storyboard">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="PART_Rectangle" Storyboard.TargetProperty="(Rectangle.Opacity)" From="1.0" To="0.5" Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True"/>
                        </Storyboard>
                    </BeginStoryboard>
                </MultiTrigger.EnterActions>
                <MultiTrigger.ExitActions>
                    <StopStoryboard BeginStoryboardName="PART_Focus_Storyboard"/>
                </MultiTrigger.ExitActions>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Rectangle" Property="Fill" Value="{DynamicResource _DownImage}"/>
                    <Setter TargetName="PART_Rectangle" Property="Opacity" Value="0.9"/>
                    <Setter TargetName="PART_Grid" Property="RenderTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Rectangle" Property="Fill" Value="{DynamicResource _DisabledImage}"/>
                    <Setter TargetName="PART_Rectangle" Property="Opacity" Value="0.45"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="WebsiteButtonStyle" TargetType="{x:Type Button}">
        <Style.Resources>
            <ImageBrush x:Key="_UpImage" ImageSource="Images/login/website_x2.png"/>
            <ImageBrush x:Key="_DownImage" ImageSource="Images/login/website_x2.png"/>
            <ImageBrush x:Key="_OverImage" ImageSource="Images/login/website_x2.png"/>
            <ImageBrush x:Key="_FocusedImage" ImageSource="Images/login/website_x2.png"/>
        </Style.Resources>
        <Setter Property="Width" Value="53"/>
        <Setter Property="Height" Value="53"/>
        <Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
    </Style>

    <Style x:Key="TwitterButtonStyle" TargetType="{x:Type Button}">
        <Style.Resources>
            <ImageBrush x:Key="_UpImage" ImageSource="Images/login/twitter_x2.png"/>
            <ImageBrush x:Key="_DownImage" ImageSource="Images/login/twitter_x2.png"/>
            <ImageBrush x:Key="_OverImage" ImageSource="Images/login/twitter_x2.png"/>
            <ImageBrush x:Key="_FocusedImage" ImageSource="Images/login/twitter_x2.png"/>
        </Style.Resources>
        <Setter Property="Width" Value="53"/>
        <Setter Property="Height" Value="53"/>
        <Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
    </Style>

    <Style x:Key="DiscordButtonStyle" TargetType="{x:Type Button}">
        <Style.Resources>
            <ImageBrush x:Key="_UpImage" ImageSource="Images/login/discord_x2.png"/>
            <ImageBrush x:Key="_DownImage" ImageSource="Images/login/discord_x2.png"/>
            <ImageBrush x:Key="_OverImage" ImageSource="Images/login/discord_x2.png"/>
            <ImageBrush x:Key="_FocusedImage" ImageSource="Images/login/discord_x2.png"/>
        </Style.Resources>
        <Setter Property="Width" Value="53"/>
        <Setter Property="Height" Value="53"/>
        <Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
    </Style>

    <Style x:Key="DownArrowButtonStyle" TargetType="{x:Type Button}">
        <Style.Resources>
            <ImageBrush x:Key="_UpImage" ImageSource="Images/buttons/downarrow.png"/>
            <ImageBrush x:Key="_DownImage" ImageSource="Images/buttons/downarrow.png"/>
            <ImageBrush x:Key="_OverImage" ImageSource="Images/buttons/downarrow.png"/>
            <ImageBrush x:Key="_FocusedImage" ImageSource="Images/buttons/downarrow.png"/>
            <ImageBrush x:Key="_DisabledImage" ImageSource="Images/buttons/downarrow.png"/>
        </Style.Resources>
        <Setter Property="Width" Value="53"/>
        <Setter Property="Height" Value="53"/>
        <Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
    </Style>

    <!-- Item Template and Styles (Inventory) -->
    <ControlTemplate x:Key="ItemButtonTemplate" TargetType="Button">
        <Grid>
            <Border x:Name="PART_Background"
                        Background="{TemplateBinding Background}"
                        BorderBrush="Transparent"
                        BorderThickness="0"
                        Padding="0"
                        CornerRadius="0"
                        Margin="0, 0, 0, 0" >
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/>
                    <Rectangle x:Name="PART_DisabledRectangle" Stretch="Fill"/>
                </Grid>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="PART_Background" Property="Background" Value="{StaticResource SelectionBrush}"/>
            </Trigger>

            <!-- mouse behavior -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsKeyboardFocused" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="#00000000"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="IsMouseOver" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="{StaticResource SelectionBrush}"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <!-- gamepad behavior -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsKeyboardFocused" Value="True"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Background" Property="Background" Value="{StaticResource SelectionBrush}"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Build Button Primary -->
    <ControlTemplate x:Key="BuildButtonPrimaryTemplate" TargetType="Button">
        <Grid>
            <Rectangle x:Name="PART_Up" Grid.Column="0" Fill="{StaticResource BlueUp}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Down" Grid.Column="1" Fill="{StaticResource BlueDown}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Over" Grid.Column="2" Fill="{StaticResource BlueOver}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Disabled" Grid.Column="2" Fill="{StaticResource BlueDisabled}" Visibility="Collapsed"/>
            <ContentPresenter x:Name="PART_ContentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="1" RenderTransformOrigin="0.5, 0.5"/>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.75"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.9"/>
                    <Setter TargetName="PART_ContentPresenter" Property="RenderTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.45"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="BuildButtonPrimary" TargetType="{x:Type Button}">
        <Setter Property="Template" Value="{StaticResource BuildButtonPrimaryTemplate}"/>
    </Style>

    <!-- Build Button Secondary -->
    <ControlTemplate x:Key="BuildButtonSecondaryTemplate" TargetType="Button">
        <Grid>
            <Rectangle x:Name="PART_Up" Grid.Column="0" Fill="{StaticResource GreenUp}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Down" Grid.Column="1" Fill="{StaticResource GreenDown}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Over" Grid.Column="2" Fill="{StaticResource GreenOver}" Visibility="Collapsed"/>
            <Rectangle x:Name="PART_Disabled" Grid.Column="2" Fill="{StaticResource GreenDisabled}" Visibility="Collapsed"/>
            <ContentPresenter x:Name="PART_ContentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="1" RenderTransformOrigin="0.5, 0.5"/>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.75"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsPressed" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.9"/>
                    <Setter TargetName="PART_ContentPresenter" Property="RenderTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Up" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Down" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Over" Property="Visibility" Value="Collapsed"/>
                    <Setter TargetName="PART_Disabled" Property="Visibility" Value="Visible"/>
                    <Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="0.45"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="BuildButtonSecondary" TargetType="{x:Type Button}">
        <Setter Property="Template" Value="{StaticResource BuildButtonSecondaryTemplate}"/>
    </Style>

    <!-- Item Style -->
    <Style x:Key="ItemStyle" TargetType="{x:Type Button}">
        <!-- does this work, because other styles require 'button' -->
        <Setter Property="Template" Value="{StaticResource ItemButtonTemplate}"/>
        <Setter Property="FontSize" Value="23"/>
        <Setter Property="Foreground" Value="White"/>
    </Style>

    <!-- ToolTip Style -->
    <!--<Style x:Key="ToolTip" TargetType="{x:Type ToolTip}" BasedOn="{StaticResource DefaultControlStyle}">-->
    <Style x:Key="ToolTip" TargetType="{x:Type ToolTip}">
        <Setter Property="Background" Value="#EE333333"/>
        <Setter Property="BorderBrush" Value="#CC666666"/>
        <!--<Setter Property="Foreground" Value="{DynamicResource Brush.Border.Pressed}"/>-->
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="Padding" Value="6,4"/>
        <Setter Property="Placement" Value="Mouse"/>
        <Setter Property="VerticalOffset" Value="21"/>
        <!-- Cursor Height -->
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="noesis:Text.Stroke" Value="#00000000" />
        <Setter Property="noesis:Text.StrokeThickness" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border x:Name="Border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}"
                        CornerRadius="1">
                        <ContentPresenter
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- Button Style -->
    <ControlTemplate x:Key="OptionButtonTemplate" TargetType="{x:Type ButtonBase}">
        <Border
            Background="{TemplateBinding Background}"
            BorderBrush="{TemplateBinding BorderBrush}"
            BorderThickness="{TemplateBinding BorderThickness}"
            Padding="{TemplateBinding Padding}"
            CornerRadius="1">
            <ContentPresenter
                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Pressed}"/>
                <Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Border.Pressed}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Pressed}"/>
                <Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Border.Pressed}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Focus}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{DynamicResource Border.Background.Disabled}"/>
                <Setter Property="Background" Value="{DynamicResource Brush.Border.Disabled}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Foreground.Disabled}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Submenu -->
    <DataTemplate x:Key="HeaderTextDataTemplate">
        <TextBlock Text="{Binding}" Style="{StaticResource HeaderStyleTextBlock}"/>
    </DataTemplate>

    <DataTemplate x:Key="HeaderContentControlDataTemplate">
        <ContentControl Content="{Binding}" Style="{StaticResource HeaderStyleContentControl}"/>
    </DataTemplate>

    <DataTemplate x:Key="HeaderImageTextDataTemplate">
        <StackPanel Orientation="Horizontal">
            <Image/>
            <TextBlock Text="{Binding}" FontFamily="{StaticResource Trebuchet MS}" Foreground="{StaticResource HeadingPrimaryFontBrush}" FontSize="{StaticResource Heading3FontSize}"/>
        </StackPanel>
    </DataTemplate>


    <Style x:Key="HeaderedContentStyle" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="HeaderTemplate" Value="{StaticResource HeaderTextDataTemplate}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="FontFamily" Value="{StaticResource Trebuchet MS}"/>
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}" />
        <Setter Property="Margin" Value="0, 0, 0, 0" />
        <Setter Property="noesis:Text.Stroke" Value="#EE000000" />
        <Setter Property="noesis:Text.StrokeThickness" Value="3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}" >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="55"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="55"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="55"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="55"/>
                        </Grid.RowDefinitions>

                        <Rectangle Grid.Column="0" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_TL}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_T}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_TR}" noesis:Element.PPAAMode="Disabled"/>

                        <Rectangle Grid.Column="0" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_ML}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_M}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_MR}" noesis:Element.PPAAMode="Disabled"/>

                        <Rectangle Grid.Column="0" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BL}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_B}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BR}" noesis:Element.PPAAMode="Disabled"/>

                        <ContentPresenter ContentSource="Header" Grid.ColumnSpan="3" Grid.Row="0" Margin="28, 0, 0, -2" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
                        <ContentPresenter ContentSource="Content" Grid.ColumnSpan="3" Grid.Row="1" Grid.RowSpan="2" Margin="29, 3, 29, 15" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HeaderedContentStyleTight" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="HeaderTemplate" Value="{StaticResource HeaderTextDataTemplate}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="FontFamily" Value="{StaticResource Trebuchet MS}"/>
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}" />
        <Setter Property="noesis:Text.Stroke" Value="#EE000000" />
        <Setter Property="noesis:Text.StrokeThickness" Value="3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}" >
                    <Grid MinHeight="50" MinWidth="50">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="55"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="55"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="55"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="55"/>
                        </Grid.RowDefinitions>

                        <Rectangle Grid.Column="0" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_TL}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_T}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_TR}" noesis:Element.PPAAMode="Disabled"/>

                        <Rectangle Grid.Column="0" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_ML}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_M}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_MR}" noesis:Element.PPAAMode="Disabled"/>

                        <Rectangle Grid.Column="0" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BL}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_B}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BR}" noesis:Element.PPAAMode="Disabled"/>

                        <ContentPresenter ContentSource="Header" Grid.ColumnSpan="3" Grid.Row="0" Margin="28, 0, 0, 0" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
                        <ContentPresenter ContentSource="Content" Grid.ColumnSpan="3" Grid.Row="1" Grid.RowSpan="2" Margin="8, -3, 9, 8"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="UnheaderedContentStyle" TargetType="{x:Type ContentControl}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="FontFamily" Value="{StaticResource Trebuchet MS}"/>
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource HeadingPrimaryFontBrush}" />
        <Setter Property="noesis:Text.Stroke" Value="#EE000000" />
        <Setter Property="noesis:Text.StrokeThickness" Value="3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContentControl}" >
                    <Grid MinHeight="50" MinWidth="50">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="55"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="55"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="55"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="55"/>
                        </Grid.RowDefinitions>

                        <Rectangle Grid.Column="0" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_BL}" RenderTransformOrigin="0.5, 0.5" noesis:Element.PPAAMode="Disabled">
                            <Rectangle.RenderTransform>
                                <ScaleTransform ScaleY="-1"/>
                            </Rectangle.RenderTransform>
                        </Rectangle>
                        <Rectangle Grid.Column="1" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_B}" RenderTransformOrigin="0.5, 0.5" noesis:Element.PPAAMode="Disabled">
                            <Rectangle.RenderTransform>
                                <ScaleTransform ScaleY="-1"/>
                            </Rectangle.RenderTransform>
                        </Rectangle>
                        <Rectangle Grid.Column="2" Grid.Row="0" Fill="{StaticResource SubmenuBorder_0_BR}" RenderTransformOrigin="0.5, 0.5" noesis:Element.PPAAMode="Disabled">
                            <Rectangle.RenderTransform>
                                <ScaleTransform ScaleY="-1"/>
                            </Rectangle.RenderTransform>
                        </Rectangle>

                        <Rectangle Grid.Column="0" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_ML}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_M}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="1" Fill="{StaticResource SubmenuBorder_0_MR}" noesis:Element.PPAAMode="Disabled"/>

                        <Rectangle Grid.Column="0" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BL}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="1" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_B}" noesis:Element.PPAAMode="Disabled"/>
                        <Rectangle Grid.Column="2" Grid.Row="2" Fill="{StaticResource SubmenuBorder_0_BR}" noesis:Element.PPAAMode="Disabled"/>

                        <ContentPresenter ContentSource="Content" Grid.ColumnSpan="3" Grid.Row="0" Grid.RowSpan="3" Margin="29, 10, 29, 10"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:RadialRangeControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadialRangeControl">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Viewbox>
                            <Grid x:Name="PART_Container"
                                  MinWidth="200"
                                  MinHeight="100">

                                <!-- Scale -->
                                <Grid HorizontalAlignment="Center">
                                    <Path Name="PART_Scale"
                                      VerticalAlignment="Center" 
                                      Stroke="{TemplateBinding ScaleBrush}"
                                      StrokeThickness="{TemplateBinding ScaleWidth}"
                                      StrokeStartLineCap="{TemplateBinding ScaleStartCap}"
                                      StrokeEndLineCap="{TemplateBinding ScaleEndCap}"
                                      />

                                    <!-- Range -->
                                    <Path Name="PART_Value"
                                      VerticalAlignment="Center" 
                                      Stroke="{TemplateBinding ValueBrush}"
                                      StrokeThickness="{TemplateBinding ScaleWidth}"
                                      StrokeStartLineCap="{TemplateBinding ValueStartCap}"
                                      StrokeEndLineCap="{TemplateBinding ValueStartCap}"/>

                                </Grid>

                                <!-- Value -->
                                <TextBlock Name="PART_Text"
                                    VerticalAlignment="Center" 
                                    HorizontalAlignment="{TemplateBinding TextAlignment}"
                                    Foreground="{TemplateBinding TextBrush}"
                                    Margin="{TemplateBinding TextMargin}"
                                    FontSize="20"
                                    FontWeight="SemiBold"
                                    TextAlignment="Left"
                                    Opacity="1.0"
                                    />
                            </Grid>
                        </Viewbox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
ResourcesTheme.xaml (55,794 bytes)   
sfernandez

sfernandez

2023-04-25 12:30

manager   ~0008461

We fixed an issue related to C#<->C++ proxies that may be related, so before digging any further I want to check it.
Could you please apply the patch provided in this note: https://www.noesisengine.com/bugs/view.php?id=2424#c8434 (just overwrite the Extend.cs with the one provided there).
Please let me know if that solves your crashes.

Issue History

Date Modified Username Field Change
2023-04-23 20:37 stonstad New Issue
2023-04-23 20:37 stonstad File Added: Crash_2023-04-23_183307227.zip
2023-04-23 20:38 stonstad Steps to Reproduce Updated
2023-04-23 20:44 stonstad Note Added: 0008444
2023-04-23 20:44 stonstad File Added: Crash_2023-04-23_184339223.zip
2023-04-23 20:48 stonstad Note Added: 0008445
2023-04-23 20:48 stonstad File Added: Crash_2023-04-23_184707207.zip
2023-04-23 20:53 stonstad Note Added: 0008446
2023-04-23 20:53 stonstad Note Edited: 0008446
2023-04-24 10:46 sfernandez Relationship added duplicate of 0002571
2023-04-24 10:47 sfernandez Assigned To => sfernandez
2023-04-24 10:47 sfernandez Status new => assigned
2023-04-24 10:47 sfernandez Product Version 3.2 => 3.2.0
2023-04-24 10:47 sfernandez Target Version => 3.2.1
2023-04-24 10:49 sfernandez Status assigned => feedback
2023-04-24 10:49 sfernandez Note Added: 0008450
2023-04-24 18:10 stonstad Note Added: 0008457
2023-04-24 18:10 stonstad File Added: UIStateMachine.cs
2023-04-24 18:10 stonstad File Added: UIStateMachine.xaml
2023-04-24 18:10 stonstad File Added: FrameworkElementExtensionMethods.cs
2023-04-24 18:10 stonstad File Added: ResourcesTheme.xaml
2023-04-24 18:10 stonstad Status feedback => assigned
2023-04-24 18:10 stonstad Note Edited: 0008457
2023-04-25 12:30 sfernandez Status assigned => feedback
2023-04-25 12:30 sfernandez Note Added: 0008461
2023-05-10 00:13 jsantos Target Version 3.2.1 => 3.2.2
2023-06-06 17:37 sfernandez Relationship added duplicate of 0002611
2023-06-06 17:37 sfernandez Status feedback => closed
2023-06-06 17:37 sfernandez Resolution open => duplicate