-
Notifications
You must be signed in to change notification settings - Fork 3
/
LBNRenamerForm.cs
51 lines (46 loc) · 1.75 KB
/
LBNRenamerForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace KMZRebuilder
{
public partial class LBNRenamerForm : Form
{
public int ttl_objs = 0;
public List<DictionaryEntry> entries = null;
public List<string> entriesNames = new List<string>();
public LBNRenamerForm(int ttl_objs, List<DictionaryEntry> entries)
{
InitializeComponent();
this.ttl_objs = ttl_objs;
this.entries = entries;
int id = 0;
foreach (DictionaryEntry entry in this.entries)
{
layers.Items.Add(String.Format("{0}: {1}: {2}", id++, (string)entry.Key, ((int)entry.Value).ToString()));
entriesNames.Add((string)entry.Key);
};
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
renameToolStripMenuItem.Enabled = layers.SelectedItems.Count > 0;
}
private void renameToolStripMenuItem_Click(object sender, EventArgs e)
{
if (layers.SelectedItems.Count == 0) return;
string txti = layers.SelectedIndices[0].ToString() + ": ";
string name = (layers.Items[layers.SelectedIndices[0]]).ToString().Remove(0, txti.Length);
KMZRebuilederForm.InputBox("Layer name", "Change layer name:", ref name, null);
layers.Items[layers.SelectedIndices[0]] = txti + name;
entriesNames[layers.SelectedIndices[0]] = name;
}
private void layers_DoubleClick(object sender, EventArgs e)
{
renameToolStripMenuItem_Click(sender, e);
}
}
}