public void ReportResult(PlayMedia playerDelegate)
 {
     if (playerDelegate() == 0)
     {
         Console.WriteLine("Media played successfully.");
     }
     else
     {
         Console.WriteLine("Media did not play successfully.");
     }
 }
示例#2
0
 public void ReportResult(PlayMedia playDelegate)
 {
     if (playDelegate() == 0)
     {
         Console.WriteLine("Success.");
     }
     else
     {
         Console.WriteLine("Fail.");
     }
 }
示例#3
0
 public void ReportResult(PlayMedia delegateInstanceVariable)
 {
     if (delegateInstanceVariable() == 0)
     {
         Console.WriteLine("Test play file - all good");
     }
     else
     {
         Console.WriteLine("Cannot play file");
     }
 }
示例#4
0
 public void ReportResult(PlayMedia playerDelegate)
 {
     if (playerDelegate() == 0)
     {
         Console.WriteLine("Media played successfully.");
     }
     else
     {
         Console.WriteLine("Media did not play successfully.");
     }
 }
示例#5
0
文件: Program.cs 项目: Sntai20/CSC180
 public void ReportResult(PlayMedia playerDelegate)
 {
     // Validate the media is working, then report the status.
     if (playerDelegate() == 0)
     {
         Console.WriteLine("Media played successfully.");
     }
     else
     {
         Console.WriteLine("Media did not play successfully.");
     }
 }
示例#6
0
        private void OnPlayMedia(object sender, RoutedEventArgs e)
        {
            var but = sender as Button;

            if (but.DataContext is ViewMediaMetadata)
            {
                var vmd = (ViewMediaMetadata)but.DataContext;
                PlayMedia?.Invoke(null, new PlayMediaEventArgs()
                {
                    ViewMediaMetadata = vmd
                });
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            AudioPlayer audioPlayer1 = new AudioPlayer();
            VideoPlayer videoPlayer1 = new VideoPlayer();

            PlayMedia one = new PlayMedia(audioPlayer1.PlayAudioFile);
            PlayMedia two = new PlayMedia(videoPlayer1.PlayVideoFile);

            MediaStorage myMediaStorage = new MediaStorage();

            myMediaStorage.ReportResult(one);
            myMediaStorage.ReportResult(two);


            Console.ReadLine();
        }
示例#8
0
        public void reportResult(PlayMedia status)
        {
            int statusInt = status();

            if (statusInt >= 0)
            {
                Console.WriteLine("The file played succesfully");
            }
            else if (statusInt == -99999)
            {
                Console.WriteLine("The operation was abandoned!");
            }
            else if (statusInt < 0)
            {
                Console.WriteLine("Error playing the file, the format was unsupported");
            }
            else
            {
                Console.WriteLine("Impossible");  //never going to happen, but you can not be too careful
            }
        }
示例#9
0
文件: VlcPlayer.cs 项目: deccer/SpyUO
        /// <summary>
        /// Initializes VLC.
        /// </summary>
        /// <param name="vlcInstallationFolder">VLC installation folder.</param>
        public static void Initialize(string vlcInstallationFolder)
        {
            if (_Inititalized)
            {
                return;
            }

            // Load dynamic dll
            string dllPath = Path.Combine(vlcInstallationFolder, "libvlccore.dll");

            if (!File.Exists(dllPath))
            {
                throw new Exception("Cannot find '" + dllPath + "'");
            }

            _CoreLibraryAddress = LoadLibrary(dllPath);

            if (_CoreLibraryAddress == IntPtr.Zero)
            {
                throw new Exception("Cannot load '" + dllPath + "'");
            }

            dllPath = Path.Combine(vlcInstallationFolder, "libvlc.dll");

            if (!File.Exists(dllPath))
            {
                throw new Exception("Cannot find '" + dllPath + "'");
            }

            _LibraryAddress = LoadLibrary(dllPath);

            if (_LibraryAddress == IntPtr.Zero)
            {
                throw new Exception("Cannot load '" + dllPath + "'");
            }

            if (GetVersion(vlcInstallationFolder) < RequiredVersion)
            {
                throw new Exception(String.Format("Invalid VLC version. Minimum version required is {0}", RequiredVersion));
            }

            // Get plugin folder
            _PluginsFolder = Path.Combine(vlcInstallationFolder, "plugins");

            if (!Directory.Exists(_PluginsFolder))
            {
                throw new Exception("Cannot find plugins folder '" + _PluginsFolder + "'");
            }

            _New                        = GetDelegate <New>("libvlc_new");
            _Release                    = GetDelegate <Release>("libvlc_release");
            _CreateMediaFromPath        = GetDelegate <CreateMediaFromPath>("libvlc_media_new_path");
            _ReleaseMedia               = GetDelegate <ReleaseMedia>("libvlc_media_release");
            _CreateMediaPlayerFromMedia = GetDelegate <CreateMediaPlayerFromMedia>("libvlc_media_player_new_from_media");
            _ReleasePlayer              = GetDelegate <ReleasePlayer>("libvlc_media_player_release");
            _IsPlayingMedia             = GetDelegate <IsPlayingMedia>("libvlc_media_player_play");
            _PlayMedia                  = GetDelegate <PlayMedia>("libvlc_media_player_play");
            _PauseMedia                 = GetDelegate <PauseMedia>("libvlc_media_player_pause");
            _StopMedia                  = GetDelegate <StopMedia>("libvlc_media_player_play");
            _GetMediaLength             = GetDelegate <GetMediaLength>("libvlc_media_player_get_length");
            _GetPlayerTime              = GetDelegate <GetPlayerTime>("libvlc_media_player_get_time");
            _SetPlayerTime              = GetDelegate <SetPlayerTime>("libvlc_media_player_set_time");
            _GetEventManager            = GetDelegate <GetEventManager>("libvlc_media_player_event_manager");
            _EventAttach                = GetDelegate <EventAttach>("libvlc_event_attach");

            _Inititalized = true;
        }
示例#10
0
 private void Start()
 {
     player    = GetComponent <Player>();
     leftHand  = transform.Find("LeftHand").GetComponent <PlayMedia>();
     rightHand = transform.Find("RightHand").GetComponent <PlayMedia>();
 }
示例#11
0
 // this is a higher-order function, ie. it uses a delegate
 public void ReportResult(PlayMedia playerDelegate)
 {
     Console.WriteLine(playerDelegate() == 0 ? "Media played successfully" : "Error in playing media.");
 }