예제 #1
0
 public MainView()
 {
     InitializeComponent();
     Messenger.Default.Register <NotificationMessage <string> >(this, message =>
     {
         if (message.Notification != Utils.GlobalMessages.AnimateDoorButton.ToString())
         {
             return;
         }
         var obj = VisualTreeHelper.FindObject(this, o =>
         {
             var l = o as Label;
             if (l?.ClassId == null)
             {
                 return(false);
             }
             if (!l.ClassId.StartsWith("*"))
             {
                 return(false);
             }
             return(l.Text == message.Content);
         });
         if (obj == null)
         {
             return;
         }
         var label = (AnimatedTapLabel)obj;
         var cid   = label.ClassId;
         cid       = cid.Replace('*', '+');
         obj       = VisualTreeHelper.FindObject(this, o =>
         {
             var c = o as TapImage;
             if (c == null)
             {
                 return(false);
             }
             return(c.ClassId == cid);
         });
         if (obj == null)
         {
             return;
         }
         var tc = (TapImage)obj;
         tc.PlayAnimation();
         label.PlayAnimation();
     });
     Messenger.Default.Register <NotificationMessage>(this, n =>
     {
         if (n.Notification != Utils.GlobalMessages.LockScreenLoadingData.ToString())
         {
             return;
         }
         GrayBox.IsVisible      = false;
         WaitingLabel.IsVisible = true;
     });
     Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); // iOS
     initNumbers();
     BindingContext = App.Locator.MainVM;
 }