Exemplo n.º 1
0
 private void Application_Launching(
     object sender, LaunchingEventArgs e)
 {
     AnalyticsTracker.Track(
         "start", "launch");
     ThemeData.Initialize();
 }
Exemplo n.º 2
0
        protected override void OnNavigatedTo(
            bool cancelled, NavigationEventArgs e)
        {
            if (cancelled)
            {
                return;
            }

            if (Cache.Database == null)
            {
                this.BackToDBs();
            }

            object search;

            if (!State.TryGetValue("Search", out search))
            {
                return;
            }

            var searchText = search as string;

            if (!string.IsNullOrEmpty(searchText))
            {
                txtSearch.Text = searchText;
            }

            AnalyticsTracker.Track("search");
        }
Exemplo n.º 3
0
        private void Application_UnhandledException(
            object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            var ex = e.ExceptionObject;

            AnalyticsTracker.Track(
                new TrackingEvent("error")
            {
                { "type", ex.GetType().FullName },
                { "stack", ex.StackTrace }
            });

            e.Handled = true;

            RootFrame.Dispatcher.BeginInvoke(() =>
            {
                if (!Debugger.IsAttached)
                {
                    var response = MessageBox.Show(
                        Properties.Resources.UnhandledExPrompt,
                        Properties.Resources.UnhandledExTitle,
                        MessageBoxButton.OKCancel);

                    if (response == MessageBoxResult.OK)
                    {
                        ErrorReport.Report(ex);
                    }
                }
                else
                {
                    Debugger.Break();
                }
            });
        }
Exemplo n.º 4
0
        private void Application_Activated(
            object sender, ActivatedEventArgs e)
        {
            AnalyticsTracker.Track(
                "start", "activated");

            if (e.IsApplicationInstancePreserved)
            {
                var global = GlobalPassHandler.Instance;
                global.Reset();

                if (global.ShouldPromptGlobalPass)
                {
                    var root = RootFrame;
                    root.Dispatcher.BeginInvoke(() =>
                                                root.Navigate(Navigation.GetPathTo
                                                              <GlobalPassVerify>()));
                }

                return;
            }

            ThemeData.Initialize();
            Cache.RestoreCache(RootFrame.Dispatcher);
        }
Exemplo n.º 5
0
        private void Delete(Entry entry)
        {
            var database  = Cache.Database;
            var pernament = IsPernamentDelete();

            AnalyticsTracker.Track(
                "modify", "delete_entry");

            if (!ConfirmDelete(pernament,
                               Properties.Resources.Entry,
                               entry.Title))
            {
                return;
            }

            if (!pernament)
            {
                MoveToRecycleBin((writer, recycleBin) =>
                {
                    entry.Group.Entries
                    .Remove(entry);
                    recycleBin.Add(entry);

                    writer.Location(entry);
                });
            }
            else
            {
                Save(x =>
                {
                    x.Delete(entry);
                    database.Remove(entry);
                });
            }
        }
Exemplo n.º 6
0
        private void dlgNewGroup_Completed(object sender,
                                           PopUpEventArgs <string, PopUpResult> e)
        {
            if (e.PopUpResult != PopUpResult.Ok)
            {
                return;
            }

            if (string.IsNullOrEmpty(e.Result))
            {
                return;
            }

            Save(x =>
            {
                var database = Cache.Database;

                var group = database
                            .AddNew(_group, e.Result);

                x.New(group);
            });

            AnalyticsTracker.Track(
                "modify", "new_group");
        }
Exemplo n.º 7
0
        private void Delete(Group group)
        {
            var database  = Cache.Database;
            var pernament = IsPernamentDelete();

            AnalyticsTracker.Track(
                "modify", "delete_group");

            if (!ConfirmDelete(pernament,
                               Properties.Resources.Group,
                               group.Name))
            {
                return;
            }

            if (!pernament)
            {
                MoveToRecycleBin((writer, recycleBin) =>
                {
                    group.Remove();
                    recycleBin.Add(group);

                    writer.Location(group);
                });
            }
            else
            {
                Save(x =>
                {
                    x.Delete(group);
                    database.Remove(group);
                });
            }
        }
Exemplo n.º 8
0
        private void cmdMove_Click(object sender, EventArgs e)
        {
            if (_entry != null)
            {
                Save(x =>
                {
                    _entry.Remove();
                    _target.Add(_entry);
                    x.Location(_entry);
                });

                AnalyticsTracker.Track(
                    "modify", "move_entry");
            }
            else
            {
                Save(x =>
                {
                    _group.Remove();
                    _target.Add(_group);
                    x.Location(_group);
                });

                AnalyticsTracker.Track(
                    "modify", "move_group");
            }

            NavigationService.GoBack();
        }
Exemplo n.º 9
0
        private void OpenDatabase()
        {
            progBusy.IsBusy = true;
            progBusy.Focus();

            var savePass = chkStore
                           .IsChecked == true;

            _wkOpen.RunWorkerAsync(new OpenArgs
            {
                Folder       = _folder,
                Dispatcher   = Dispatcher,
                SavePassword = savePass,
                Password     = txtPassword.Password,
            });

            AnalyticsTracker.Track(
                new TrackingEvent("open_db")
            {
                {
                    "save_password", savePass
                            ? "true" : "false"
                }
            });
        }
Exemplo n.º 10
0
        private void dlgRename_Completed(object sender,
                                         PopUpEventArgs <string, PopUpResult> e)
        {
            if (e.PopUpResult != PopUpResult.Ok)
            {
                return;
            }

            if (string.IsNullOrEmpty(e.Result))
            {
                return;
            }

            var dlgRename = (InputPrompt)sender;
            var group     = (Group)dlgRename.Tag;

            Save(x =>
            {
                group.Name = e.Result;
                x.Details(group);
            });

            AnalyticsTracker.Track(
                "modify", "rename_group");
        }
Exemplo n.º 11
0
        private void OpenUrl(bool useIntegreatedBrowser)
        {
            var url = GetUrl();

            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            if (useIntegreatedBrowser)
            {
                AnalyticsTracker.Track(
                    "browser", "integrated");

                this.NavigateTo <WebView>(
                    "url={0}", url);

                return;
            }

            AnalyticsTracker.Track(
                "browser", "external");

            new WebBrowserTask
            {
                Uri = new Uri(url),
            }.Show();
        }
Exemplo n.º 12
0
 // Use this for initialization
 void Awake()
 {
     EventManager.AddListener <AnalyticsGameEvent>(AnalyticsHandler);
     _Analytics        = GetComponent <AnalyticsTracker>();
     _AnalyticsTracker = GetComponent <AnalyticsEventTracker>();
     _PlayGamesManager = GetComponent <PlayGamesManager>();
 }
Exemplo n.º 13
0
        private void cmdDisable_Click(object sender, EventArgs e)
        {
            AppSettings.Instance
            .AllowAnalytics = false;

            AnalyticsTracker.Disable();
            NavigationService.GoBack();
        }
Exemplo n.º 14
0
 private void Awake()
 {
     // Makes script a singleton
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 15
0
        private void cmdReset_Click(object sender, EventArgs e)
        {
            _binding.Reset();
            AnalyticsTracker.Track(
                "modify", "reset_entry");

            DataContext = null;
            DataContext = _binding;

            UpdateNotes();
            UpdateFieldsCount(_entry);
        }
Exemplo n.º 16
0
        private void cmdAllow_Click(object sender, EventArgs e)
        {
            var settings      = AppSettings.Instance;
            var justInstalled = settings.AllowAnalytics == null;

            settings.AllowAnalytics = true;
            AnalyticsTracker.Collect();

            if (justInstalled)
            {
                AnalyticsTracker.Track(
                    "new_instance");
            }

            NavigationService.GoBack();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Registers an Analytics Tracker to be used to track usage of the application. In own code,
        /// the AnalysisTracker can be used to store usage information by using the singleton.
        /// <list>
        /// AnalysisTracker.Instance.TrackApplication()
        /// AnalysisTracker.Instance.TrackPageView(string page)
        /// AnalysisTracker.Instance.TrackEvent(string category, string action)
        /// AnalysisTracker.Instance.TrackEvent(string category, string action, string label)
        /// AnalysisTracker.Instance.TrackEvent(string category, string action, string label, int value)
        /// </list>
        /// Dependent on the AnalyticsTracker that is register, the information when will be
        /// stored to different environments.
        /// </summary>
        private void SetupAnalyticsTracker()
        {
            // A flag, indicating whether we want to use the GoogleAnalyticsTracker.
            // In case the Google AnalyticsTracker is used, the appropriate JavaScript must
            // have been loaded in the application's html page for the tracking to work.
            // In case the JS code is not found, the GoogleAnalyticsTracker will resort
            // to no-ops, so there is no problem in automatically switching it on.
            // Note: Lite uses the LiteAnalysisTracker that internally uses the setup
            // tracker (here Google), but provides a more suitable API for tracking
            // Lite behavior. See the LiteAnalysisTracker for more info.
            bool useGoogleAnalyticsTracker = true;

            if (useGoogleAnalyticsTracker)
            {
                // Store the Google Analytics Tracker as the analytics tracker to be used to store usage of the application/client framework
                AnalyticsTracker.SetTracker(new GoogleAnalyticsTracker());
            }
        }
Exemplo n.º 18
0
        private void lnkDemo_Click(object sender, EventArgs e)
        {
            var info   = new DatabaseInfo();
            var demoDb = Application.GetResourceStream(
                new Uri("Sources/Demo7Pass.kdbx", UriKind.Relative));

            AnalyticsTracker.Track("new_db", "demo");

            info.SetDatabase(demoDb.Stream, new DatabaseDetails
            {
                Source = "Demo",
                Name   = "Demo Database",
                Type   = SourceTypes.OneTime,
            });

            MessageBox.Show(
                Properties.Resources.DemoDbText,
                Properties.Resources.DemoDbTitle,
                MessageBoxButton.OK);

            this.BackToDBs();
        }
 /// <summary>
 /// Initializes the helper using the specified new analytics tracker.
 /// </summary>
 /// <param name="newContext">The analytics tracker.</param>
 public static void Initialize(AnalyticsTracker newContext)
 {
     HttpContext.Current.Application["PersonaHelper"] = new PersonaHelper(newContext);
 }
Exemplo n.º 20
0
 private void lnkDropBox_Click(object sender, RoutedEventArgs e)
 {
     AnalyticsTracker.Track("new_db", "dropbox");
     Navigate <DropBox.DropBoxAuth>();
 }
Exemplo n.º 21
0
        private void Save()
        {
            progBusy.IsBusy = true;

            string groupId;

            if (!NavigationContext.QueryString
                .TryGetValue("group", out groupId))
            {
                groupId = null;
            }

            ThreadPool.QueueUserWorkItem(_ =>
            {
                AnalyticsTracker.Track("modify",
                                       _entry.ID != null
                        ? "save_entry"
                        : "new_entry");

                var info     = Cache.DbInfo;
                var database = Cache.Database;
                var writer   = new DatabaseWriter();

                info.OpenDatabaseFile(x => writer
                                      .LoadExisting(x, info.Data.MasterKey));

                if (_entry.ID != null)
                {
                    writer.Details(_entry);
                }
                else
                {
                    database.AddNew(
                        _entry, groupId);

                    writer.New(_entry);
                }

                info.SetDatabase(x => writer.Save(
                                     x, database.RecycleBin));

                Dispatcher.BeginInvoke(() =>
                {
                    UpdateNotes();
                    progBusy.IsBusy     = false;
                    _binding.HasChanges = false;

                    if (!info.NotifyIfNotSyncable())
                    {
                        new ToastPrompt
                        {
                            Title           = Properties.Resources.SavedTitle,
                            Message         = Properties.Resources.SavedCaption,
                            TextOrientation = System.Windows.Controls
                                              .Orientation.Vertical,
                        }.Show();
                    }
                });

                ThreadPool.QueueUserWorkItem(
                    __ => Cache.AddRecent(_entry.ID));
            });
        }
Exemplo n.º 22
0
 private void Start()
 {
     Tracker = GetComponent <AnalyticsTracker>();
 }
Exemplo n.º 23
0
        public static void ReportUsage(string name = "")
        {
            if (string.IsNullOrEmpty(name))
                name = lastname;

            var diff = DateTime.Now - lasttime;
#if !DEBUG
            if (diff > TimeSpan.FromSeconds(3))
#endif
#if FALSE
            AnalyticsTracker tracker = new AnalyticsTracker();
                tracker.Track("PivotSwitch", name, "AT*" + diff.TotalSeconds.ToString());
#endif
                Api.LogEvent("PivotSwitch", new List<FlurryWP7SDK.Models.Parameter> {
                new FlurryWP7SDK.Models.Parameter("AwaitTime", diff.TotalSeconds.ToString())
            });
#if DEBUG
            DebugLogging.Append("Usage", name, diff.TotalSeconds.ToString());
#endif
            lastname = name;
            lasttime = DateTime.Now;
        }
Exemplo n.º 24
0
    private void TrackNavigation(object sender, NavigationEventArgs e)
        {
            if (Tracker == null)
                Tracker = new AnalyticsTracker();

            Tracker.TrackPage(e.Uri);
        }
Exemplo n.º 25
0
 private void Start()
 {
     Tracker           = GetComponent <AnalyticsTracker>();
     myRenderer        = GetComponent <SpriteRenderer>();
     myRenderer.sprite = atlas.GetSprite("CheckPointLine");
 }
Exemplo n.º 26
0
 protected override void OnStart()
 {
     base.OnStart();
     AnalyticsTracker.SendScreenView("search");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PersonaHelper"/> class.
 /// </summary>
 /// <param name="newContext">The analytics context.</param>
 private PersonaHelper(AnalyticsTracker newContext)
 {
     personaTracker = newContext;
 }
Exemplo n.º 28
0
 private void lnkSkyDrive_Click(object sender, RoutedEventArgs e)
 {
     AnalyticsTracker.Track("new_db", "skydrive");
     Navigate <SkyDrive.LiveAuth>();
 }
Exemplo n.º 29
0
 private void lnkWeb_Click(object sender, RoutedEventArgs e)
 {
     AnalyticsTracker.Track("new_db", "web");
     Navigate <Web.WebDownload>();
 }
Exemplo n.º 30
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            AnalyticsTracker.Track("global_pass");
        }
Exemplo n.º 31
0
        private double GetProfileKeyValue()
        {
            Func <ProfileData, bool>    predicate = null;
            Func <ProfileKeyData, bool> func2     = null;

            AnalyticsTracker current = AnalyticsTracker.Current;

            if (current == null)
            {
                return(0.0);
            }

            Guid sessionId = current.CurrentSession.GetSessionId();

            if (sessionId == Guid.Empty)
            {
                return(0.0);
            }

            ProfileKeyResult profileKeyResult = GetProfileKeyResult(sessionId, new Guid(ProfileKeyId));

            if ((profileKeyResult.ProfileId == Guid.Empty) || (profileKeyResult.ProfileKeyId == Guid.Empty))
            {
                return(0.0);
            }

            if (current.Data != null)
            {
                if (predicate == null)
                {
                    predicate = p => p.ProfileId == profileKeyResult.ProfileId;
                }
                ProfileData source = current.Data.Profiles.FirstOrDefault(predicate);
                if (source != null)
                {
                    if (func2 == null)
                    {
                        func2 = profileKeyData => profileKeyData.ProfileKeyId == profileKeyResult.ProfileKeyId;
                    }
                    ProfileKeyData data2 = source.FirstOrDefault(func2);
                    if (data2 != null)
                    {
                        int  num     = source.Sum((ProfileKeyData profileKeyData) => profileKeyData.Value);
                        bool changed = source.Aggregate(source.Changed, (current1, data3) => current1 | data3.Changed);
                        profileKeyResult.Count = changed ? (source.Count + 1) : source.Count;
                        profileKeyResult.Total = num;
                        profileKeyResult.Value = data2.Value;
                    }
                }
            }

            string str = profileKeyResult.ProfileType ?? string.Empty;

            switch (str.ToLower())
            {
            case "sum":
                return(profileKeyResult.Value);

            case "percentage":
                return((profileKeyResult.Value * 100.0) / (profileKeyResult.Total));

            case "average":
                return((profileKeyResult.Value) / ((double)profileKeyResult.Count));
            }

            return(profileKeyResult.Value);
        }