Esempio n. 1
0
        /// <summary>
        /// Request the contents of a specified directory on the host machine.
        /// </summary>
        /// <returns>The directory contents.</returns>
        /// <param name="location">Location, default is the user's home folder file://~</param>
        public async Task <VlcDirectoryItem[]> GetDirectoryContents(string location = "file://~")
        {
            string uri = "requests/browse.xml?uri=" + Uri.EscapeDataString(location);

            HttpResponseMessage response = await client.GetAsync(uri);

            // TODO: throw exception?
            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }

            var stream = await response.Content.ReadAsStreamAsync();

            VlcDirectoryResponse dir = (VlcDirectoryResponse)directorySerializer.Deserialize(stream);

            DirectoryUpdated?.Invoke(this, dir.Items);

            return(dir.Items);
        }
 public void RaiseEvent(object state)
 {
     DirectoryUpdated?.Invoke();
 }