Example #1
0
        private static void ReportStat(string eventName, string exceptionName, string details)
        {
            try
            {
                var tableName = "WazeStatLog";

                string lang = "";

                try
                {
                    lang = LanguageResources.Instance.CurrentLanguage;
                }
                catch (Exception)
                {
                    // cross thread access to IsolatedStorage can cause exception here - just ignore it
                }

                var wazeStatLog = new WazeStatLog
                {
                    DeviceID   = deviceID,
                    Lang       = lang,
                    Ver        = GamePage.get().GetAppVersion(),
                    DeviceType = Microsoft.Phone.Info.DeviceStatus.DeviceName,
                    Event      = eventName,
                    Details    = details,
                    Timestamp  = DateTime.Now
                };

                context.AddObject(tableName, wazeStatLog);


                context.BeginSaveChanges(
                    asyncResult =>
                {
                    TableSaveCallBack(context, asyncResult);
                },
                    null);
            }
            catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine(exc.ToString());
            }
        }
Example #2
0
        private static void ReportStat(string eventName, string exceptionName, string details)
        {
            try
            {

                var tableName = "WazeStatLog";

                string lang = "";

                try
                {
                    lang = LanguageResources.Instance.CurrentLanguage;
                }
                catch (Exception)
                {
                    // cross thread access to IsolatedStorage can cause exception here - just ignore it
                }

                var wazeStatLog = new WazeStatLog
                {
                    DeviceID = deviceID,
                    Lang = lang,
                    Ver = GamePage.get().GetAppVersion(),
                    DeviceType = Microsoft.Phone.Info.DeviceStatus.DeviceName,
                    Event = eventName,
                    Details = details,
                    Timestamp = DateTime.Now
                };

                context.AddObject(tableName, wazeStatLog);

                context.BeginSaveChanges(
                            asyncResult =>
                            {
                               TableSaveCallBack(context, asyncResult);

                            },
                            null);

            }
            catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine(exc.ToString());
            }
        }
Example #3
0
        public static void ReportWebStat()
        {
            try
            {

                byte[] deviceIDbyte = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
                string deviceID = Convert.ToBase64String(deviceIDbyte);

                WazeWP7.App_Start.StorageInitializer.ApplicationStartup();
                var tableClient = CloudStorageContext.Current.Resolver.CreateCloudTableClient();
                var tableName = "WazeStatLog";

                tableClient.CreateTableIfNotExist(
                    tableName,
                    p =>
                    {
                        var context = CloudStorageContext.Current.Resolver.CreateTableServiceContext();
                        var wazeStatLog = new WazeStatLog {
                            DeviceID = deviceID,
                            Lang = LanguageResources.Instance.CurrentLanguage,
                            Ver = GamePage.get().GetAppVersion(),
                            DeviceType = Microsoft.Phone.Info.DeviceStatus.DeviceName,
                            Timestamp = DateTime.Now
                        };

                        context.AddObject(tableName, wazeStatLog);
                        context.BeginSaveChanges(
                            asyncResult =>
                            {
                                try
                                {
                                    var response = context.EndSaveChanges(asyncResult);

                                }
                                catch (Exception exc)
                                {
                                    System.Diagnostics.Debug.WriteLine(exc.ToString());

                                }

                            },
                            null);
                    });

            }
            catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine(exc.ToString());
            }
        }