mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
更新
This commit is contained in:
parent
19203ead6c
commit
5831b2d0f7
@ -31,8 +31,6 @@ public class ModMakerHistory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LastTimeString => LastTime.ToString("yyyy/MM/dd HH:mm:ss");
|
|
||||||
|
|
||||||
public string InfoFile => Path.Combine(SourcePath, "info.lps");
|
public string InfoFile => Path.Combine(SourcePath, "info.lps");
|
||||||
|
|
||||||
[Line(ignoreCase: true)]
|
[Line(ignoreCase: true)]
|
||||||
|
@ -94,7 +94,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
|
|||||||
Health = Health.Value,
|
Health = Health.Value,
|
||||||
Likability = Likability.Value,
|
Likability = Likability.Value,
|
||||||
Price = Price.Value,
|
Price = Price.Value,
|
||||||
ImageSource = Image.Value,
|
Exp = Exp.Value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ public class ModMakerWindowVM
|
|||||||
public ObservableCommand CreateNewModCommand { get; } = new();
|
public ObservableCommand CreateNewModCommand { get; } = new();
|
||||||
public ObservableCommand LoadModFromFileCommand { get; } = new();
|
public ObservableCommand LoadModFromFileCommand { get; } = new();
|
||||||
public ObservableCommand ClearHistoriesCommand { get; } = new();
|
public ObservableCommand ClearHistoriesCommand { get; } = new();
|
||||||
|
public ObservableCommand<ModMakerHistory> RemoveHistoryCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
public ModMakerWindowVM() { }
|
public ModMakerWindowVM() { }
|
||||||
|
|
||||||
@ -45,9 +46,16 @@ public class ModMakerWindowVM
|
|||||||
CreateNewModCommand.ExecuteEvent += CreateNewMod;
|
CreateNewModCommand.ExecuteEvent += CreateNewMod;
|
||||||
LoadModFromFileCommand.ExecuteEvent += LoadModFromFile;
|
LoadModFromFileCommand.ExecuteEvent += LoadModFromFile;
|
||||||
ClearHistoriesCommand.ExecuteEvent += ClearHistories;
|
ClearHistoriesCommand.ExecuteEvent += ClearHistories;
|
||||||
|
RemoveHistoryCommand.ExecuteEvent += RemoveHistory;
|
||||||
HistoriesSearchText.ValueChanged += ModSearchText_ValueChanged;
|
HistoriesSearchText.ValueChanged += ModSearchText_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveHistory(ModMakerHistory value)
|
||||||
|
{
|
||||||
|
Histories.Remove(value);
|
||||||
|
SaveHistories();
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadHistories()
|
private void LoadHistories()
|
||||||
{
|
{
|
||||||
if (File.Exists(ModMakerInfo.HistoryFile) is false)
|
if (File.Exists(ModMakerInfo.HistoryFile) is false)
|
||||||
@ -73,7 +81,7 @@ public class ModMakerWindowVM
|
|||||||
{
|
{
|
||||||
new Sub("Id", history.Id),
|
new Sub("Id", history.Id),
|
||||||
new Sub("SourcePath", history.SourcePath),
|
new Sub("SourcePath", history.SourcePath),
|
||||||
new Sub("LastTime", history.LastTimeString)
|
new Sub("LastTime", history.LastTime.ToString("yyyy/MM/dd HH:mm"))
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
File.WriteAllText(ModMakerInfo.HistoryFile, lps.ToString());
|
File.WriteAllText(ModMakerInfo.HistoryFile, lps.ToString());
|
||||||
|
@ -55,7 +55,16 @@
|
|||||||
<Grid
|
<Grid
|
||||||
Margin="5"
|
Margin="5"
|
||||||
Background="{DynamicResource PrimaryDark}"
|
Background="{DynamicResource PrimaryDark}"
|
||||||
|
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
|
||||||
ToolTip="{Binding InfoFile}">
|
ToolTip="{Binding InfoFile}">
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem
|
||||||
|
Command="{Binding PlacementTarget.Tag.RemoveHistoryCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
|
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
|
Header="{ll:Str 删除此历史}" />
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
|
Loading…
Reference in New Issue
Block a user