Esempio n. 1
0
 /*
  * (non-Javadoc)
  * @see org.javarosa.core.services.properties.IPropertyRules#getHumanReadableDescription(java.lang.String)
  */
 public virtual System.String getHumanReadableDescription(System.String propertyName)
 {
     if (DEVICE_ID_PROPERTY.Equals(propertyName))
     {
         return("Unique Device ID");
     }
     else if (LOGS_ENABLED.Equals(propertyName))
     {
         return("Device Logging");
     }
     else if (CURRENT_LOCALE.Equals(propertyName))
     {
         return(Localization.get_Renamed("settings.language"));
     }
     else if (OPENROSA_API_LEVEL.Equals(propertyName))
     {
         return("OpenRosa API Level");
     }
     return(propertyName);
 }
Esempio n. 2
0
        /* ==== Parsing to Human Text ==== */

        /// <summary> Provides text representing a span of time.
        ///
        /// </summary>
        /// <param name="f">The fields for the date to be compared against the current date.
        /// </param>
        /// <returns> a string which is a human readable representation of the difference between
        /// the provided date and the current date.
        /// </returns>
        private static System.String formatDaysFromToday(DateFields f)
        {
            System.String   daysAgoStr = "";
            System.DateTime d          = DateUtils.getDate(f);
            System.DateTime tempAux    = System.DateTime.Now;
            //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'"
            int daysAgo = DateUtils.daysSinceEpoch(ref tempAux) - DateUtils.daysSinceEpoch(ref d);

            if (daysAgo == 0)
            {
                return(Localization.get_Renamed("date.today"));
            }
            else if (daysAgo == 1)
            {
                return(Localization.get_Renamed("date.yesterday"));
            }
            else if (daysAgo == 2)
            {
                return(Localization.get_Renamed("date.twoago", new System.String[] { System.Convert.ToString(daysAgo) }));
            }
            else if (daysAgo > 2 && daysAgo <= 6)
            {
                return(Localization.get_Renamed("date.nago", new System.String[] { System.Convert.ToString(daysAgo) }));
            }
            else if (daysAgo == -1)
            {
                return(Localization.get_Renamed("date.tomorrow"));
            }
            else if (daysAgo < -1 && daysAgo >= -6)
            {
                return(Localization.get_Renamed("date.nfromnow", new System.String[] { System.Convert.ToString(-daysAgo) }));
            }
            else
            {
                return(DateUtils.formatDate(f, DateUtils.FORMAT_HUMAN_READABLE_SHORT));
            }
        }