Пример #1
0
 private void ItemProgress_DataContextChanged(Windows.UI.Xaml.FrameworkElement sender, Windows.UI.Xaml.DataContextChangedEventArgs args)
 {
     if (args.NewValue is UINode node)
     {
         ViewModel.Initialize(node);
     }
 }
Пример #2
0
 private void ModelShipChangedEventHandler(object sender, ShipChangedEventArgs e)
 {
     if (!e.Killed)
     {
         if (e.ShipUpdated is Invader)
         {
             Invader invader = e.ShipUpdated as Invader;
             if (!_invaders.ContainsKey(invader))
             {
                 FrameworkElement invaderControl = InvadersHelper.InvaderControlFactory(invader, Scale);
                 _invaders[invader] = invaderControl;
                 _sprites.Add(invaderControl);
             }
             else
             {
                 FrameworkElement invaderControl = _invaders[invader];
                 InvadersHelper.MoveElement(invaderControl, invader.Location.X, Scale, invader.Location.Y * Scale);
                 InvadersHelper.ResizeElement(invaderControl, invader.Size.Width * Scale, invader.Size.Height * Scale);
             }
         }
         else if (e.ShipUpdated is Player)
         {
             if (_playerFlashing)
             {
                 AnimatedImage playerImage = _playControl as AnimatedImage;
                 _playerFlashing = false;
             }
             if (_playControl == null)
             {
                 FrameworkElement playerControl = InvadersHelper.PlayerControlFactory(player, Scale);
                 _sprites.Add(playerControl);
             }
         }
     }
 }
Пример #3
0
 public UwpPinchEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs args)
 {
     ViewPosition = element.GetXfViewFrame();
     Touches      = new Xamarin.Forms.Point[] { args.Position.ToXfPoint() };
     DeltaScale   = args.Delta.Scale;
     TotalScale   = args.Cumulative.Scale;
 }
Пример #4
0
        internal VNode(Node node, FrameworkElement frameworkElementOfNodeForLabelOfLabel,
                       Func <Edge, VEdge> funcFromDrawingEdgeToVEdge, Func <double> pathStrokeThicknessFunc)
        {
            PathStrokeThicknessFunc = pathStrokeThicknessFunc;
            Node = node;
            FrameworkElementOfNodeForLabel = frameworkElementOfNodeForLabelOfLabel;

            _funcFromDrawingEdgeToVEdge = funcFromDrawingEdgeToVEdge;

            CreateNodeBoundaryPath();
            if (FrameworkElementOfNodeForLabel != null)
            {
                FrameworkElementOfNodeForLabel.Tag = this; //get a backpointer to the VNode
                Common.PositionFrameworkElement(FrameworkElementOfNodeForLabel, node.GeometryNode.Center, 1);
                Panel.SetZIndex(FrameworkElementOfNodeForLabel, Panel.GetZIndex(BoundaryPath) + 1);
            }
            SetupSubgraphDrawing();
            Node.Attr.VisualsChanged += (a, b) => Invalidate();
            Node.IsVisibleChanged    += obj => {
                foreach (var frameworkElement in FrameworkElements)
                {
                    frameworkElement.Opacity = Node.IsVisible ? 1 : 0;
                }
            };
        }
 private void ContentDialog_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
 {
     this.textBlockHint.Text           = "";
     this.progressBar.Visibility       = Windows.UI.Xaml.Visibility.Collapsed;
     this.textBoxUserName.Text         = "";
     this.passwordBoxPassword.Password = "";
 }
 //PointerRoutedEventArgs
 public UwpLongPressEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.PointerRoutedEventArgs args, long elapsedMilliseconds)
 {
     ViewPosition = element.GetXfViewFrame();
     //Touches = new Xamarin.Forms.Point[] { args.GetCurrentPoint(null).Position.ToXfPoint() };
     Touches  = new Xamarin.Forms.Point[] { args.GetCurrentPoint(element).Position.ToXfPoint() };
     Duration = elapsedMilliseconds;
 }
Пример #7
0
 public UwpRotateEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs args)
 {
     ViewPosition = element.GetXfViewFrame();
     Touches      = new Xamarin.Forms.Point[] { args.Position.ToXfPoint() };
     Angle        = 0;
     TotalAngle   = args.Cumulative.Rotation;
 }
Пример #8
0
 public ManipulationManager(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas parent)
     : base(element, parent)
 {
     this._handlersRegistered = false;
     this.InitialTransform    = this._target.RenderTransform;
     this.ResetManipulation();
 }
Пример #9
0
 public static bool Fire(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs args, FormsGestures.Listener listener)
 {
     var f9pArgs = new UwpRightClickEventArgs(element, args, listener);
     listener.OnRightClicked(f9pArgs);
     args.Handled = f9pArgs.Handled;
     return args.Handled;
 }
        // Helper function to calculate an element's rectangle in root-relative coordinates.
        public static Rect GetElementRect(Windows.UI.Xaml.FrameworkElement element)
        {
            Windows.UI.Xaml.Media.GeneralTransform transform = element.TransformToVisual(null);
            Point point = transform.TransformPoint(new Point());

            return(new Rect(point, new Size(element.ActualWidth, element.ActualHeight)));
        }
Пример #11
0
 private async void SecureAreaWelcomeDialog_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
 {
     if (await WindowsHelloAuthenticator.CheckSupportAsync())
     {
         UseWinHel.IsEnabled = true;
     }
 }
Пример #12
0
        public override void SetValue(ShibaObject shibaObject, View targetShibaView, NativeView element, NativeViewGroup parent)
        {
            var row        = shibaObject.Get <int>("row");
            var column     = shibaObject.Get <int>("column");
            var rowSpan    = shibaObject.Get <int>("rowSpan");
            var columnSpan = shibaObject.Get <int>("columnSpan");

            if (row != default)
            {
                Grid.SetRow(element, row);
            }

            if (column != default)
            {
                Grid.SetColumn(element, column);
            }

            if (rowSpan != default)
            {
                Grid.SetRowSpan(element, rowSpan);
            }

            if (columnSpan != default)
            {
                Grid.SetColumnSpan(element, columnSpan);
            }
        }
Пример #13
0
        private void TestView_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
        {
            this.hostView.ViewModel = App.HostViewModel;
#if LOCALTESTMODEON
            this.clientView.ViewModel  = App.ClientViewModel;
            this.clientView2.ViewModel = App.ClientViewModel2;
#endif
        }
Пример #14
0
 public UwpRightClickEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs args, FormsGestures.Listener listener) 
 {
     ElementPosition = element.GetXfViewFrame();
     var point = args.GetPosition(element);
     ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
     WindowTouches = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
     Listener = listener;
 }
Пример #15
0
        private void Page_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
        {
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            //Konto
            Object valueKonto = localSettings.Values["Konto"];

            if (valueKonto == null)
            {
                // No data
            }
            else
            {
                txtUser.Text = valueKonto.ToString();
            }
            //Password
            Object valuePwd = localSettings.Values["Password"];

            if (valuePwd == null)
            {
                // No data
            }
            else
            {
                txtPassword.Password = valuePwd.ToString();
            }

            //Sekunder för sid visning
            Object tid = localSettings.Values["tid"];

            if (tid == null)
            {
                // No data
                sldTime.Value = 20;
            }
            else
            {
                int i = int.Parse(tid.ToString());
                sldTime.Value = i;
            }
            //Minuter mellan uppdatering från databas
            Object uppD = localSettings.Values["uppdatering"];

            if (tid == null)
            {
                // No data
                sldUppdatering.Value = 60;
            }
            else
            {
                int i = int.Parse(tid.ToString());
                sldUppdatering.Value = i;
            }
            if (valueKonto != null && valuePwd != null)
            {
                GetData();
            }
        }
Пример #16
0
        public static bool FireLongPressed(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.TappedRoutedEventArgs e, long elapsedMilliseconds, Listener listener)
        {
            var args = new UwpLongPressEventArgs(element, e, elapsedMilliseconds);

            args.Listener = listener;
            listener?.OnLongPressed(args);
            e.Handled = args.Handled;
            return(e.Handled);
        }
Пример #17
0
        public UwpPinchEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs args)
        {
            ElementPosition = element.GetXfViewFrame();
            var point = args.Position;

            ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
            WindowTouches  = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
            TotalScale     = args.Cumulative.Scale;
        }
Пример #18
0
 private void UserControl_ActualThemeChanged(Windows.UI.Xaml.FrameworkElement sender, object args)
 {
     try
     {
         RenderDocument();
     }
     catch (Exception)
     {
     }
 }
Пример #19
0
        /// <summary>
        /// Constructor containing info for unpinning a tile.
        /// </summary>
        /// <param name="tileId">The Id of the tile to pin.</param>
        /// <param name="anchorElement">The anchor element that the pin request dialog will display next to.</param>
        /// <param name="requestPlacement">The Placement value that tells where the pin request dialog displays in relation to anchorElement.</param>
        public TileInfo(
            string tileId,
            Windows.UI.Xaml.FrameworkElement anchorElement,
            Placement requestPlacement)
        {
            this.TileId = tileId;

            this.AnchorElement    = anchorElement;
            this.RequestPlacement = requestPlacement;
        }
Пример #20
0
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            Win32Interop.EnableMouseInPointer();

            // There are several different low-level interfaces available at this time.
            // Use XamlBridge unless you have a known reason to use the others.
            //IntPtr windowHandle = InitializePresenterHwndMode(hwndParent);
            //IntPtr windowHandle = InitializePresenterCoreWindowMode(hwndParent);
            IntPtr windowHandle = InitializeBridge(hwndParent);

            // Uncomment the following lines to create Xaml UI content directly from within this WPF host control.
            // Normally, the user of this control sets a property which is the name of a Xaml UserControl to instantiate.

            Windows.UI.Xaml.Controls.StackPanel panel = new Windows.UI.Xaml.Controls.StackPanel();
            panel.Orientation = Windows.UI.Xaml.Controls.Orientation.Vertical;
            panel.Background  = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red);

            Windows.UI.Xaml.Controls.TextBox textBox = new Windows.UI.Xaml.Controls.TextBox();
            textBox.Text = "XAML TextBox 1";
            panel.Children.Add(textBox);

            Windows.UI.Xaml.Controls.Button button = new Windows.UI.Xaml.Controls.Button();
            button.Content = "XAML Button";
            panel.Children.Add(button);

            textBox      = new Windows.UI.Xaml.Controls.TextBox();
            textBox.Text = "XAML TextBox 2";
            panel.Children.Add(textBox);

            //XamlClassLibrary.TestUserControl testUserControl = new XamlClassLibrary.TestUserControl();
            //panel.Children.Add(testUserControl);

            Windows.UI.Xaml.Window.Current.Content = panel;

            panel.LayoutUpdated += XamlContentLayoutUpdated;


            XamlApplication application        = new XamlApplication();
            String          globalResourceFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "globalresources.xbf");

            if (File.Exists(globalResourceFile))
            {
                Windows.UI.Xaml.Application.LoadComponent(application, new Uri("ms-resource:///Files/globalresources.xaml"));
            }

            Windows.UI.Xaml.FrameworkElement contentRoot = panel;
            //var type = Type.GetType(ControlType, true, true);
            //Windows.UI.Xaml.FrameworkElement contentRoot = (Windows.UI.Xaml.FrameworkElement) Activator.CreateInstance("XamlClassLibrary", ControlType).Unwrap();

            Windows.UI.Xaml.Window.Current.Content = contentRoot;

            contentRoot.LayoutUpdated += XamlContentLayoutUpdated;

            return(new HandleRef(this, windowHandle));
        }
Пример #21
0
        private void XUWPMasterDetailView_DataContextChanged(Windows.UI.Xaml.FrameworkElement sender, Windows.UI.Xaml.DataContextChangedEventArgs args)
        {
            var vm = DataContext as INotifyPropertyChanged;

            if (vm == null)
            {
                return;
            }

            vm.PropertyChanged += _viewModel_PropertyChanged;
        }
Пример #22
0
        public UwpRotateEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs args)
        {
            ElementPosition = element.GetXfViewFrame();
            var point = args.Position;

            ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
            WindowTouches  = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
            Angle          = 0;
            DeltaAngle     = args.Delta.Rotation;
            TotalAngle     = args.Cumulative.Rotation;
        }
Пример #23
0
        public async Task Unpin(Windows.UI.Xaml.FrameworkElement anchorElement)
        {
            // Unpin, then delete the feed item locally.
            var tileInfo = new TileInfo(this.FormatSecondaryTileId(), anchorElement, Windows.UI.Popups.Placement.Above);

            this.IsFeedItemPinned = !await this.secondaryPinner.Unpin(tileInfo);

            if (!this.IsFeedItemPinned)
            {
                await RemovePinnedFeedItem();
            }
        }
Пример #24
0
 static void PositionFrameworkElement(Windows.UI.Xaml.FrameworkElement frameworkElement, double x, double y, double scale)
 {
     if (frameworkElement == null)
     {
         return;
     }
     frameworkElement.RenderTransform =
         new Windows.UI.Xaml.Media.MatrixTransform {
         Matrix = new Windows.UI.Xaml.Media.Matrix(scale, 0, 0, -scale, x - scale * frameworkElement.Width / 2,
                                                   y + scale * frameworkElement.Height / 2)
     };
 }
Пример #25
0
        private async void SecureFilePropertyDialog_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
        {
            FileSize = StorageItem.Size;
            FileName = StorageItem.Name;
            FileType = StorageItem.DisplayType;
            Level    = await StorageItem.GetEncryptionLevelAsync().ConfigureAwait(true);

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FileSize)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FileName)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FileType)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Level)));
        }
Пример #26
0
        protected override void OnChangedCurrent(Windows.UI.Xaml.FrameworkElement oldEl, Windows.UI.Xaml.FrameworkElement newEl)
        {
            try
            {
                ViewModel.CurrentDate = SelectedDate;
                CloseExpandedEvents();
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
        private void MainPage_DataContextChanged(Windows.UI.Xaml.FrameworkElement sender, Windows.UI.Xaml.DataContextChangedEventArgs args)
        {
            if (_oldViewModel == null & args.NewValue is MainPageViewModel)
            {
                _oldViewModel = (MainPageViewModel)args.NewValue;
                _oldViewModel.SelectedListChanged += _oldViewModel_SelectedListChanged;
            }

            if (args.NewValue == null && _oldViewModel != null)
            {
                _oldViewModel.SelectedListChanged -= _oldViewModel_SelectedListChanged;
            }
        }
Пример #28
0
        internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference)
        {
            this._target = element;
            this._reference = reference;

            // Setup pointer event handlers for the element.
            this._target.PointerCanceled += OnPointerCanceled;
            this._target.PointerMoved += OnPointerMoved;
            this._target.PointerPressed += OnPointerPressed;
            this._target.PointerReleased += OnPointerReleased;
            this._target.PointerWheelChanged += OnPointerWheelChanged;

            // Create the gesture recognizer
            this._gestureRecognizer = new Windows.UI.Input.GestureRecognizer();
            this._gestureRecognizer.GestureSettings = Windows.UI.Input.GestureSettings.None;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="element">
        /// Manipulation target.
        /// </param>
        /// <param name="reference">
        /// Element that contains the coordinate space used for expressing transformations
        /// during manipulations, usually the parent element of Target in the UI tree.
        /// </param>
        /// <remarks>
        /// Transformations during manipulations cannot be expressed in the coordinate space of the manipulation target.
        /// Thus <paramref name="element"/> and <paramref name="reference"/> must be different. Usually <paramref name="reference"/>
        /// will be an ancestor of <paramref name="element"/> in the UI tree.
        /// </remarks>
        internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference)
        {
            this._target    = element;
            this._reference = reference;

            // Setup pointer event handlers for the element.
            // They are used to feed the gesture recognizer.
            this._target.PointerCanceled     += OnPointerCanceled;
            this._target.PointerMoved        += OnPointerMoved;
            this._target.PointerPressed      += OnPointerPressed;
            this._target.PointerReleased     += OnPointerReleased;
            this._target.PointerWheelChanged += OnPointerWheelChanged;

            // Create the gesture recognizer
            this._gestureRecognizer = new Windows.UI.Input.GestureRecognizer();
            this._gestureRecognizer.GestureSettings = Windows.UI.Input.GestureSettings.None;
        }
Пример #30
0
        /// <summary>
        /// Creates simulated horizontal noise lines from old TV
        /// </summary>
        private void RecreateScanLines()
        {
            // Remove scan lines from game screen
            foreach (FrameworkElement scanLIne in _scanLines)
            {
                if (_sprites.Contains(scanLIne))
                {
                    _sprites.Remove(scanLIne);
                }
            }
            _scanLines.Clear();

            for (int y = 0; y < 300; y += 2)
            {
                FrameworkElement scanLine = InvadersHelper.ScanLineFactory(y, 400, Scale);
            }
        }
Пример #31
0
 private void RecreateScanLines()
 {
     foreach (FrameworkElement scanLines in _scanLines)
     {
         if (_sprites.Contains(scanLines))
         {
             _sprites.Remove(scanLines);
         }
     }
     _scanLines.Clear();
     for (int y = 0; y < 300; y += 2)
     {
         FrameworkElement scanLine = InvadersHelper.ScanLineFactory(y, 400, Scale);
         _scanLines.Add(scanLine);
         _sprites.Add(scanLine);
     }
 }
Пример #32
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="element">
        /// Manipulation target.
        /// </param>
        /// <param name="reference">
        /// Element that contains the coordinate space used for expressing transformations
        /// during manipulations, usually the parent element of Target in the UI tree.
        /// </param>
        /// <remarks>
        /// Transformations during manipulations cannot be expressed in the coordinate space of the manipulation target.
        /// Thus <paramref name="element"/> and <paramref name="reference"/> must be different. Usually <paramref name="reference"/>
        /// will be an ancestor of <paramref name="element"/> in the UI tree.
        /// </remarks>
        internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference)
        {
            _target = element;
            _reference = reference;

            // Setup pointer event handlers for the element.
            // They are used to feed the gesture recognizer.
            _target.PointerMoved += OnPointerMoved;
            _target.PointerPressed += OnPointerPressed;
            _target.PointerReleased += OnPointerReleased;
            _target.PointerCanceled += OnPointerCanceled;
            _target.PointerWheelChanged += OnPointerWheelChanged;

            CrossSlideThresholds cst = new CrossSlideThresholds();
            //cst.RearrangeStart = 10;//cst.SelectionStart = 12;
            //cst.SpeedBumpStart = 12;//cst.SpeedBumpEnd = 24;

            // Create the gesture recognizer
            _gestureRecognizer = new GestureRecognizer();
            _gestureRecognizer.GestureSettings =
                GestureSettings.Hold |
                GestureSettings.ManipulationRotate |
                GestureSettings.ManipulationRotateInertia |
                GestureSettings.ManipulationScale |
                GestureSettings.ManipulationScaleInertia |
                GestureSettings.ManipulationTranslateInertia |
                GestureSettings.ManipulationTranslateX |
                GestureSettings.ManipulationTranslateY |
                GestureSettings.RightTap |
                GestureSettings.Tap |
                GestureSettings.CrossSlide;

            _gestureRecognizer.CrossSlideHorizontally = true;
            _gestureRecognizer.CrossSlideThresholds = cst;

            _gestureRecognizer.ManipulationStarted += OnManipulationStarted;
            _gestureRecognizer.ManipulationUpdated += OnManipulationUpdated;
            _gestureRecognizer.ManipulationInertiaStarting += OnManipulationInertiaStarting;
            _gestureRecognizer.ManipulationCompleted += OnManipulationCompleted;
            _gestureRecognizer.Dragging += OnDragging;
            _gestureRecognizer.Holding += OnHolding;
            _gestureRecognizer.RightTapped += OnRightTapped;
            _gestureRecognizer.Tapped += OnTapped;
            _gestureRecognizer.CrossSliding += OnCrossSliding;
        }
Пример #33
0
        private void ModelShipChangedEventHandler(object sender, ShipChangedEventArgs e)
        {
            if (!e.Killed)
            {
                if (e.ShipUpdated is Mothership)
                {
                    Mothership mothership = e.ShipUpdated as Mothership;
                    if (_mothershipControl == null)
                    {
                        _mothershipControl = InvadersHelper.ShipControlFactory(mothership, Scale);
                        _sprites.Add(_mothershipControl);
                    }
                    else if (mothership.Escaped == true)
                    {
                        _sprites.Remove(_mothershipControl);
                        _mothershipControl = null;
                    }
                    else
                    {
                        InvadersHelper.MoveElementOnCanvas(_mothershipControl, mothership.Location.X * Scale,
                            mothership.Location.Y * Scale);
                        InvadersHelper.ResizeElement(_mothershipControl, mothership.Size.Width * Scale,
                            mothership.Size.Height * Scale);
                    }
                }
                else if (e.ShipUpdated is Invader)
                {
                    Invader invader = e.ShipUpdated as Invader;
                    if (!_invaders.ContainsKey(invader))
                    {
                        FrameworkElement invaderControl = InvadersHelper.ShipControlFactory(invader, Scale);
                        _invaders[invader] = invaderControl;
                        _sprites.Add(invaderControl);
                    }
                    else
                    {
                        FrameworkElement invaderControl = _invaders[invader];
                        InvadersHelper.MoveElementOnCanvas(invaderControl, invader.Location.X * Scale,
                            invader.Location.Y * Scale);
                        InvadersHelper.ResizeElement(invaderControl, invader.Size.Width * Scale,
                            invader.Size.Height * Scale);
                    }
                }
                else if (e.ShipUpdated is Player)
                {
                    if (_playerFlashing)
                    {
                        AnimatedImage playerImage = _playerControl as AnimatedImage;
                        playerImage.StopFlashing();
                        _playerFlashing = false;
                    }
                    if (_playerControl == null)
                    {
                        _playerControl = InvadersHelper.ShipControlFactory(e.ShipUpdated as Player, Scale);
                        _sprites.Add(_playerControl);
                    }
                    else
                    {
                        InvadersHelper.MoveElementOnCanvas(_playerControl, e.ShipUpdated.Location.X * Scale,
                            e.ShipUpdated.Location.Y * Scale);
                        InvadersHelper.ResizeElement(_playerControl, e.ShipUpdated.Size.Width * Scale,
                            e.ShipUpdated.Size.Height * Scale);
                    }
                }
            }
            else
            {
                if (e.ShipUpdated is Mothership)
                {
                    Mothership deadMothership = e.ShipUpdated as Mothership;

                    if (deadMothership == null)
                        return;

                    AnimatedImage deadMothershipControl = _mothershipControl as AnimatedImage;
                    if (deadMothershipControl != null)
                    {
                        deadMothershipControl.InvaderShot();
                        _shotInvaders[deadMothershipControl] = DateTime.Now;
                        _mothershipControl = null;
                    }
                }
                else if (e.ShipUpdated is Invader)
                {
                    Invader deadInvader = e.ShipUpdated as Invader;

                    if (!_invaders.ContainsKey(deadInvader))
                        return;

                    AnimatedImage deadInvaderControl = _invaders[deadInvader] as AnimatedImage;

                    if (deadInvaderControl != null)
                    {
                        deadInvaderControl.InvaderShot();
                        _shotInvaders[deadInvaderControl] = DateTime.Now;
                        _invaders.Remove(deadInvader);
                    }
                }
                else if (e.ShipUpdated is Player)
                {
                    AnimatedImage playerImage = _playerControl as AnimatedImage;
                    if (playerImage != null)
                        playerImage.StartFlashing();
                    _playerFlashing = true;
                }
            }
        }