aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingErrorView.xaml
blob: 7682ba4ceebf873da159cff2ea838206885d4a83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<UserControl x:Class="Tango.PPC.UI.Views.LoadingErrorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
             xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels"
             xmlns:global="clr-namespace:Tango.PPC.UI"
             xmlns:local="clr-namespace:Tango.PPC.UI.Views"
             mc:Ignorable="d" 
             d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LoadingErrorViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingErrorViewVM}">
    <Grid>
        <DockPanel Margin="20 60 20 20">
            <StackPanel DockPanel.Dock="Top">
                <Image Source="../Images/warning-red.png" Width="300" Stretch="Uniform" HorizontalAlignment="Center"></Image>
                <TextBlock HorizontalAlignment="Center" Margin="0 40 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Application Loading Error</TextBlock>
                <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoTitleFontSize}">The application has failed to load properly due to the following reason.</TextBlock>
                <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" TextAlignment="Center" Margin="100 20 100 0" TextWrapping="Wrap" Text="{Binding Error}"></TextBlock>
            </StackPanel>
            
            <Grid>
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320">
                    <touch:TouchButton Command="{Binding RestartCommand}" Padding="0 30" CornerRadius="40">RESTART</touch:TouchButton>
                </StackPanel>
            </Grid>
        </DockPanel>
    </Grid>
</UserControl>
ighlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using RealTimeGraphEx.Models;
using RealTimeGraphEx.Enums;

namespace RealTimeGraphEx.FastGraphs
{
    public class RealTimeGraphExEllipseScroll : RealTimeGraphExLineScroll
    {
        #region Cross Thread Fields

        protected OpacityTypeEnum _opacityAnimationType;
        protected int _ellipseXRadius;
        protected int _ellipseYRadius;

        #endregion

        #region Constructors

        public RealTimeGraphExEllipseScroll()
            : base()
        {

        }

        #endregion

        #region Properties

        public OpacityTypeEnum OpacityAnimationType
        {
            get { return (OpacityTypeEnum)GetValue(OpacityAnimationTypeProperty); }
            set { SetValue(OpacityAnimationTypeProperty, value); }
        }
        public static readonly DependencyProperty OpacityAnimationTypeProperty =
            DependencyProperty.Register("OpacityAnimationType", typeof(OpacityTypeEnum), typeof(RealTimeGraphExEllipseScroll), new PropertyMetadata(OpacityTypeEnum.None, new PropertyChangedCallback(CrossModelChanged)));



        public int EllipseXRadius
        {
            get { return (int)GetValue(EllipseXRadiusProperty); }
            set { SetValue(EllipseXRadiusProperty, value); }
        }
        public static readonly DependencyProperty EllipseXRadiusProperty =
            DependencyProperty.Register("EllipseXRadius", typeof(int), typeof(RealTimeGraphExEllipseScroll), new PropertyMetadata(5));



        public int EllipseYRadius
        {
            get { return (int)GetValue(EllipseYRadiusProperty); }
            set { SetValue(EllipseYRadiusProperty, value); }
        }
        public static readonly DependencyProperty EllipseYRadiusProperty =
            DependencyProperty.Register("EllipseYRadius", typeof(int), typeof(RealTimeGraphExEllipseScroll), new PropertyMetadata(5));




        #endregion

        #region Override Methods

        protected override void OnSetCrossThreadFields()
        {
            base.OnSetCrossThreadFields();

            this.Dispatcher.Invoke(() =>
            {

                _opacityAnimationType = OpacityAnimationType;
                _ellipseXRadius = EllipseXRadius;
                _ellipseYRadius = EllipseYRadius;

            }, System.Windows.Threading.DispatcherPriority.Send);
        }

        /// <summary>
        /// Draw the actual polygon on the image.
        /// </summary>
        /// <param name="bmp"></param>
        protected override void OnDrawVisuals(WriteableBitmap bmp)
        {
            Color stroke = _graphController.dataSeries.GetStrokeColor() != null ? _graphController.dataSeries.GetStrokeColor().Value : _stroke;
            Color fill = _graphController.dataSeries.GetFillColor() != null ? _graphController.dataSeries.GetFillColor().Value : _fill;

            double scale = GetPolygonScaleFactor();

            for (int i = 0; i < graphPolygon.Count; i++)
            {
                var point = graphPolygon[i];

                Color processedLineColor = stroke;
                Color processedFillColor = fill;

                if (_opacityAnimationType == OpacityTypeEnum.FadeOut)
                {
                    byte opacity = (byte)((((i) * 100 / _maxPoints) * 255) / 100);

                    processedLineColor.A = opacity;
                    processedFillColor.A = opacity;
                }

                if (_fillGraph)
                {
                    bmp.FillEllipseCentered((int)(i * scale), (int)ConvertYToImageYFliped(point), _ellipseXRadius, _ellipseYRadius, processedFillColor);
                }

                bmp.DrawEllipseCentered((int)(i * scale), (int)ConvertYToImageYFliped(point), _ellipseXRadius, _ellipseYRadius, processedLineColor);
            }
        }

        #endregion
    }
}