public static INotification ToEvent(this EntityEntry entry) { Type type = entry.Entity.GetType(); INotification evt = null; if (type == typeof(Directory)) { evt = new DirectoryUpdated(((Directory)entry.Entity).Id); } else if (type == typeof(Workspace)) { evt = new WorkspaceUpdated(((Workspace)entry.Entity).Id); } else if (type == typeof(File)) { evt = new FileUpdated(((File)entry.Entity).Id, true); } return(evt); }
/// <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(); }