Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(UtcTime.GetHashCode() * 397 + TimeZoneOffset.GetHashCode());
     }
 }
Exemplo n.º 2
0
 public bool Equals(ApiDateTime other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(UtcTime.Equals(other.UtcTime) && TimeZoneOffset.Equals(other.TimeZoneOffset));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Resets all properties, because there is no real logging out from Todoist.com
 /// </summary>
 public void LogOff()
 {
     this.id = 0;
     this.email = string.Empty;
     this.fullName = string.Empty;
     this.apiToken = string.Empty;
     this.startPage = new StartPage();
     this.timeZone = null;
     this.timeZoneOffset = new TimeZoneOffset();
     this.timeFormat = new TimeFormat();
     this.dateFormat = 0;
     this.sortOrder = SortOrder.OldestDatesFirst;
     this.notifoAccount = string.Empty;
     this.mobileNumber = string.Empty;
     this.mobileHost = string.Empty;
     this.premiumUntil = string.Empty;
     this.defaultReminder = new DefaultReminder();
     this.jsonData = string.Empty;
 }
Exemplo n.º 4
0
 public bool Equals(ApiDateTime other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return UtcTime.Equals(other.UtcTime)&& TimeZoneOffset.Equals(other.TimeZoneOffset);
 }
Exemplo n.º 5
0
        /// <summary>
        /// The analyse json.
        /// </summary>
        private void AnalyseJson()
        {
            JObject o = JObject.Parse(this.JsonData);
            this.notifoAccount = (string)o.SelectToken("notifo");
            this.apiToken = (string)o.SelectToken("api_token");
            switch ((int)o.SelectToken("time_format"))
            {
                case 0:
                    this.timeFormat = TimeFormat.TwentyFourHourClock;
                    break;
                case 1:
                    this.timeFormat = TimeFormat.TwelveHourClock;
                    break;
            }

            switch ((int)o.SelectToken("sort_order"))
            {
                case 0:
                    this.sortOrder = SortOrder.OldestDatesFirst;
                    break;
                case 1:
                    this.sortOrder = SortOrder.NewestDatesFirst;
                    break;
            }

            this.fullName = (string)o.SelectToken("full_name");
            this.mobileNumber = (string)o.SelectToken("mobile_number");
            this.mobileHost = (string)o.SelectToken("mobile_host");
            this.timeZone = (string)o.SelectToken("timezone");

            this.id = (int)o.SelectToken("id");

            switch ((int)o.SelectToken("date_format"))
            {
                case 0:
                    this.dateFormat = DateFormat.DdMmYyyy;
                    break;
                case 1:
                    this.dateFormat = DateFormat.MmDdYyyy;
                    break;
            }

            this.premiumUntil = (string)o.SelectToken("premium_until");

            JToken timeZoneString = o.SelectToken("tz_offset");
            this.timeZoneOffset = new TimeZoneOffset(
                timeZoneString.First.Value<string>(), 
                timeZoneString.First.Next.Value<int>(), 
                timeZoneString.First.Next.Next.Value<int>(), 
                timeZoneString.First.Next.Next.Next.Value<bool>());

            switch ((string)o.SelectToken("default_reminder"))
            {
                case "email":
                    this.defaultReminder = DefaultReminder.Email;
                    break;
                case "mobile":
                    this.defaultReminder = DefaultReminder.Mobile;
                    break;
                case "notifo":
                    this.defaultReminder = DefaultReminder.Notifo;
                    break;
                case "no_defalt":
                    this.defaultReminder = DefaultReminder.NoDefault;
                    break;
            }

            this.email = (string)o.SelectToken("email");
        }