コード例 #1
0
ファイル: JsonTreeEditorItem.cs プロジェクト: sunfom/DeXign
        protected virtual void OnAddExecute(EditableJsonNode value)
        {
            JsonTreeEditor editor = this.GetEditor();

            if (editor != null)
            {
                editor.CreateEditableNode(value);
            }
        }
コード例 #2
0
ファイル: JsonTreeEditorItem.cs プロジェクト: sunfom/DeXign
        private async void OnDeleteExecute(EditableJsonNode value)
        {
            JsonTreeEditor editor = this.GetEditor();

            if (editor == null)
            {
                throw new Exception();
            }

            if (value.IsEditting)
            {
                editor.DeleteEditableNode(value);
            }
            else
            {
                string path         = editor.GetDatastorePath(value);
                string relativePath = editor.GetRelativePath(path);

                // Json Root
                if (string.IsNullOrEmpty(relativePath))
                {
                    return;
                }

                if (MessageBox.Show(
                        $"중첩된 데이터를 포함하여 이 위치의 모든 데이터가 영구적으로 삭제됩니다.\r\n\r\n데이터 위치\r\n{editor.GetRelativePath(path)}",
                        "데이터 삭제",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Asterisk) == MessageBoxResult.No)
                {
                    return;
                }

                await editor.Datastore.DeleteAsync(path);
            }
        }