public void Schedule(LocalContentLoader jobOwner, LoadJob job) { runningJobs.Add(job, jobOwner); jobSystem.AddWork(job); }
private void CheckChanged(Application application) { //has the file changed? DateTime modifiedTime = File.GetLastWriteTime(this.filename); ParticleSystem system = this.system.Target as ParticleSystem; if (system == null) { //particle system is no longer return; } if (sourceFileModifiedDate < modifiedTime) { sourceFileModifiedDate = modifiedTime; //particle system source has changed... //attempt to reload ParticleSystemData previousData = loadedSystemData; try { XmlDocument doc = new XmlDocument(); doc.Load(this.filename); XmlElement root = doc.SelectSingleNode("particlesystem") as XmlElement; if (root == null) { throw new ArgumentException("Missing XML root element \'particlesystem\'"); } loadedSystemData = new ParticleSystemData(this.filename, root, TargetPlatform.Windows, false, null); LocalContentLoader content = new LocalContentLoader(loadedSystemData); application.Content.Add(content); system.SetParticleSystemHotloadedData(loadedSystemData); if (previousData != null) { //previous hot load has existing data still hanging around foreach (ParticleSystemTypeData typeData in previousData.ParticleTypeData) { //this is nasty //eeek! this texture was loaded with FromFile().... if (typeData.Texture != null) { typeData.Texture.Dispose(); } } } } catch (Exception ex) { loadedSystemData = null; try { //show a message //the difficult way... string assembly = @"System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; Type type = System.Reflection.Assembly.Load(assembly).GetType("System.Windows.Forms.MessageBox"); System.Reflection.MethodInfo method = type.GetMethod("Show", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static, null, new Type[] { typeof(string), typeof(string) }, null); method.Invoke(null, new string[] { ex.ToString(), "Error importing updated particle system" }); } catch { throw ex; } } } }
private void CheckChanged(Application application) { //has the file changed? DateTime modifiedTime = File.GetLastWriteTime(this.filename); ParticleSystem system = this.system.Target as ParticleSystem; if (system == null) { //particle system is no longer return; } if (sourceFileModifiedDate < modifiedTime) { sourceFileModifiedDate = modifiedTime; //particle system source has changed... //attempt to reload ParticleSystemData previousData = loadedSystemData; try { XmlDocument doc = new XmlDocument(); doc.Load(this.filename); XmlElement root = doc.SelectSingleNode("particlesystem") as XmlElement; if (root == null) throw new ArgumentException("Missing XML root element \'particlesystem\'"); loadedSystemData = new ParticleSystemData(this.filename, root, ContentTargetPlatform.Windows, false, null, pathToShaderSystem); LocalContentLoader content = new LocalContentLoader(loadedSystemData); application.Content.Add(content); system.SetParticleSystemHotloadedData(loadedSystemData); if (previousData != null) { //previous hot load has existing data still hanging around foreach (ParticleSystemTypeData typeData in previousData.ParticleTypeData) { //this is nasty //eeek! this texture was loaded with FromFile().... if (typeData.Texture != null) typeData.Texture.Dispose(); } } } catch (Exception ex) { loadedSystemData = null; try { //show a message //the difficult way... string assembly = @"System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; Type type = System.Reflection.Assembly.Load(assembly).GetType("System.Windows.Forms.MessageBox"); System.Reflection.MethodInfo method = type.GetMethod("Show", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static, null, new Type[] { typeof(string), typeof(string) }, null); method.Invoke(null, new string[] { ex.ToString(), "Error importing updated particle system" }); } catch { throw ex; } } } }