Exemplo n.º 1
0
 private void HideOverlayMessage()
 {
     OverlayMessage.Opacity = 0;
     OverlayMessage.BeginAnimation(OpacityProperty, null);
     OverlayMessage.BeginAnimation(HeightProperty, null);
     OverlayMessage.Visibility          = Visibility.Collapsed;
     isMessageOverlayHideIntervalActive = false;
 }
Exemplo n.º 2
0
        private void ShowOverlayMessage(string text)
        {
            if (isMessageOverlayHideIntervalActive)
            {
                messageOverlayHideInterval.Abort();
            }

            HideOverlayMessage();
            OverlayMessage.Visibility = Visibility.Visible;
            txblOverlayMessage.Text   = text;
            OverlayMessage.Opacity    = 1;
            DoubleAnimation expandAnimation = new DoubleAnimation(0, 50, TimeSpan.FromSeconds(0.1), FillBehavior.HoldEnd);

            OverlayMessage.BeginAnimation(HeightProperty, expandAnimation);
            messageOverlayHideInterval = new Thread(() =>
            {
                Thread.Sleep(1500);
                Dispatcher.Invoke(HideOverlayMessage);
            });
            messageOverlayHideInterval.Start();
            isMessageOverlayHideIntervalActive = true;
        }
Exemplo n.º 3
0
        //TODO: Actually make a queue facility that allows more than one message to
        // be added asynchronously. Pop messages off the stack when one message has
        // finished displaying.
        public void Queue_Message(OverlayMessage message, int time)
        {
            InfoLine1Header.Content = message.Line1Header;
            InfoLine1Body.Content   = message.Line1Content;
            InfoLine2Header.Content = message.Line2Header;
            InfoLine2Body.Content   = message.Line2Content;
            InfoLine3Header.Content = message.Line3Header;
            InfoLine3Body.Content   = message.Line3Content;
            InfoLine4Header.Content = message.Line4Header;
            InfoLine4Body.Content   = message.Line4Content;
            // Fairly certain this is 3 lines in XAML, but I can't get the f****r to work, damnit.
            Storyboard sb = new Storyboard();

            sb.Duration = TimeSpan.FromSeconds(time);
            DoubleAnimation fadein = new DoubleAnimation
            {
                To           = 1,
                BeginTime    = TimeSpan.FromSeconds(0),
                Duration     = TimeSpan.FromSeconds(2),
                FillBehavior = FillBehavior.HoldEnd,
            };
            DoubleAnimation fadeout = new DoubleAnimation
            {
                To           = 0,
                BeginTime    = TimeSpan.FromSeconds(time - 2),
                Duration     = TimeSpan.FromSeconds(2),
                FillBehavior = FillBehavior.HoldEnd,
            };

            sb.Children.Add(fadein);
            sb.Children.Add(fadeout);
            Storyboard.SetTarget(fadein, MessageGrid);
            Storyboard.SetTarget(fadeout, MessageGrid);
            Storyboard.SetTargetProperty(fadein, new PropertyPath(UIElement.OpacityProperty));
            Storyboard.SetTargetProperty(fadeout, new PropertyPath(UIElement.OpacityProperty));
            sb.Begin();
        }
Exemplo n.º 4
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = "";
            returnValue = CefV8Value.CreateUndefined();

            if (name == EndEncounterFunctionName)
            {
                EndEncounter?.Invoke(obj, new EndEncounterEventArgs());
            }
            else if (name == TakeScreenShotFunctionName)
            {
                if (arguments.Length > 0)
                {
                    TakeScreenShot?.Invoke(obj, new TakeScreenShotEventArgs(arguments[0].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == BroadcastMessageFunctionName)
            {
                if (arguments.Length > 0)
                {
                    BroadcastMessage?.Invoke(obj, new BroadcastMessageEventArgs(arguments[0].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == SendMessageFunctionName)
            {
                if (arguments.Length > 1)
                {
                    SendMessage?.Invoke(obj, new SendMessageEventArgs(arguments[0].GetStringValue(), arguments[1].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == OverlayMessageFunctionName)
            {
                if (arguments.Length > 1)
                {
                    OverlayMessage?.Invoke(obj, new SendMessageEventArgs(arguments[0].GetStringValue(), arguments[1].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
 internal static void OnOverlayMessage(object sender, SendMessageEventArgs e)
 {
     OverlayMessage?.Invoke(sender, e);
 }
 public void Act()
 {
     OverlayMessage.ShowAtScreenCenter("Yeah, that custom action is working!");
 }
Exemplo n.º 7
0
 public DodoMessage(OverlayMessage msg)
     : base(msg)
 {
 }
Exemplo n.º 8
0
 public Message(OverlayMessage payload)
 {
     this.Payload = payload;
 }
Exemplo n.º 9
0
        // TODO: We will need additional functionality like this for CLB.

        // Método al que se puede llamar si se quiere notificar al Application de la llegada de un mensaje.
        // Se le llamará desde el método ArrivedAtDestination del mensaje.
        public abstract void MessageReceived(OverlayMessage msg);
Exemplo n.º 10
0
 public override void MessageReceived(OverlayMessage msg)
 {
 }