Axiom.Samples.SampleContext.RunSample C# (CSharp) Метод

RunSample() публичный Метод

Quits the current sample and starts a new one.
public RunSample ( Sample s ) : void
s Sample
Результат void
		public virtual void RunSample( Sample s )
		{
			if ( CurrentSample != null )
			{
				CurrentSample.Shutdown();    // quit current sample
				this.IsSamplePaused = false;          // don't pause the next sample
			}

			RenderWindow.RemoveAllViewports();                  // wipe viewports

			if ( s != null )
			{
				// retrieve sample's required plugins and currently installed plugins
				var ip = PluginManager.Instance.InstalledPlugins;
				IList<String> rp = s.RequiredPlugins;

				string errorMsg = String.Empty;
				foreach ( string pluginName in rp )
				{
					bool found = false;
					//try to find the required plugin in the current installed plugins
					foreach ( IPlugin plugin in ip )
					{
						//if(plugin.na
						found = true;
						break;
					}

					if ( !found )  // throw an exception if a plugin is not found
					{
						String desc = String.Format( "Sample requires plugin: {0}", pluginName );
						this.Log( desc );
						errorMsg += desc + Environment.NewLine;
					}
				}
				if ( errorMsg != String.Empty )
					throw new AxiomException( errorMsg );

				// throw an exception if samples requires the use of another renderer
				errorMsg = String.Empty;
				String rrs = s.RequiredRenderSystem;
				if ( !String.IsNullOrEmpty( rrs ) && rrs != this.Root.RenderSystem.Name )
				{
					String desc = "Sample only runs with renderer: {0}";
					throw new AxiomException( desc, rrs );
				}

				// test system capabilities against sample requirements
				s.TestCapabilities( Root.RenderSystem.Capabilities );

				s.Setup( RenderWindow, this.Keyboard, this.Mouse );   // start new sample
			}

			CurrentSample = s;
		}