public Transformer() { // // Required for Windows Form Designer support // InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); Text = "COMP 4560: Assignment 5 (201230) Joseph Krump"; ResizeRedraw = true; BackColor = Color.Black; MenuItem miNewDat = new MenuItem("New &Data...", new EventHandler(MenuNewDataOnClick)); MenuItem miExit = new MenuItem("E&xit", new EventHandler(MenuFileExitOnClick)); MenuItem miDash = new MenuItem("-"); MenuItem miFile = new MenuItem("&File", new MenuItem[] {miNewDat, miDash, miExit}); MenuItem miAbout = new MenuItem("&About", new EventHandler(MenuAboutOnClick)); Menu = new MainMenu(new MenuItem[] {miFile, miAbout}); refresh += InvalidateWindow; }
public TweetScreenController(IEventAggregator aggregator, IRegion region, ITweetScreenFactory screenFactory, ITimeLineFactory timeLineFactory) { _aggregator = aggregator; _region = region; _factory = screenFactory; _timeLineFactory = timeLineFactory; _aggregator.GetEvent<AuthorizationStateChangedEvent>().Subscribe( WhenAuthorizationStateChanged, true); _refreshEvent = _aggregator.GetEvent<RefreshEvent>(); }
public virtual void OnRefresh(RefreshEvent @event, IDictionary refreshedAlready) { IEventSource source = @event.Session; if (source.PersistenceContext.ReassociateIfUninitializedProxy(@event.Entity)) return; object obj = source.PersistenceContext.UnproxyAndReassociate(@event.Entity); if (refreshedAlready.Contains(obj)) { log.Debug("already refreshed"); return; } EntityEntry e = source.PersistenceContext.GetEntry(obj); IEntityPersister persister; object id; if (e == null) { persister = source.GetEntityPersister(null, obj); //refresh() does not pass an entityName id = persister.GetIdentifier(obj, source.EntityMode); if (log.IsDebugEnabled) { log.Debug("refreshing transient " + MessageHelper.InfoString(persister, id, source.Factory)); } EntityKey key = new EntityKey(id, persister, source.EntityMode); if (source.PersistenceContext.GetEntry(key) != null) { throw new PersistentObjectException("attempted to refresh transient instance when persistent instance was already associated with the Session: " + MessageHelper.InfoString(persister, id, source.Factory)); } } else { if (log.IsDebugEnabled) { log.Debug("refreshing " + MessageHelper.InfoString(e.Persister, e.Id, source.Factory)); } if (!e.ExistsInDatabase) { throw new HibernateException("this instance does not yet exist as a row in the database"); } persister = e.Persister; id = e.Id; } // cascade the refresh prior to refreshing this entity refreshedAlready[obj] = obj; new Cascade(CascadingAction.Refresh, CascadePoint.BeforeRefresh, source).CascadeOn(persister, obj, refreshedAlready); if (e != null) { EntityKey key = new EntityKey(id, persister, source.EntityMode); source.PersistenceContext.RemoveEntity(key); if (persister.HasCollections) new EvictVisitor(source).Process(obj, persister); } if (persister.HasCache) { CacheKey ck = new CacheKey(id, persister.IdentifierType, persister.RootEntityName, source.EntityMode, source.Factory); persister.Cache.Remove(ck); } EvictCachedCollections(persister, id, source.Factory); // NH Different behavior : NH-1601 // At this point the entity need the real refresh, all elementes of collections are Refreshed, // the collection state was evicted, but the PersistentCollection (in the entity state) // is associated with a possible previous session. new WrapVisitor(source).Process(obj, persister); string previousFetchProfile = source.FetchProfile; source.FetchProfile = "refresh"; object result = persister.Load(id, obj, @event.LockMode, source); source.FetchProfile = previousFetchProfile; // NH Different behavior : we are ignoring transient entities without throw any kind of exception // because a transient entity is "self refreshed" if (!ForeignKeys.IsTransient(persister.EntityName, obj, result == null, @event.Session)) UnresolvableObjectException.ThrowIfNull(result, id, persister.EntityName); }
public virtual void OnRefresh(RefreshEvent @event) { OnRefresh(@event, IdentityMap.Instantiate(10)); }
protected virtual void onRaiseRefreshEvent(RefreshEvent e) { if (refreshEvent != null) refreshEvent(this, EventArgs.Empty); }
private void OnRefresh(object sender, EventArgs args) => RefreshEvent?.Invoke(sender, args);
public virtual void OnRefresh(RefreshEvent @event, IDictionary refreshedAlready) { IEventSource source = @event.Session; bool isTransient = !source.Contains(@event.Entity); if (source.PersistenceContext.ReassociateIfUninitializedProxy(@event.Entity)) { if (isTransient) { source.SetReadOnly(@event.Entity, source.DefaultReadOnly); } return; } object obj = source.PersistenceContext.UnproxyAndReassociate(@event.Entity); if (refreshedAlready.Contains(obj)) { log.Debug("already refreshed"); return; } EntityEntry e = source.PersistenceContext.GetEntry(obj); IEntityPersister persister; object id; if (e == null) { persister = source.GetEntityPersister(null, obj); //refresh() does not pass an entityName id = persister.GetIdentifier(obj, source.EntityMode); if (log.IsDebugEnabled) { log.Debug("refreshing transient " + MessageHelper.InfoString(persister, id, source.Factory)); } EntityKey key = new EntityKey(id, persister, source.EntityMode); if (source.PersistenceContext.GetEntry(key) != null) { throw new PersistentObjectException("attempted to refresh transient instance when persistent instance was already associated with the Session: " + MessageHelper.InfoString(persister, id, source.Factory)); } } else { if (log.IsDebugEnabled) { log.Debug("refreshing " + MessageHelper.InfoString(e.Persister, e.Id, source.Factory)); } if (!e.ExistsInDatabase) { throw new HibernateException("this instance does not yet exist as a row in the database"); } persister = e.Persister; id = e.Id; } // cascade the refresh prior to refreshing this entity refreshedAlready[obj] = obj; new Cascade(CascadingAction.Refresh, CascadePoint.BeforeRefresh, source).CascadeOn(persister, obj, refreshedAlready); if (e != null) { EntityKey key = new EntityKey(id, persister, source.EntityMode); source.PersistenceContext.RemoveEntity(key); if (persister.HasCollections) { new EvictVisitor(source).Process(obj, persister); } } if (persister.HasCache) { CacheKey ck = new CacheKey(id, persister.IdentifierType, persister.RootEntityName, source.EntityMode, source.Factory); persister.Cache.Remove(ck); } EvictCachedCollections(persister, id, source.Factory); // NH Different behavior : NH-1601 // At this point the entity need the real refresh, all elementes of collections are Refreshed, // the collection state was evicted, but the PersistentCollection (in the entity state) // is associated with a possible previous session. new WrapVisitor(source).Process(obj, persister); string previousFetchProfile = source.FetchProfile; source.FetchProfile = "refresh"; object result = persister.Load(id, obj, @event.LockMode, source); if (result != null) { if (!persister.IsMutable) { source.SetReadOnly(result, true); } else { source.SetReadOnly(result, (e == null ? source.DefaultReadOnly : e.IsReadOnly)); } } source.FetchProfile = previousFetchProfile; // NH Different behavior : we are ignoring transient entities without throw any kind of exception // because a transient entity is "self refreshed" if (!ForeignKeys.IsTransient(persister.EntityName, obj, result == null, @event.Session)) { UnresolvableObjectException.ThrowIfNull(result, id, persister.EntityName); } }
public void OnRefresh(RefreshEvent @event) { log.Debug("OnRefresh :" + @event); }
public void OnRefresh(RefreshEvent @event, System.Collections.IDictionary refreshedAlready) { log.Debug("OnRefresh :" + @event); }