private void ExecuteModifyCommand(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                ImageTreeViewItem item = SysTreeView.SelectedItem as ImageTreeViewItem;
                if (item == null)
                    return;
                TableData tab = item.Tag as TableData;
                if (tab == null)
                    return;

                KeyValueDialog kvDialog = new KeyValueDialog();
                kvDialog.BindingT = _BindingT;
                kvDialog.Table = tab;
                kvDialog.DialogType = KeyValueDialogType.Modify;
                kvDialog.Key = tab.Item[SysDataGrid.SelectedIndex].Key;
                kvDialog.Type = tab.Item[SysDataGrid.SelectedIndex].Type;
                kvDialog.Data = tab.Item[SysDataGrid.SelectedIndex].Data;
                kvDialog.ShowDialog();
                if (kvDialog.Result == MessageBoxResult.OK)
                {
                    SetValue(item.TableName, kvDialog.Key, KeyValueData.GetType(kvDialog.Type), kvDialog.Data);
                    Modify = true;

                    KeyValueData kvd = tab.Item[SysDataGrid.SelectedIndex];
                    DataRow dr = tab.DataSource.Rows[SysDataGrid.SelectedIndex];
                    kvd.Type = kvDialog.Type;
                    kvd.Data = kvDialog.Data;
                    dr["Type"] = kvDialog.Type;
                    dr["Data"] = kvDialog.Data;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ExecuteAddCommand(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                ImageTreeViewItem item = SysTreeView.SelectedItem as ImageTreeViewItem;
                if (item == null)
                    return;
                TableData tab = item.Tag as TableData;
                if (tab == null)
                    return;

                KeyValueDialog kvDialog = new KeyValueDialog();
                kvDialog.BindingT = _BindingT;
                kvDialog.Table = tab;
                kvDialog.DialogType = KeyValueDialogType.Add;
                kvDialog.ShowDialog();
                if (kvDialog.Result == MessageBoxResult.OK)
                {
                    SetValue(item.TableName, kvDialog.Key, KeyValueData.GetType(kvDialog.Type), kvDialog.Data);
                    Modify = true;

                    for (int i = 0; i < tab.Item.Count; ++i)
                    {
                        KeyValueData kvd = tab.Item[i];
                        DataRow dr = tab.DataSource.Rows[i];
                        if (kvd.Key == kvDialog.Key)
                        {
                            kvd.Type = kvDialog.Type;
                            kvd.Data = kvDialog.Data;
                            dr["Type"] = kvDialog.Type;
                            dr["Data"] = kvDialog.Data;
                            return;
                        }
                    }

                    tab.Item.Add(new KeyValueData(kvDialog.Key, kvDialog.Type, kvDialog.Data));
                    tab.DataSource.Rows.Add(kvDialog.Key, kvDialog.Type, kvDialog.Data);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }