diff --git a/Torch.Server/Views/ConfigControl.xaml.cs b/Torch.Server/Views/ConfigControl.xaml.cs index f16b980..75c0a5b 100644 --- a/Torch.Server/Views/ConfigControl.xaml.cs +++ b/Torch.Server/Views/ConfigControl.xaml.cs @@ -14,6 +14,7 @@ using Torch.Server.Managers; using Torch.Server.ViewModels; using Torch.Views; using VRage.Game.ModAPI; +using VRage.Serialization; namespace Torch.Server.Views { @@ -142,7 +143,9 @@ namespace Torch.Server.Views MessageBox.Show("A world is not selected."); return; } - + + if (w.Checkpoint.PromotedUsers == null) + w.Checkpoint.PromotedUsers = new SerializableDictionary(); d.Edit(w.Checkpoint.PromotedUsers.Dictionary); _instanceManager.DedicatedConfig.Administrators = w.Checkpoint.PromotedUsers.Dictionary.Where(k => k.Value >= MyPromoteLevel.Admin).Select(k => k.Key.ToString()).ToList(); } diff --git a/Torch.Server/Views/PluginBrowser.xaml.cs b/Torch.Server/Views/PluginBrowser.xaml.cs index 1e2707d..485d666 100644 --- a/Torch.Server/Views/PluginBrowser.xaml.cs +++ b/Torch.Server/Views/PluginBrowser.xaml.cs @@ -40,6 +40,7 @@ namespace Torch.Server.Views private string PreviousSearchQuery = ""; private string _description = "Loading data from server, please wait.."; + private static object _syncLock = new object(); public string CurrentDescription { get { return _description; } @@ -55,18 +56,21 @@ namespace Torch.Server.Views InitializeComponent(); var installedPlugins = pluginManager.Plugins; + BindingOperations.EnableCollectionSynchronization(Plugins,_syncLock); Task.Run(async () => { var res = await PluginQuery.Instance.QueryAll(); if (res == null) return; foreach (var item in res.Plugins.OrderBy(i => i.Name)) { - if (installedPlugins.Keys.Contains(Guid.Parse(item.ID))) - item.Installed = true; - - Plugins.Add(item); - PluginsList.Dispatcher.Invoke(() => PluginsList.SelectedIndex = 0); - PluginsSource.Add(item); + lock (_syncLock) + { + if (installedPlugins.Keys.Contains(Guid.Parse(item.ID))) + item.Installed = true; + Plugins.Add(item); + PluginsList.Dispatcher.Invoke(() => PluginsList.SelectedIndex = 0); + PluginsSource.Add(item); + } } CurrentDescription = "Please select a plugin..."; });