Пример #1
0
 private static bool LoadSound(string soundFileName, DemoModel demo, ErrorEventHandler progressHandler)
 {
     if (!string.IsNullOrWhiteSpace(soundFileName))
     {
         var sound = DemoTimeSource.FromMediaFile(soundFileName);
         if (ReferenceEquals(null, sound) && !ReferenceEquals(null, progressHandler))
         {
             var args = new ProgressEventArgs("Could not load sound file '" + soundFileName + "'");
             progressHandler(demo, args);
             if (args.Cancel)
             {
                 return(false);
             }
         }
         demo.TimeSource.Load(sound, soundFileName);
         if (!ReferenceEquals(null, sound) && !ReferenceEquals(null, progressHandler))
         {
             var args = new ProgressEventArgs("Sound file '" + soundFileName + "' loaded");
             progressHandler(demo, args);
             if (args.Cancel)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #2
0
        public DemoModel(VisualContext visualContext, IShaders shaders, ITextures textures, bool isLooping)
        {
            uniforms        = new Uniforms();
            ShaderKeyframes = new ShaderKeyframes();
            TimeSource      = new DemoTimeSource(isLooping);

            this.visualContext = visualContext;
            Shaders            = shaders;
            Textures           = textures;
        }