Отчистика кода
This commit is contained in:
+10
-11
@@ -1,12 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Pf2eModel;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using static LinqToDB.Common.Configuration;
|
||||
|
||||
namespace Pf2eViewer;
|
||||
|
||||
@@ -37,7 +35,7 @@ public partial class MainViewForm : Form
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
EntityGridView.DataSource = Context.Entities
|
||||
.Where(e => e.Type == (EntityType) TypesListBox.SelectedItem)
|
||||
.OrderBy(e => e.Id)
|
||||
@@ -50,16 +48,17 @@ public partial class MainViewForm : Form
|
||||
|
||||
private void EntityGridView_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
|
||||
{
|
||||
var rowsCount = EntityGridView.SelectedRows.Count;
|
||||
if (rowsCount == 0 || rowsCount > 1){
|
||||
int rowsCount = EntityGridView.SelectedRows.Count;
|
||||
if (rowsCount == 0 || rowsCount > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var row = EntityGridView.SelectedRows[0];
|
||||
DataGridViewRow row = EntityGridView.SelectedRows[0];
|
||||
|
||||
var data = (EntityGridRow) row.DataBoundItem;
|
||||
EntityGridRow data = (EntityGridRow) row.DataBoundItem;
|
||||
|
||||
var json = SerializeEntity(data.GetEntity());
|
||||
string json = SerializeEntity(data.GetEntity());
|
||||
|
||||
JsonToTreeview(EntityTreeView, json, "Entity");
|
||||
|
||||
@@ -68,9 +67,9 @@ public partial class MainViewForm : Form
|
||||
|
||||
public string SerializeEntity(Entity entity)
|
||||
{
|
||||
var settings = new JsonSerializerSettings()
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings()
|
||||
{
|
||||
Converters = [ new EntityConventor() ]
|
||||
Converters = [new EntityConventor()]
|
||||
// ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
};
|
||||
|
||||
@@ -92,7 +91,7 @@ public partial class MainViewForm : Form
|
||||
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
foreach(TreeNode node in Element2TreeNode(json, rootName).Nodes)
|
||||
foreach (TreeNode node in Element2TreeNode(json, rootName).Nodes)
|
||||
{
|
||||
treeView.Nodes.Add(node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user