Merge branch 'master' into master
This commit is contained in:
@@ -32,9 +32,14 @@ namespace Torch.Server.Views.Converters
|
|||||||
{
|
{
|
||||||
//if (targetType != typeof(int))
|
//if (targetType != typeof(int))
|
||||||
// throw new NotSupportedException("ModToIdConverter can only convert mods into int values or vise versa!");
|
// throw new NotSupportedException("ModToIdConverter can only convert mods into int values or vise versa!");
|
||||||
var mod = (ModItemInfo) values[0];
|
if (values[0] is ModItemInfo mod && values[1] is MtObservableList<ModItemInfo> modList)
|
||||||
var theModList = (MtObservableList<ModItemInfo>) values[1];
|
{
|
||||||
return theModList.IndexOf(mod);
|
return modList.IndexOf(mod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -205,9 +205,9 @@ namespace Torch.Server.Views
|
|||||||
{
|
{
|
||||||
_hasOrderChanged = true;
|
_hasOrderChanged = true;
|
||||||
var modList = (MtObservableList<ModItemInfo>)DataContext;
|
var modList = (MtObservableList<ModItemInfo>)DataContext;
|
||||||
//modList.Move(modList.IndexOf(_draggedMod), modList.IndexOf(targetMod));
|
modList.Move(modList.IndexOf(targetMod), _draggedMod);
|
||||||
modList.RemoveAt(modList.IndexOf(_draggedMod));
|
//modList.RemoveAt(modList.IndexOf(_draggedMod));
|
||||||
modList.Insert(modList.IndexOf(targetMod), _draggedMod);
|
//modList.Insert(modList.IndexOf(targetMod), _draggedMod);
|
||||||
ModList.Items.Refresh();
|
ModList.Items.Refresh();
|
||||||
ModList.SelectedItem = _draggedMod;
|
ModList.SelectedItem = _draggedMod;
|
||||||
}
|
}
|
||||||
|
@@ -189,5 +189,15 @@ namespace Torch.Collections
|
|||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
bool IList.IsFixedSize => false;
|
bool IList.IsFixedSize => false;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void Move(int newIndex, object value)
|
||||||
|
{
|
||||||
|
if (value is T t)
|
||||||
|
{
|
||||||
|
base.Remove(t);
|
||||||
|
}
|
||||||
|
Insert(newIndex, (T)value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ namespace Torch
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update() { }
|
public virtual void Update() { }
|
||||||
public PluginState State { get; }
|
public PluginState State { get; } = PluginState.Enabled;
|
||||||
|
|
||||||
public virtual void Dispose() { }
|
public virtual void Dispose() { }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user