Now() public method

Sets a flash that will not be available to the next action, only to the current. Flash.Now( key, "Hello current action" )

This method enables you to use the flash as a central messaging system in your app. When you need to pass an object to the next action, you use the standard flash assign ([]=). When you need to pass an object to the current action, you use Now, and your object will vanish when the current action is done.

Entries set via Now are accessed the same way as standard entries: Flash['my-key'].

public Now ( object key, object value ) : void
key object
value object
return void
Exemplo n.º 1
0
		public void FlashKeep()
		{
			Flash flash = new Flash();

			flash.Now("test1","hello");
			flash.Now("test2","hello");

			flash.Keep("test1");

			flash.Sweep();

			Assert.IsTrue( flash.ContainsKey("test1") );
			Assert.IsFalse( flash.ContainsKey("test2") );

			flash = new Flash(flash);
			flash.Sweep();

			Assert.IsTrue( flash.Count == 0 );

			flash.Now("test1","hello");
			flash.Now("test2","hello");

			flash.Keep();

			flash.Sweep();

			Assert.IsTrue( flash.ContainsKey("test1") );
			Assert.IsTrue( flash.ContainsKey("test2") );
		}
Exemplo n.º 2
0
		public void FlashNow()
		{
			Flash flash = new Flash();

			flash.Now("test","hello");

			Assert.IsTrue( flash.ContainsKey("test") );

			flash.Sweep();

			Assert.IsFalse( flash.ContainsKey("test") );
		}