예제 #1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy || !IsLoggedIn)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Datapoints.Clear();
                var items = await DataStore.GetItemsAsync(true);

                foreach (var item in items)
                {
                    var _item = new Datapoint()
                    {
                        Category      = item.Category,
                        TextFromAudio = item.TextFromAudio ?? "!null!",
                        Datetime      = item.Datetime
                    };
                    Datapoints.Add(_item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
        /// <summary>
        /// Returns true if ItemHistoryDTO instances are equal
        /// </summary>
        /// <param name="input">Instance of ItemHistoryDTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ItemHistoryDTO input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                     ) &&
                 (
                     Totalrecords == input.Totalrecords ||
                     (Totalrecords != null &&
                      Totalrecords.Equals(input.Totalrecords))
                 ) &&
                 (
                     Datapoints == input.Datapoints ||
                     (Datapoints != null &&
                      Datapoints.Equals(input.Datapoints))
                 ) &&
                 (
                     Data == input.Data ||
                     Data != null &&
                     Data.SequenceEqual(input.Data)
                 ));
        }
예제 #3
0
        public SearchItemDTO(string uniqueid, string alias, bool required, string[] datapoints, string raw)
        {
            this.UniqueID   = uniqueid;
            this.Required   = required;
            this.Datapoints = datapoints;
            this.Raw        = raw;
            int missingcount = Datapoints.Where(x => string.IsNullOrEmpty(x)).Count();
            int totalcount   = Datapoints.Count();

            this.PctMissing = (((double)missingcount) / ((double)totalcount)) * 100;;
            this.Alias      = alias;
        }
예제 #4
0
        public bool Equals(Series input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Datapoints == input.Datapoints ||
                     (Datapoints != null && Datapoints.SequenceEqual(input.Datapoints))
                     ) &&
                 (
                     Target == input.Target ||
                     (Target != null && Target.Equals(input.Target))
                 ));
        }
예제 #5
0
 public void Update(Series?other)
 {
     if (other is null)
     {
         return;
     }
     if (!Datapoints.DeepEqualsList(other.Datapoints))
     {
         Datapoints = other.Datapoints;
         OnPropertyChanged(nameof(Datapoints));
     }
     if (Target != other.Target)
     {
         Target = other.Target;
         OnPropertyChanged(nameof(Target));
     }
 }
예제 #6
0
        public void UpdateFromXMLAPI(IEnumerable <XMLAPI.StateList.Datapoint> list)
        {
            foreach (var cgi_dp in list)
            {
                string type = Datapoint.MapDatapointType(cgi_dp, this);

                Datapoint dp = null;
                if (Datapoints.TryGetValue(type, out dp))
                {
                    dp.UpdateFromXMLAPI(cgi_dp);
                }
                else
                {
                    dp = new Datapoint(cgi_dp, this);
                    Datapoints.Add(type, dp);
                }
            }
        }
예제 #7
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Totalrecords != null)
         {
             hashCode = hashCode * 59 + Totalrecords.GetHashCode();
         }
         if (Datapoints != null)
         {
             hashCode = hashCode * 59 + Datapoints.GetHashCode();
         }
         if (Data != null)
         {
             hashCode = hashCode * 59 + Data.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #8
0
 public bool DeepEquals(Series?other)
 {
     return(other is not null &&
            Datapoints.DeepEqualsList(other.Datapoints) &&
            Target == other.Target);
 }