public void AddSeansesFromVentursFile(List <string> files) { LoadingStarted.Invoke(this); foreach (string file in files) { List <Channel> channels = GetChannelsFromVentursFile(file); Parallel.ForEach(channels, channelInfo => { string pathPartToPaste = Path.GetDirectoryName(file); string pathPartToDelete = channelInfo.Directory.Substring(0, channelInfo.Directory.IndexOf("riClient") + 8); string channelDirectory = channelInfo.Directory.Replace(pathPartToDelete, pathPartToPaste).ToLower(); Seanse currentSeanse = Seanses.FirstOrDefault(x => x.Directory.FullName.ToLower() == channelDirectory); if (currentSeanse == null) { lock (Seanses) { LoadSeanse(channelDirectory); } } if (currentSeanse != null) { currentSeanse.ChannelInfo = channelInfo; } }); } LoadingEnded(this); }
private void OnLoadingStarted() { this.IsLoading = true; if (LoadingStarted != null) { LoadingStarted.Invoke(this, EventArgs.Empty); } }
public bool AddSeanse(string seanseDir) { bool result = false; lock (Seanses) { LoadingStarted.Invoke(this); result = LoadSeanse(seanseDir); LoadingEnded.Invoke(this); } return(result); }
public void AddAllSeansesFromFolder(string path) { lock (Seanses) { DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo[] childDirs = di.GetDirectories(); List <string> dirsInStock = Seanses.Select(x => x.Directory.FullName.ToLower()).ToList(); LoadingStarted.Invoke(this); Parallel.ForEach(childDirs, directory => { if (!dirsInStock.Contains(directory.FullName.ToLower())) { LoadSeanse(directory.FullName); } }); LoadingEnded.Invoke(this); } }
/// <summary> /// Load all modules in the Module Directory /// </summary> public static void LoadAll() { ModuleLoadOrder = ModuleLoadOrder ?? new Dictionary <int, UserModule>(); ModuleLoadOrder?.Clear(); var sysModule = UserModule.FromType(typeof(SystemCommands)); ModuleLoadOrder.Add(ModuleLoadOrder.Count, sysModule); var directories = Directory.GetDirectories(ModuleDirectory, "*", SearchOption.TopDirectoryOnly); LoadingStarted?.Invoke(directories.Length); // Search through all directories and add user modules directories.ToList().ForEach(dir => { var um = GetModuleFromDirectory(dir); // If a module is detected, add it to the ModuleLoadOrder dictionary if (um != null) { var index = ModuleLoadOrder.Count + 1; var canUse = false; do { if (!ModuleLoadOrder.ContainsKey(index)) { canUse = true; ModuleLoadOrder.Add(index, um); ModuleLoaded?.Invoke(um); } else { index++; } } while(canUse == false); } }); LoadingEnded?.Invoke(); }
public static async Task LoadAllAsync() { ModuleLoadOrder = ModuleLoadOrder ?? new Dictionary <int, UserModule>(); ModuleLoadOrder?.Clear(); var sysModule = await UserModule.FromTypeAsync(typeof(SystemCommands)); ModuleLoadOrder.Add(ModuleLoadOrder.Count, sysModule); var directories = Directory.GetDirectories(ModuleDirectory, "*", SearchOption.TopDirectoryOnly); LoadingStarted?.Invoke(directories.Length); var foundModules = await GetModulesFromDirectoriesAsync(directories); foundModules.ForEach(um => { var index = ModuleLoadOrder.Count + 1; var canUse = false; do { if (!ModuleLoadOrder.ContainsKey(index)) { canUse = true; ModuleLoadOrder.Add(index, um); ModuleLoaded?.Invoke(um); } else { index++; } } while(canUse == false); }); LoadingEnded?.Invoke(); }
void IImageSourcePartEvents.LoadingStarted() { IsLoading = true; LoadingStarted?.Invoke(); }
void IImageSourcePartEvents.LoadingStarted() => LoadingStarted?.Invoke();
public void OnLoadingStarted() { LoadingStarted?.Invoke(this, new EventArgs()); }
protected void Loading() { LoadingStarted?.Invoke(this, EventArgs.Empty); }