internal SessionSimpleDbAttributeCollection(IInternalContext context, SessionSimpleDbItem item, XElement data, bool complete)
        {
            _item = item;
            _complete = complete;

            var result = new Dictionary<string, SessionSimpleDbAttribute>();

            try
            {
                var subResult = data.Descendants(sdbNs + "Attribute").Select(
                        x => new SessionSimpleDbAttribute(
                            _item,
                            x.Element(sdbNs + "Name").Value,
                            x.Elements(sdbNs + "Value").
                            Select(val => val.Value).ToArray()
                        )
                    );
                foreach (var resItem in subResult) {
                    if (!result.Keys.Contains(resItem.Name)) {
                        result.Add(resItem.Name, resItem);
                    }
                    else {
                        result[resItem.Name].Value = new SimpleDbAttributeValue(
                            result[resItem.Name].Value.Values.Concat(resItem.Value.Values).ToArray());
                    }
                }

                _attributes = result;
            }
            catch (Exception ex)
            {
                throw new SimpleDbException("The response from SimpleDB was not valid", ex);
            }
        }
Esempio n. 2
0
        private void OnWindowTextChanged(object sender, TextUpdatedEventArgs e)
        {
            SynchronizationContext syncContext = SynchronizationContext.Current;

            Task.Run(async() =>
            {
                mutex.WaitOne();
                if (lastContext != null && waitTask.IsCompleted == false)
                {
                    if (waitTask.IsCompleted == false)
                    {
                        lastContext.InternalCancellationProvider.Cancel();
                        waitTask.Wait();
                    }
                    lastContext.Dispose();
                }
                Command command          = new Command(e.Value);
                IInternalContext context = new QuickContext(command);
                AppDelegate app          = appBuilder.Build();
                await app(context);
                lastContext = context;
                syncContext.Send(s =>
                                 waitTask = lastContext.WaitResults(actions).ContinueWith(tsk =>
                {
                    if (tsk.Status == TaskStatus.RanToCompletion)
                    {
                        syncContext.Send(st => window.OnActionUpdateCompleted(), null);
                    }
                }), null);
                mutex.Set();
            });
        }
        internal EntitySet(IInternalContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.internalContext   = context;
            this.internalEntitySet = context.GetAll <TEntity>();
        }
 internal SessionSimpleDbItem(IInternalContext context, ISimpleDbDomain domain, string name, XElement data, bool complete)
 {
     _domain = domain;
     _context = context;
     _data = data;
     try
     {
         _name = name;
         _attributes = new SessionSimpleDbAttributeCollection(_context, this, _data, complete);
     }
     catch (Exception ex)
     {
         throw new SimpleDbException("The response from SimpleDB was not valid", ex);
     }
     _context.Session.Attach(this);
 }
        internal SessionSimpleDbAttributeCollection(IInternalContext context, SessionSimpleDbItem item, XElement data, bool complete)
        {
            _context = context;
            _item = item;
            _complete = complete;

            var result = new Dictionary<string, SessionSimpleDbAttribute>();

            try
            {
                AddAttributeData(data);
            }
            catch (Exception ex)
            {
                throw new SimpleDbException("The response from SimpleDB was not valid", ex);
            }
        }
Esempio n. 6
0
 internal SessionSimpleDbDomain(IInternalContext context, string name, XElement data)
 {
     _name = name;
     _data = data;
     _context = context;
     try
     {
         _attributeNameCount = long.Parse(_data.Element(sdbNs + "AttributeNameCount").Value);
         _attributeValueCount = long.Parse(_data.Element(sdbNs + "AttributeValueCount").Value);
         _totalItemNameSize = long.Parse(_data.Element(sdbNs + "TotalItemNameSize").Value);
         _totalAttributeValueSize = long.Parse(_data.Element(sdbNs + "TotalAttributeValueSize").Value);
         _totalAttributeNameSize = long.Parse(_data.Element(sdbNs + "TotalAttributeNameSize").Value);
         _itemCount = long.Parse(_data.Element(sdbNs + "ItemCount").Value);
     }
     catch (Exception ex)
     {
         throw new SimpleDbException("The response from SimpleDB was not valid", ex);
     }
 }
 internal SessionNewSimpleDbItem(IInternalContext context, ISimpleDbDomain domain, string name, Dictionary<string, SimpleDbAttributeValue> values)
     : base(context, domain, name, ToXElement(values), true)
 {
     context.Session.Attach (this);
 }
 internal SessionSimpleDbItem(IInternalContext context, ISimpleDbDomain domain, XElement data, bool complete)
     : this(context, domain, data.Element(sdbNs + "Name").Value, data, complete)
 {
 }
Esempio n. 9
0
 internal ProxySimpleDbDomain(string name, Dictionary<string, ISimpleDbDomain> loadedDomains, IInternalContext context)
 {
     _name = name;
     _loadedDomains = loadedDomains;
     _context = context;
 }
 public void CopyTo(IInternalContext target)
 {
     target.SdkVersion   = SdkVersion;
     target.AgentVersion = AgentVersion;
     target.NodeName     = NodeName;
 }
 internal SessionSimpleDbDomainCollection(IInternalContext session)
 {
     _session = session;
 }