Exemplo n.º 1
0
        // ReSharper disable once UnusedMember.Local
        private static int RegisterModItem(SObject modItem)
        {
            if (modItem.HasBeenRegistered)
            {
                Log.AsyncR($"The item {modItem.Name} has already been registered with ID {modItem.RegisteredId}");
                return(modItem.RegisteredId);
            }
            var newId = LowestModItemID;

            if (ModItems.Count > 0)
            {
                newId = Math.Max(LowestModItemID, ModItems.OrderBy(x => x.Key).First().Key + 1);
            }
            ModItems.Add(newId, modItem);
            modItem.HasBeenRegistered = true;
            modItem.RegisteredId      = newId;
            return(newId);
        }
Exemplo n.º 2
0
        public static Int32 RegisterModItem(SObject modItem)
        {
            if (modItem.HasBeenRegistered)
            {
                Program.LogError("The item {0} has already been registered with ID {1}", modItem.Name, modItem.RegisteredId);
                return(modItem.RegisteredId);
            }
            Int32 newId = LowestModItemID;

            if (ModItems.Count > 0)
            {
                newId = Math.Max(LowestModItemID, ModItems.OrderBy(x => x.Key).First().Key + 1);
            }
            ModItems.Add(newId, modItem);
            modItem.HasBeenRegistered = true;
            modItem.RegisteredId      = newId;
            return(newId);
        }
Exemplo n.º 3
0
 private void Author_Sort_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     lvMods.ItemsSource = new ObservableCollection <ModItem>(ModItems.OrderBy(s => s.Author));
 }