Ejemplo n.º 1
0
        /// <summary>
        /// Stores the list of designs for a site model
        /// </summary>
        private void Store(Guid siteModelId, IDesigns designs)
        {
            try
            {
                using var stream = designs.ToStream();
                if (_writeStorageProxy.WriteStreamToPersistentStore(siteModelId, DESIGNS_STREAM_NAME, FileSystemStreamType.Designs, stream, designs) == FileSystemErrorStatus.OK)
                {
                    _writeStorageProxy.Commit();
                }

                // Notify the mutable and immutable grid listeners that attributes of this site model have changed
                var sender = DIContext.Obtain <ISiteModelAttributesChangedEventSender>();
                sender.ModelAttributesChanged(SiteModelNotificationEventGridMutability.NotifyAll, siteModelId, designsChanged: true);
            }
            catch (Exception e)
            {
                throw new TRexException("Exception writing updated designs cache element to Ignite", e);
            }
        }
Ejemplo n.º 2
0
        private void btnListDesigns_Click(object sender, EventArgs e)
        {
            try
            {
                if (GetSiteModelID(out Guid SiteModelID))
                {
                    IDesigns designList = designManager.List(SiteModelID);

                    if (designList == null || designList.Count == 0)
                    {
                        MessageBox.Show(@"No designs");
                    }
                    else
                    {
                        MessageBox.Show("Designs:\n" + designList.Select(x => x.ToString() + "\n").Aggregate((s1, s2) => s1 + s2));
                    }
                }
            }
            catch (Exception E)
            {
                MessageBox.Show($@"Exception: {E}");
            }
        }