public void Reload() { plugins.Clear(); tokens.Clear(); List <string> loadErrors = new List <string>(2); IEnumerable <Plugin> LoadPluginsFrom(string path, PluginGroup group) { if (!Directory.Exists(path)) { yield break; } foreach (string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)) { Plugin plugin; try{ plugin = PluginLoader.FromFolder(fullDir, group); }catch (Exception e) { loadErrors.Add(group.GetIdentifierPrefix() + Path.GetFileName(fullDir) + ": " + e.Message); continue; } yield return(plugin); } } plugins.UnionWith(LoadPluginsFrom(PathOfficialPlugins, PluginGroup.Official)); plugins.UnionWith(LoadPluginsFrom(PathCustomPlugins, PluginGroup.Custom)); Reloaded?.Invoke(this, new PluginErrorEventArgs(loadErrors)); }
public void Reload() { if (Reloaded != null) { Reloaded.Invoke(this, EventArgs.Empty); } }
protected void Reload(object state) { OnReload(state); GetConfiguration().GetReloadToken() .RegisterChangeCallback(Reload, null); Reloaded?.Invoke(this); }
private IEnumerable <TElement> Load(IEnumerable <Tuple <Id <FileInProject>, DocumentPath> > withFileIdsAndInfos) { List <Tuple <Id <FileInProject>, DocumentPath, TElement> > toLoad = new List <Tuple <Id <FileInProject>, DocumentPath, TElement> >(); foreach (var fileInfo in withFileIdsAndInfos) { TryAddToLoadList(toLoad, fileInfo.Item1, fileInfo.Item2); } List <TElement> result = m_loader(toLoad.Select(t => Tuple.Create(t.Item1, t.Item2))).ToList(); using (m_suppressibleGotChanged.SuppressCallback()) { for (int i = 0; i < result.Count; i++) { var conversation = result[i]; TElement existing = toLoad[i].Item3; m_data[conversation.Id] = conversation; if (existing != null) { Reloaded.Execute(existing, conversation); } else { Added.Execute(conversation); } } } return(this); }
public static void Reload() { _configs.Clear(); _featureSupported.Clear(); _installed.Reset(); ActionExtension.InvokeInMainThreadAsync(() => { Reloaded?.Invoke(null, EventArgs.Empty); }); }
public void ReloadSeries() { var views = items.Where(p => p.IsFinishedWithDate).ToList(); Series.Clear(); Counts.Clear(); foreach (var t in MovieViewModel.TypesDict) { int c = 0; var points = new List <DataModel>(); for (var dt = 2012; dt <= DateTime.Today.Year; dt = dt + 1) { var count = views.Count(p => p.FinishDate.Value.Year == dt && p.Type == t.Key); points.Add( new DataModel() { Year = dt, Count = count }); c = c + count; } var a = new StackedColumnSeries() { Values = new ChartValues <DataModel>(points), Title = t.Value, Fill = ConvertFuncs.TypeToBrushFunc(t.Key) }; Series.Add(a); Counts.Add(new CountClass(c, t.Key, t.Value)); } Totals = Counts.Sum(p => p.Count); Reloaded?.Invoke(null, EventArgs.Empty); }
private void Reload() { Beginning.Raise(this, EventArgs.Empty); Reloaded.Raise(this, EventArgs.Empty); Ending.Raise(this, EventArgs.Empty); Ended.Raise(this, EventArgs.Empty); }
private void ReloadObject(bool force) { lock (this) { var newHash = GetHash(); if (!force && (string.Equals(_section[ConfigurationObjectFactory.ReloadOnChangeKey], "false", StringComparison.OrdinalIgnoreCase) || string.Equals(newHash, _hash, StringComparison.Ordinal))) { return; } _hash = newHash; Reloading?.Invoke(this, EventArgs.Empty); var oldObject = Object; var newObject = CreateObject(); TransferState(oldObject, newObject); Object = newObject; (oldObject as IDisposable)?.Dispose(); Reloaded?.Invoke(this, EventArgs.Empty); } }
public void ReloadSeries() { var views = items.Where(p => p.States.IsStateDoneWithDate(StateEnum.Finished)).ToList(); Series.Clear(); Counts.Clear(); foreach (var t in MovieViewModel.TypesDict) { int c = 0; var points = new List <DateTimePoint>(); for (var dt = FirstDay; dt <= LastDay; dt = dt.AddDays(1)) { var count = views.Count(p => p.FinishDate == dt && p.Type == t.Key); points.Add( new DateTimePoint() { DateTime = dt, Value = count }); c = c + count; } var a = new StackedColumnSeries() { Values = new ChartValues <DateTimePoint>(points), Title = t.Value, Fill = ConvertFuncs.TypeToBrushFunc(t.Key) }; Series.Add(a); Counts.Add(new CountClass(c, t.Key, t.Value)); } Totals = Counts.Sum(p => p.Count); Reloaded?.Invoke(null, EventArgs.Empty); }
void w_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (MainForm.IsClosing) { return; } //Application.DoEvents(); XmlHelper rsp = e.Result as XmlHelper; if (rsp == null) { return; } _packages = new List <PackageHandler>(); this.Definition = rsp.GetElement("Definition"); foreach (XmlElement each in rsp.GetElements("Package")) { PackageHandler ph = new PackageHandler(this, each); _packages.Add(ph); } Ready = true; if (Reloaded != null) { Reloaded.Invoke(this, EventArgs.Empty); } }
public void Clear() { m_data.Clear(); // Causes TreeListViewAdapter to clear everything, including the columns, and then // rebuild everything. Reloaded.Raise(this, EventArgs.Empty); }
private void ProjectServiceClosing(object sender, SledProjectServiceProjectEventArgs e) { UnsubscribeFromEvents(e.Project.DomNode); View = null; // Not actually used; just here to stop compiler warning Reloaded.Raise(this, EventArgs.Empty); }
/// <summary> /// Performs initialization when the adapter's node is set. /// Subscribes to events for DomNode tree changes and raises Reloaded event.</summary> protected override void OnNodeSet() { DomNode.AttributeChanged += (sender, e) => ItemChanged.Raise(this, new ItemChangedEventArgs <object>(e.DomNode)); DomNode.ChildInserted += (sender, e) => ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(e.Index, e.Child, e.Parent)); DomNode.ChildRemoved += (sender, e) => ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(e.Index, e.Child, e.Parent)); Reloaded.Raise(this, EventArgs.Empty); base.OnNodeSet(); }
internal static void reloadPendingResources() { if (reloadingInvoker.hasActions) { reloadingInvoker.InvokeActions(); isReloadingPerformed = true; Reloaded.Dispatch(); } }
/// <summary> /// Performs initialization when the adapter is connected to the tree view's DomNode</summary> protected override void OnNodeSet() { DomNode.AttributeChanged += root_AttributeChanged; DomNode.ChildInserted += root_ChildInserted; DomNode.ChildRemoved += root_ChildRemoved; Reloaded.Raise(this, EventArgs.Empty); base.OnNodeSet(); }
/// <summary> /// Performs initialization when the adapter is connected to the tree view's DomNode</summary> protected override void OnNodeSet() { DomNode.AttributeChanged += new EventHandler <AttributeEventArgs>(root_AttributeChanged); DomNode.ChildInserted += new EventHandler <ChildEventArgs>(root_ChildInserted); DomNode.ChildRemoved += new EventHandler <ChildEventArgs>(root_ChildRemoved); Reloaded.Raise(this, EventArgs.Empty); base.OnNodeSet(); }
private void Reload(object state) { notify = false; Updater(BindValue); ChangeNotifyable.GetReloadToken() .RegisterChangeCallback(Reload, null); notify = true; Reloaded?.Invoke(this); }
public void Reload(string defName) { var filePath = FindFile(defName, new string[] { }); if (!string.IsNullOrEmpty(filePath)) { var doc = ReadFromFile(filePath); _docs[filePath] = doc; Reloaded?.Invoke(this, defName); } }
protected override void OnNodeSet() { base.OnNodeSet(); DomNode.AttributeChanged += DomNode_AttributeChanged; DomNode.ChildInserted += DomNode_ChildInserted; DomNode.ChildRemoved += DomNode_ChildRemoved; Reloaded.Raise(this, EventArgs.Empty); m_gameDocumentRegistry = Globals.MEFContainer.GetExportedValue <GameDocumentRegistry>(); m_resourceConverterService = Globals.MEFContainer.GetExportedValue <ResourceConverterService>(); }
public void Reload() { UpdateCollector.Stop(); var items = WorkspaceScanner.Scan(); WorkspaceContainer.Clear(); items.ForEach(i => { WorkspaceContainer.Add(i); }); Reloaded?.Invoke(this, new EventArgs()); UpdateCollector.Start(); }
/// <summary> /// Load the usync settings from disk. /// </summary> public uSyncSettings LoadSettings() { uSyncSettings settings = new uSyncSettings(); var node = GetSettingsFile(); if (node == null) { logger.Warn <uSyncConfig>($"Failed to load the {uSyncBackOfficeConstants.ConfigFile} file from disk, working with defaults."); return(SaveSettings(settings)); } settings.RootFolder = ValueFromWebConfigOrDefault("Folder", node.Element("Folder").ValueOrDefault(settings.RootFolder)); settings.UseFlatStructure = ValueFromWebConfigOrDefault("FlatFolders", node.Element("FlatFolders").ValueOrDefault(true)); settings.ImportAtStartup = ValueFromWebConfigOrDefault("ImportAtStartup", node.Element("ImportAtStartup").ValueOrDefault(true)); settings.ExportAtStartup = ValueFromWebConfigOrDefault("ExportAtStartup", node.Element("ExportAtStartup").ValueOrDefault(false)); settings.ExportOnSave = ValueFromWebConfigOrDefault("ExportOnSave", node.Element("ExportOnSave").ValueOrDefault(true)); settings.UseGuidNames = ValueFromWebConfigOrDefault("UseGuidFilenames", node.Element("UseGuidFilenames").ValueOrDefault(false)); settings.ReportDebug = node.Element("ReportDebug").ValueOrDefault(false); settings.AddOnPing = node.Element("AddOnPing").ValueOrDefault(true); settings.RebuildCacheOnCompletion = node.Element("RebuildCacheOnCompletion").ValueOrDefault(false); settings.FailOnMissingParent = node.Element("FailOnMissingParent").ValueOrDefault(true); settings.CacheFolderKeys = node.Element("CacheFolderKeys").ValueOrDefault(true); // load the handlers var handlerSets = node.Element("HandlerSets"); if (handlerSets != null) { settings.HandlerSets = LoadHandlerSets(handlerSets, settings, out string defaultSet); settings.DefaultSet = defaultSet; } else { var handlers = node.Element("Handlers"); if (handlers != null) { // old config, load as default :( settings.HandlerSets = new List <HandlerSet>(); var defaultSet = LoadSingleHandlerSet(handlers, settings); settings.HandlerSets.Add(defaultSet); } } settings.CustomMappings = LoadAppKeysFromNode(node, "Mappings", true); // fire the loaded event, so things can tell when they are loaded. Reloaded?.Invoke(settings); return(settings); }
public void Reload() { foreach (Algorithm algorithm in algorithms) { algorithm.currentAction = 0; } running = false; step = false; currentAction = 0; Reloaded?.Invoke(this, new ReloadEventArgs()); }
/// <summary> /// принудительно пересоздать контекст /// </summary> public static void Reload() { if (_instance != null) { _instance.Dispose(); } _instance = new OverridePhotoEntities(); if (Reloaded != null) { Reloaded.Invoke(_instance, new EventArgs()); } }
public static void Reload() { _active = null; _configs.Clear(); _featureSupported.Clear(); _installed.Reset(); _audioDescriptionsSet = false; ActionExtension.InvokeInMainThreadAsync(() => { Reloaded?.Invoke(null, EventArgs.Empty); InvalidateFeatures(); GetExtraAudioLevels(); }); }
/// <summary> /// The unloads and reloads the plugin assemblies. /// This method throws if <see cref="IsUnloadable" /> is <c>false</c>. /// </summary> public void Reload() { EnsureNotDisposed(); if (!IsUnloadable) { throw new InvalidOperationException("Reload cannot be used because IsUnloadable is false"); } _context.Unload(); _context = (ManagedLoadContext)_contextBuilder.Build(); GC.Collect(); GC.WaitForPendingFinalizers(); Reloaded?.Invoke(this, new PluginReloadedEventArgs(this)); }
private void Update() { if (_isReloading) { if (_currentReloadTime < _reloadTime) { _currentReloadTime += Time.deltaTime; _isShooting = false; } else { Reloaded?.Invoke(); _isReloading = false; } } if (BulletsInClip <= 0) { Reload(); } _lastShootTime += Time.deltaTime; _lastBulletTime += Time.deltaTime; if (_isShooting && !_isReloading) { if (_lastShootTime >= _shootDelay) { _shootedBulletCount = 0; _lastShootTime = 0; } if (_shootedBulletCount < _bulletsCountInShot) { if (_lastBulletTime >= _bulletDelay) { _lastBulletTime = 0; _shootSound.Play(); Instantiate(_bullet, _shootPoint.position, Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + Random.Range(-_halfShootAngle, _halfShootAngle))); _bulletsInClip--; Shooted?.Invoke(); _shootedBulletCount++; } } else { _isShooting = false; } } }
public uSyncSettings LoadSettings() { uSyncSettings settings = new uSyncSettings(); var node = GetSettingsFile(); if (node == null) { return(SaveSettings(settings)); } settings.RootFolder = ValueFromWebConfigOrDefault("Folder", node.Element("Folder").ValueOrDefault(settings.RootFolder)); settings.UseFlatStructure = ValueFromWebConfigOrDefault("FlatFolders", node.Element("FlatFolders").ValueOrDefault(true)); settings.ImportAtStartup = ValueFromWebConfigOrDefault("ImportAtStartup", node.Element("ImportAtStartup").ValueOrDefault(true)); settings.ExportAtStartup = ValueFromWebConfigOrDefault("ExportAtStartup", node.Element("ExportAtStartup").ValueOrDefault(false)); settings.ExportOnSave = ValueFromWebConfigOrDefault("ExportOnSave", node.Element("ExportOnSave").ValueOrDefault(true)); settings.UseGuidNames = ValueFromWebConfigOrDefault("UseGuidFilenames", node.Element("UseGuidFilenames").ValueOrDefault(false)); settings.BatchSave = node.Element("BatchSave").ValueOrDefault(false); settings.ReportDebug = node.Element("ReportDebug").ValueOrDefault(false); settings.AddOnPing = node.Element("AddOnPing").ValueOrDefault(true); settings.RebuildCacheOnCompletion = node.Element("RebuildCacheOnCompletion").ValueOrDefault(false); settings.FailOnMissingParent = node.Element("FailOnMissingParent").ValueOrDefault(true); // load the handlers var handlerSets = node.Element("HandlerSets"); if (handlerSets != null) { settings.HandlerSets = LoadHandlerSets(handlerSets, settings, out string defaultSet); settings.DefaultSet = defaultSet; } else { var handlers = node.Element("Handlers"); if (handlers != null) { // old config, load as default :( settings.HandlerSets = new List <HandlerSet>(); var defaultSet = LoadSingleHandlerSet(handlers, settings); settings.HandlerSets.Add(defaultSet); } } // fire the loaded event, so things can tell when they are loaded. Reloaded?.Invoke(settings); return(settings); }
void Watcher_Changed(object sender, FileSystemEventArgs e) { if ((DateTime.Now - lastChange).Seconds > 5) //Avoid code executing multiple times { IEnumerable <string> sections = new string[] { "appSettings", "connectionStrings" }; if (sections.Any()) { foreach (string section in sections) { ConfigurationManager.RefreshSection(section); } } lastChange = DateTime.Now; Reloaded?.Invoke(this, EventArgs.Empty); } }
public void Reload() { plugins.Clear(); tokens.Clear(); loadErrors = new List <string>(2); foreach (Plugin plugin in LoadPluginsFrom(PathOfficialPlugins, PluginGroup.Official)) { plugins.Add(plugin); } foreach (Plugin plugin in LoadPluginsFrom(PathCustomPlugins, PluginGroup.Custom)) { plugins.Add(plugin); } Reloaded?.Invoke(this, new PluginErrorEventArgs(loadErrors)); }
public void Reload() { plugins.Clear(); List <string> errors = new List <string>(1); foreach (var result in PluginGroups.All.SelectMany(group => PluginLoader.AllInFolder(pluginFolder, pluginDataFolder, group))) { if (result.HasValue) { plugins.Add(result.Value); } else { errors.Add(result.Exception.Message); } } Reloaded?.Invoke(this, new PluginErrorEventArgs(errors)); }