Exemplo n.º 1
0
        public static void TrackEvent(IFileAccessManager logFileManager, string sActivityOrFragment, string sItemName)
        {
            string sTrackIdentifier = "ItemClicked " + sActivityOrFragment + " " + sItemName;

            TrajetTramLogger.LogConsoleDebug(logFileManager, sTrackIdentifier, "Analytics.TrackEvent");

            Analytics.TrackEvent(sTrackIdentifier, new Dictionary <string, string> {
                { sActivityOrFragment, sItemName }
            });
        }
Exemplo n.º 2
0
        private List <T> QueryItems <T>(IFileAccessManager logFileManager, string sSQLRequest, params object[] args) where T : new()
        {
            lock (locker)
            {
                string   s     = "QueryItems(" + typeof(T).ToString() + ", " + sSQLRequest + ")";
                DateTime start = DateTime.Now;

                List <T> lsRes = m_connection.Query <T>(sSQLRequest, args);

                TimeSpan diff = DateTime.Now - start;
                TrajetTramLogger.LogConsoleDebug(logFileManager, "End(" + diff.Seconds + "s " + diff.Milliseconds + "ms) " + s, "DatabaseTrajetTram");
                return(lsRes);
            }
        }
Exemplo n.º 3
0
        private int DeleteItems <T>(IFileAccessManager logFileManager)
        {
            lock (locker)
            {
                string   s     = "DeleteItems(" + typeof(T).ToString() + ")";
                DateTime start = DateTime.Now;

                int iRes = m_connection.DeleteAll <T>();

                TimeSpan diff = DateTime.Now - start;
                TrajetTramLogger.LogConsoleDebug(logFileManager, "End(" + diff.Seconds + "s " + diff.Milliseconds + "ms) " + s, "DatabaseTrajetTram");
                return(iRes);
            }
        }
Exemplo n.º 4
0
        private List <T> GetItems <T>(IFileAccessManager logFileManager) where T : new()
        {
            lock (locker)
            {
                string   s     = "GetItems(" + typeof(T).ToString() + ")";
                DateTime start = DateTime.Now;

                List <T> lsRes = m_connection.Table <T>().ToList();

                TimeSpan diff = DateTime.Now - start;
                TrajetTramLogger.LogConsoleDebug(logFileManager, "End(" + diff.Seconds + "s " + diff.Milliseconds + "ms, count = " + lsRes.Count + ") " + s, "DatabaseTrajetTram");
                return(lsRes);
            }
        }
Exemplo n.º 5
0
        private T GetItem <T>(IFileAccessManager logFileManager, Expression <Func <T, bool> > Filter) where T : new()
        {
            lock (locker)
            {
                string   s     = "GetItem(" + typeof(T).ToString() + ", " + ((LambdaExpression)Filter).Body.ToString() + ")";
                DateTime start = DateTime.Now;

                T res = m_connection.Table <T>().Where(Filter).FirstOrDefault();

                TimeSpan diff = DateTime.Now - start;
                TrajetTramLogger.LogConsoleDebug(logFileManager, "End(" + diff.Seconds + "s " + diff.Milliseconds + "ms) " + s, "DatabaseTrajetTram");

                return(res);
            }
        }
Exemplo n.º 6
0
        private static void AddAttachmentAndReportToMobileCenter(IFileAccessManager logFileManager, string sDesc)
        {
            TrajetTramLogger.LogConsoleDebug(logFileManager, "Exception - ", sDesc);

            //Always send crash report without asking to user
            Crashes.ShouldProcessErrorReport    = (ErrorReport report) => { return(true); };
            Crashes.ShouldAwaitUserConfirmation = () => { return(false); };

            //Add attachments to the error
            Crashes.GetErrorAttachments = (ErrorReport report) =>
            {
                return(new ErrorAttachmentLog[]
                {
                    ErrorAttachmentLog.AttachmentWithText(sDesc, "attachment.txt")
                });
            };
        }
Exemplo n.º 7
0
        public static void TrackGPS(IFileAccessManager logFileManager, string sLog)
        {
            TrajetTramLogger.LogConsoleDebug(logFileManager, "GPS - ", sLog);

            Analytics.TrackEvent("GPS - " + sLog, new Dictionary <string, string> ());
        }