You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
6.8 KiB
206 lines
6.8 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.ComponentModel; |
|
using System.Drawing; |
|
using System.IO; |
|
using System.Windows.Forms; |
|
using Kingo.Mobile.Shape2KOTool.XSDClass; |
|
|
|
namespace Kingo.Mobile.Shape2KOTool.SymbolSetting |
|
{ |
|
// Token: 0x02000047 RID: 71 |
|
public partial class frmSymbolSelector : Form |
|
{ |
|
// Token: 0x170000CE RID: 206 |
|
// (get) Token: 0x06000242 RID: 578 RVA: 0x0000BC10 File Offset: 0x00009E10 |
|
// (set) Token: 0x06000243 RID: 579 RVA: 0x0000BC2D File Offset: 0x00009E2D |
|
public FSymbol FSymbol |
|
{ |
|
get |
|
{ |
|
return this.ucSymbolItemConfig1.FSymbol; |
|
} |
|
set |
|
{ |
|
this.ucSymbolItemConfig1.FSymbol = value; |
|
} |
|
} |
|
|
|
// Token: 0x06000244 RID: 580 RVA: 0x0000BC40 File Offset: 0x00009E40 |
|
public frmSymbolSelector() |
|
{ |
|
this.InitializeComponent(); |
|
this.listViewStyleBindingSource.DataSource = ListViewStyle.GetDefault(); |
|
this.comboBoxListStyle.SelectedValue = this.listViewSymbol.View; |
|
} |
|
|
|
// Token: 0x06000245 RID: 581 RVA: 0x0000BCA6 File Offset: 0x00009EA6 |
|
private void btnOk_Click(object sender, EventArgs e) |
|
{ |
|
base.DialogResult = DialogResult.OK; |
|
base.Close(); |
|
} |
|
|
|
// Token: 0x06000246 RID: 582 RVA: 0x0000BCB8 File Offset: 0x00009EB8 |
|
private void comboBoxListStyle_SelectedIndexChanged(object sender, EventArgs e) |
|
{ |
|
if (this.comboBoxListStyle.SelectedValue != null) |
|
{ |
|
this.listViewSymbol.View = (View)this.comboBoxListStyle.SelectedValue; |
|
} |
|
} |
|
|
|
// Token: 0x06000247 RID: 583 RVA: 0x0000BCFC File Offset: 0x00009EFC |
|
private ListViewItem CreateItem(FSymbolWithNameAndData fSymbol) |
|
{ |
|
Image imageFrom = CommonMethod.GetImageFrom(fSymbol.FSymbol, 48, 48); |
|
Image imageFrom2 = CommonMethod.GetImageFrom(fSymbol.FSymbol, 24, 48); |
|
this.imageListBig.Images.Add(fSymbol.UID, imageFrom); |
|
this.imageListSmall.Images.Add(fSymbol.UID, imageFrom2); |
|
return new ListViewItem(new string[] |
|
{ |
|
fSymbol.Name, |
|
fSymbol.CreateTime.ToString() |
|
}, fSymbol.UID) |
|
{ |
|
Tag = fSymbol |
|
}; |
|
} |
|
|
|
// Token: 0x06000248 RID: 584 RVA: 0x0000BDA0 File Offset: 0x00009FA0 |
|
private FSymbolWithNameAndData CreateNewStyle(FSymbol symbol) |
|
{ |
|
return new FSymbolWithNameAndData |
|
{ |
|
Name = "新建样式", |
|
CreateTime = DateTime.Now, |
|
FSymbol = symbol |
|
}; |
|
} |
|
|
|
// Token: 0x06000249 RID: 585 RVA: 0x0000BDDC File Offset: 0x00009FDC |
|
private void InitListView() |
|
{ |
|
this.listViewSymbol.Items.Clear(); |
|
this.imageListBig.Images.Clear(); |
|
this.imageListSmall.Images.Clear(); |
|
if (File.Exists(this.SymbolFilePath)) |
|
{ |
|
string text = File.ReadAllText(this.SymbolFilePath); |
|
if (!string.IsNullOrEmpty(text)) |
|
{ |
|
List<FSymbolWithNameAndData> list = CommonMethod.DeSerializerFromJson<List<FSymbolWithNameAndData>>(text); |
|
if (list != null && list.Count != 0) |
|
{ |
|
foreach (FSymbolWithNameAndData fSymbol in list) |
|
{ |
|
this.listViewSymbol.Items.Add(this.CreateItem(fSymbol)); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
// Token: 0x0600024A RID: 586 RVA: 0x0000BEC8 File Offset: 0x0000A0C8 |
|
private void SaveStyle() |
|
{ |
|
List<FSymbolWithNameAndData> list = new List<FSymbolWithNameAndData>(); |
|
foreach (object obj in this.listViewSymbol.Items) |
|
{ |
|
ListViewItem listViewItem = (ListViewItem)obj; |
|
FSymbolWithNameAndData fsymbolWithNameAndData = listViewItem.Tag as FSymbolWithNameAndData; |
|
if (fsymbolWithNameAndData != null) |
|
{ |
|
list.Add(fsymbolWithNameAndData); |
|
} |
|
} |
|
string contents = CommonMethod.SerializerToJson(list); |
|
File.WriteAllText(this.SymbolFilePath, contents); |
|
} |
|
|
|
// Token: 0x0600024B RID: 587 RVA: 0x0000BF74 File Offset: 0x0000A174 |
|
private void frmSymbolSelector_Load(object sender, EventArgs e) |
|
{ |
|
this.InitListView(); |
|
this.listViewSymbol.ListViewItemSorter = new ListViewColumnSorter(); |
|
this.listViewSymbol.ColumnClick += ListViewHelper.ListView_ColumnClick; |
|
} |
|
|
|
// Token: 0x0600024C RID: 588 RVA: 0x0000BFA8 File Offset: 0x0000A1A8 |
|
private void btnSave_Click(object sender, EventArgs e) |
|
{ |
|
FSymbolWithNameAndData fsymbolWithNameAndData = this.ucSymbolItemConfig1.Tag as FSymbolWithNameAndData; |
|
if (fsymbolWithNameAndData == null) |
|
{ |
|
fsymbolWithNameAndData = this.CreateNewStyle(this.ucSymbolItemConfig1.FSymbol); |
|
ListViewItem listViewItem = this.CreateItem(fsymbolWithNameAndData); |
|
this.ucSymbolItemConfig1.Tag = fsymbolWithNameAndData; |
|
this.listViewSymbol.Items.Add(listViewItem); |
|
listViewItem.EnsureVisible(); |
|
listViewItem.BeginEdit(); |
|
} |
|
else |
|
{ |
|
fsymbolWithNameAndData.FSymbol = this.ucSymbolItemConfig1.FSymbol; |
|
fsymbolWithNameAndData.CreateTime = DateTime.Now; |
|
foreach (object obj in this.listViewSymbol.Items) |
|
{ |
|
ListViewItem listViewItem2 = (ListViewItem)obj; |
|
if (listViewItem2.Tag == fsymbolWithNameAndData) |
|
{ |
|
this.imageListBig.Images.RemoveByKey(fsymbolWithNameAndData.UID); |
|
this.imageListBig.Images.Add(fsymbolWithNameAndData.UID, CommonMethod.GetImageFrom(fsymbolWithNameAndData.FSymbol, 48, 48)); |
|
this.imageListSmall.Images.RemoveByKey(fsymbolWithNameAndData.UID); |
|
this.imageListSmall.Images.Add(fsymbolWithNameAndData.UID, CommonMethod.GetImageFrom(fsymbolWithNameAndData.FSymbol, 24, 48)); |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
|
|
// Token: 0x0600024D RID: 589 RVA: 0x0000C130 File Offset: 0x0000A330 |
|
private void btnSaveAs_Click(object sender, EventArgs e) |
|
{ |
|
FSymbolWithNameAndData fsymbolWithNameAndData = this.CreateNewStyle(this.ucSymbolItemConfig1.FSymbol); |
|
ListViewItem listViewItem = this.CreateItem(fsymbolWithNameAndData); |
|
this.ucSymbolItemConfig1.Tag = fsymbolWithNameAndData; |
|
this.listViewSymbol.Items.Add(listViewItem); |
|
listViewItem.EnsureVisible(); |
|
listViewItem.BeginEdit(); |
|
} |
|
|
|
// Token: 0x0600024E RID: 590 RVA: 0x0000C188 File Offset: 0x0000A388 |
|
private void listViewSymbol_SelectedIndexChanged(object sender, EventArgs e) |
|
{ |
|
if (this.listViewSymbol.SelectedItems.Count > 0) |
|
{ |
|
FSymbolWithNameAndData fsymbolWithNameAndData = this.listViewSymbol.SelectedItems[0].Tag as FSymbolWithNameAndData; |
|
if (fsymbolWithNameAndData != null) |
|
{ |
|
this.ucSymbolItemConfig1.FSymbol = fsymbolWithNameAndData.FSymbol; |
|
this.ucSymbolItemConfig1.Tag = fsymbolWithNameAndData; |
|
} |
|
} |
|
} |
|
|
|
// Token: 0x0600024F RID: 591 RVA: 0x0000C1FA File Offset: 0x0000A3FA |
|
private void frmSymbolSelector_FormClosing(object sender, FormClosingEventArgs e) |
|
{ |
|
this.SaveStyle(); |
|
} |
|
|
|
// Token: 0x06000250 RID: 592 RVA: 0x0000C204 File Offset: 0x0000A404 |
|
private void listViewSymbol_AfterLabelEdit(object sender, LabelEditEventArgs e) |
|
{ |
|
ListViewItem listViewItem = this.listViewSymbol.Items[e.Item]; |
|
FSymbolWithNameAndData fsymbolWithNameAndData = listViewItem.Tag as FSymbolWithNameAndData; |
|
if (fsymbolWithNameAndData != null) |
|
{ |
|
fsymbolWithNameAndData.Name = e.Label; |
|
} |
|
} |
|
|
|
// Token: 0x04000171 RID: 369 |
|
private string SymbolFilePath = Application.StartupPath + "\\Symbol.dat"; |
|
} |
|
}
|
|
|