private void userflowClick(object sender,RoutedEventArgs e) {
     Button button = sender as Button;
     if (button != null) {
         Debug.Assert(button == userflowButton);
         String label = button.Content.ToString();
         if (label == beginUserflowLabel) {
             App.userflowName = userflowNames[random.Next(0,userflowNames.Length)];
             Crittercism.BeginUserflow(App.userflowName);
             // Broadcast UserflowEvent to all open windows. 
             App.OnUserflowEvent(EventArgs.Empty);
         } else if (label == endUserflowLabel) {
             EndUserflowDialog dialog = new EndUserflowDialog();
             dialog.Owner = Window.GetWindow(this);
             dialog.ShowDialog();
             Nullable<bool> dialogResult = dialog.DialogResult;
             if (dialogResult == true) {
                 switch (dialog.Answer) {
                     case "End Userflow":
                         Crittercism.EndUserflow(App.userflowName);
                         break;
                     case "Fail Userflow":
                         Crittercism.FailUserflow(App.userflowName);
                         break;
                     case "Cancel Userflow":
                         Crittercism.CancelUserflow(App.userflowName);
                         break;
                 };
                 App.userflowName = null;
                 // Broadcast UserflowEvent to all open windows. 
                 App.OnUserflowEvent(EventArgs.Empty);
             }
         }
     }
 }
예제 #2
0
        private void userflowButton_Click(object sender, EventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                String label = button.Text;
                if (label == beginUserflowLabel)
                {
                    Program.userflowName = userflowNames[random.Next(0, userflowNames.Length)];
                    Crittercism.BeginUserflow(Program.userflowName);
                    // Broadcast UserflowEvent to all open windows.
                    Program.OnUserflowEvent(EventArgs.Empty);
                }
                else if (label == endUserflowLabel)
                {
                    EndUserflowDialog dialog = new EndUserflowDialog();
                    dialog.Owner = this;
                    dialog.ShowDialog();
                    if (dialog.DialogResult == DialogResult.Yes)
                    {
                        switch (dialog.Answer)
                        {
                        case "End Userflow":
                            Crittercism.EndUserflow(Program.userflowName);
                            break;

                        case "Fail Userflow":
                            Crittercism.FailUserflow(Program.userflowName);
                            break;

                        case "Cancel Userflow":
                            Crittercism.CancelUserflow(Program.userflowName);
                            break;
                        }
                        ;
                        Program.userflowName = null;
                        // Broadcast UserflowEvent to all open windows.
                        Program.OnUserflowEvent(EventArgs.Empty);
                    }
                }
            }
        }
 private void cancelUserflowClick(object sender, RoutedEventArgs e)
 {
     Crittercism.CancelUserflow(Demo.userflowName);
     Demo.userflowName = null;
     GoBack();
 }
예제 #4
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();
            }
        }