private void setUsernameClick(object sender, RoutedEventArgs e)
        {
            string[] names = { "Blue Jay", "Chinchilla", "Chipmunk", "Gerbil", "Hamster", "Parrot", "Robin", "Squirrel", "Turtle" };
            string   name  = names[random.Next(0, names.Length)];

            Crittercism.SetUsername("Critter " + name);
        }
 private static void CommandSetUsername(string arg)
 {
     if (arg.Length == 0)
     {
         arg = "MrsCritter";
     }
     Console.WriteLine("SetUsername: \"" + arg + "\"");
     Crittercism.SetUsername(arg);
 }
Пример #3
0
 private bool onSessionStarted(SessionEvents.SessionStartedEvent evt)
 {
     try
     {
         Crittercism.SetUsername(Service.Get <SessionManager>().LocalUser.DisplayName.Text);
     }
     catch (Exception)
     {
         Crittercism.SetUsername("<display name not set>");
     }
     return(false);
 }
Пример #4
0
        private void RefreshData(CurrentPlayer player)
        {
            Crittercism.SetUsername(player.PlayerId);
            SquadController squadController = Service.SquadController;

            if (squadController != null)
            {
                Squad currentSquad = squadController.StateManager.GetCurrentSquad();
                if (currentSquad != null)
                {
                    Crittercism.SetValue("guildId", currentSquad.SquadID);
                }
                else
                {
                    Crittercism.SetValue("guildId", string.Empty);
                }
            }
            Crittercism.SetValue("isPayer", (player.LastPaymentTime <= 0u) ? "False" : "True");
            Crittercism.SetValue("faction", player.Faction.ToString());
            if (player.AbTests != null)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (KeyValuePair <string, object> current in player.AbTests)
                {
                    stringBuilder.Append(current.Key);
                    stringBuilder.Append(",");
                }
                string value = stringBuilder.ToString();
                Crittercism.SetValue("ABtests", value);
            }
            Crittercism.SetValue("HQLevel", player.Map.FindHighestHqLevel().ToString());
            TargetedBundleController targetedBundleController = Service.TargetedBundleController;

            if (targetedBundleController != null)
            {
                string value2 = (targetedBundleController.CurrentTargetedOffer == null) ? "null" : targetedBundleController.CurrentTargetedOffer.Uid;
                Crittercism.SetValue("SPDAvailable", value2);
            }
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.PlayerIdSet);
            eventManager.RegisterObserver(this, EventId.PlayerFactionChanged);
            eventManager.RegisterObserver(this, EventId.SquadUpdated);
            eventManager.RegisterObserver(this, EventId.MetaDataLoadEnd);
            eventManager.RegisterObserver(this, EventId.TargetedBundleContentPrepared);
        }
Пример #5
0
 public void MetadataPersistenceTest()
 {
     try {
         TestHelpers.StartApp();
         Crittercism.SetUsername("harry");
         Crittercism.SetValue("surname", "hedwig");
         Trace.WriteLine("surname == " + Crittercism.ValueFor("surname"));
         Assert.AreEqual(Crittercism.ValueFor("surname"), "hedwig");
         Assert.AreEqual(Crittercism.ValueFor("username"), "harry");
         Crittercism.SetUsername("hermione");
         Crittercism.SetValue("surname", "crookshanks");
         Assert.AreEqual(Crittercism.ValueFor("surname"), "crookshanks");
         Assert.AreEqual(Crittercism.ValueFor("username"), "hermione");
     } finally {
         Crittercism.Shutdown();
         TestHelpers.Cleanup();
     }
 }
Пример #6
0
 public void AddMetadataTwiceTest()
 {
     try {
         TestHelpers.StartApp();
         Crittercism.SetUsername("hamster");
         Crittercism.SetUsername("robin");
         Crittercism.SetUsername("squirrel");
         TestHelpers.LogHandledException();
         MessageReport messageReport = TestHelpers.DequeueMessageType(typeof(HandledException));
         String        asJson        = JsonConvert.SerializeObject(messageReport);
         Assert.IsFalse(asJson.Contains("hamster"));
         Assert.IsFalse(asJson.Contains("robin"));
         Assert.IsTrue(asJson.Contains("squirrel"));
     } finally {
         Crittercism.Shutdown();
         TestHelpers.Cleanup();
     }
 }
Пример #7
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
            Debug.WriteLine("UniqueId == " + item.UniqueId);
            Crittercism.LeaveBreadcrumb("UniqueId == " + item.UniqueId);
            if (item.UniqueId.Equals("SetUsername"))
            {
                Random   random = new Random();
                string[] names  = { "Blue Jay", "Chinchilla", "Chipmunk", "Gerbil", "Hamster", "Parrot", "Robin", "Squirrel", "Turtle" };
                string   name   = names[random.Next(0, names.Length)];
                Crittercism.SetUsername("Critter " + name);
            }
            else if (item.UniqueId.Equals("LeaveBreadcrumb"))
            {
                Random   random = new Random();
                string[] names  = { "Breadcrumb", "Strawberry", "Seed", "Grape", "Lettuce" };
                string   name   = names[random.Next(0, names.Length)];
                Crittercism.LeaveBreadcrumb(name);
            }
            else if (item.UniqueId.Equals("LogHandledException"))
            {
                {
                    try {
                        ThrowException();
                    } catch (Exception ex) {
                        Crittercism.LogHandledException(ex);
                    }
                }
            }
            else if (item.UniqueId.Equals("LogUnhandledException"))
            {
                ThrowException();
            }
        }
Пример #8
0
 public override void StartSession()
 {
     Crittercism.SetUsername(m_userId);
 }
Пример #9
0
        internal static void ItemClick(Frame frame, SampleDataItem item)
        {
            // Navigate to the appropriate destination page, configuring the new page
            // by passing required information as a navigation parameter
            string itemId = item.UniqueId;

            Debug.WriteLine("UniqueId == " + itemId);
            if (itemId.Equals("Set Username"))
            {
                Random   random = new Random();
                string[] names  = { "Blue Jay", "Chinchilla", "Chipmunk", "Gerbil", "Hamster", "Parrot", "Robin", "Squirrel", "Turtle" };
                string   name   = names[random.Next(0, names.Length)];
                Crittercism.SetUsername("Critter " + name);
            }
            else if (itemId.Equals("Leave Breadcrumb"))
            {
                Random   random = new Random();
                string[] names  = { "Breadcrumb", "Strawberry", "Seed", "Grape", "Lettuce" };
                string   name   = names[random.Next(0, names.Length)];
                Crittercism.LeaveBreadcrumb(name);
            }
            else if (itemId.Equals("Network Request"))
            {
                LogNetworkRequest();
            }
            else if (itemId.Equals("Handled Exception"))
            {
                {
                    try {
                        ThrowException();
                    } catch (Exception ex) {
                        Crittercism.LogHandledException(ex);
                    }
                }
            }
            else if (itemId.Equals("Begin Userflow"))
            {
                UserflowClick(frame, item);
            }
            else if (itemId.Equals("Crash"))
            {
                ThrowException();
            }
            else
            {
                // We are on "End Userflow" SectionPage .
                if (itemId.Equals("Succeed"))
                {
                    Crittercism.EndUserflow(userflowName);
                }
                else if (itemId.Equals("Fail"))
                {
                    Crittercism.FailUserflow(userflowName);
                }
                else if (itemId.Equals("Cancel"))
                {
                    Crittercism.CancelUserflow(userflowName);
                }
                ;
                userflowItem.Title = beginUserflowLabel;
                frame.GoBack();
            }
        }