Example #1
0
 private void updateTodaysLogEntries()
 {
     PrefsData.PrefLogIndex index = m_userPrefs.getActiveSheet();
     LocalLogger.updateTodaysLogs(m_timeStr,
                                  m_userPrefs.getLogName(index),
                                  m_userPrefs.getProjectName(index),
                                  m_userPrefs.getProjectDescription(index));
 }
Example #2
0
        private void importFileData()
        {
            m_userPrefs = UserPrefs.getPrefs();

            PrefsData.PrefLogIndex index = m_userPrefs.getActiveSheet();

            LocalLogger.loadTodayLogsFromFile();
            m_timeStr = LocalLogger.getTodaysEntryData(
                m_userPrefs.getLogName(index),
                m_userPrefs.getProjectName(index),
                m_userPrefs.getProjectDescription(index),
                LocalLogger.EntryDataIndex.Time);
            m_timeConfirmed = timeStringToMilliseconds(m_timeStr);

            checkTimeLimits();
        }
Example #3
0
        /// <summary>
        /// Changes active the time and google sheets id to match the input log
        /// </summary>
        /// <param name="index"></param>
        private void changeActiveLogData(PrefsData.PrefLogIndex index)
        {
            // try to get time from memory
            m_timeStr = LocalLogger.getTodaysEntryData(
                m_userPrefs.getLogName(index),
                m_userPrefs.getProjectName(index),
                m_userPrefs.getProjectDescription(index),
                LocalLogger.EntryDataIndex.Time);
            m_timeConfirmed = timeStringToMilliseconds(m_timeStr);
            m_timePending   = 0;
            m_timeBuffer    = 0;

            // let the program know a valid log+project+desc has been set
            m_foundGoogleSheetAndTab = true;

            // compare data with google sheets and act accordingly
            googleSheetsInterfaceSetup();
        }
Example #4
0
        public void logTime()
        {
            // run only if write to local file succeeds
            if (LocalLogger.writeToLogFile())
            {
                if (m_foundGoogleSheetAndTab == false)
                {
                    return;
                }

                PrefsData.PrefLogIndex index = m_userPrefs.getActiveSheet();

                if (TCOSheetsInterface.getIsServiceActive() == false)
                {
                    Console.WriteLine("Google Sheets service inactive.");
                }

                if (!TCOSheetsInterface.WriteTimeNowToCell(
                        m_userPrefs.getLogGoogleId(index),
                        m_userPrefs.getProjectName(index),
                        m_timeStr, m_userPrefs.getProjectDescription(index)))
                {
                    Console.WriteLine("Attempt to log to google sheets failed.");
                    return;
                }

                m_timeConfirmed     += m_timePending;
                m_timePending        = 0;
                m_logTimeAccumulator = 0;
                Console.WriteLine("Total time logged is " + m_timeStr);
            }
            else
            {
                Console.WriteLine("Log failed");
            }
        }