Beispiel #1
0
        public void SetData(string name, Dictionary <ChannelInfo, TimeSeriesDouble> data)
        {
            Name = name;

            All.Clear();
            SelectedSites.Clear();

            foreach (var d in data)
            {
                var e = All.FirstOrDefault(a => a.Name == d.Key.Name);
                if (e == null)
                {
                    e = new SiteData {
                        Name = d.Key.Name
                    };
                    All.Add(e);
                }
                switch (d.Key.Component)
                {
                case FieldComponent.Unckown:
                    throw new Exception("неизвестная компонента");

                case FieldComponent.Gic:
                    e.Gic.Ts = d.Value;
                    break;

                case FieldComponent.Ex:
                    e.Ex.Ts = d.Value;
                    break;

                case FieldComponent.Ey:
                    e.Ey.Ts = d.Value;
                    break;

                case FieldComponent.Hx:
                    e.Hx.Ts = d.Value;
                    break;

                case FieldComponent.Hy:
                    e.Hy.Ts = d.Value;
                    break;

                case FieldComponent.Hz:
                    e.Hz.Ts = d.Value;
                    break;

                case FieldComponent.Dx:
                    e.Dhx.Ts = d.Value;
                    break;

                case FieldComponent.Dy:
                    e.Dhy.Ts = d.Value;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Beispiel #2
0
        private IObservable <Unit> ToggleSelected(StackExchangeSite site)
        {
            if (site.IsSelected)
            {
                SelectedSites.Add(site);
            }
            else
            {
                SelectedSites.Remove(site);
            }

            var hashSet = new HashSet <string>(SelectedSites.Select(s => s.api_site_parameter));

            return(BlobCache.UserAccount.InsertObject(_selectedSitesCacheKey, hashSet));
        }