Beispiel #1
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            Xamarin.Insights.Initialize(ApiConstants.InsightsApiKey);

            AppStart = Xamarin.Insights.TrackTime("App Launch Time");
            UIApplication.CheckForIllegalCrossThreadCalls         = false;
            System.Net.ServicePointManager.DefaultConnectionLimit = 50;
            NSString appClass      = new NSString(@"MyUIApp");
            NSString delegateClass = new NSString(@"AppDelegate");

            UIApplication.Main(args, appClass, delegateClass);
        }
        public BugSweeperPage()
        {
            InitializeComponent();

            board.GameStarted += (sender, args) =>
                {
                    isGameInProgress = true;
                    gameStartTime = DateTime.Now;

					Xamarin.Insights.Track("GameStarted");

					handle = Xamarin.Insights.TrackTime("GameLength");
					handle.Start();

                    Device.StartTimer(TimeSpan.FromSeconds(1), () =>
                    {
                        timeLabel.Text = (DateTime.Now - gameStartTime).ToString(timeFormat);
                        return isGameInProgress;
                    });
                };

            board.GameEnded += (sender, hasWon) =>
                {
                    isGameInProgress = false;
					
					handle.Stop();
                    
					if (hasWon)
                    {
                        DisplayWonAnimation();
						Xamarin.Insights.Track("Won");
                    }
                    else
                    {
                        DisplayLostAnimation();
						Xamarin.Insights.Track("Lost");
                    }
                };

            PrepareForNewGame();
        }
Beispiel #3
0
        public BugSweeperPage()
        {
            InitializeComponent();

            board.GameStarted += (sender, args) =>
            {
                isGameInProgress = true;
                gameStartTime    = DateTime.Now;

                Xamarin.Insights.Track("GameStarted");

                handle = Xamarin.Insights.TrackTime("GameLength");
                handle.Start();

                Device.StartTimer(TimeSpan.FromSeconds(1), () =>
                {
                    timeLabel.Text = (DateTime.Now - gameStartTime).ToString(timeFormat);
                    return(isGameInProgress);
                });
            };

            board.GameEnded += (sender, hasWon) =>
            {
                isGameInProgress = false;

                handle.Stop();

                if (hasWon)
                {
                    DisplayWonAnimation();
                    Xamarin.Insights.Track("Won");
                }
                else
                {
                    DisplayLostAnimation();
                    Xamarin.Insights.Track("Lost");
                }
            };

            PrepareForNewGame();
        }
Beispiel #4
0
        public ITrackTimer Init(string identifier)
        {
            _handle = Xamarin.Insights.TrackTime(identifier);

            return(this);
        }
 public TimerHandle(Xamarin.ITrackHandle h, string s)
 {
     Handle = h;
     Time   = DateTime.UtcNow;
     Text   = s;
 }