Пример #1
0
 private static bool LoadTextures(IEnumerable<string> textures, DemoModel demo, ErrorEventHandler progressHandler)
 {
     foreach (var tex in textures)
     {
         bool success = demo.Textures.AddUpdate(tex);
         if(null != progressHandler)
         {
             var msg = success ? "Texture file '" + tex + "' loaded" : "Could not load texture file '" + tex + "'";
             var args = new ProgressEventArgs(msg);
             progressHandler(demo, args);
             if (args.Cancel) return false;
         }
     }
     return true;
 }
Пример #2
0
 private static bool LoadSound(string soundFileName, DemoModel demo, ErrorEventHandler progressHandler)
 {
     if (!string.IsNullOrWhiteSpace(soundFileName))
     {
         var sound = DemoTimeSource.FromMediaFile(soundFileName);
         if (null == sound && null != progressHandler)
         {
             var args = new ProgressEventArgs("Could not load sound file '" + soundFileName + "'");
             progressHandler(demo, args);
             if (args.Cancel) return false;
         }
         demo.TimeSource.Load(sound);
         if (null != sound && null != progressHandler)
         {
             var args = new ProgressEventArgs("Sound file '" + soundFileName + "' loaded");
             progressHandler(demo, args);
             if (args.Cancel) return false;
         }
     }
     return true;
 }