void AddButtonEventHandler(object sender, EventArgs e) { if (scrolledWindow.Children[0] == stringTreeView) { ResponseType response = (ResponseType)stringDialog.Run(); stringDialog.Hide(); if (response == ResponseType.Ok && !string.IsNullOrWhiteSpace(stringDialog.NodeName)) { var note = new ResXDataNode(stringDialog.NodeName, stringDialog.NodeText) { Comment = stringDialog.NodeComment }; this.AddItem(note); editorView.IsDirty = true; } stringDialog.NodeText = ""; stringDialog.NodeName = ""; stringDialog.NodeComment = ""; return; } else { //add existing item if (openDialog.Run()) { AddFileAsItem(openDialog.SelectedFile); return; } } }
void AddButtonEventHandler(object sender, EventArgs e) { if (sender == addMenuStringItem) { ResponseType response = (ResponseType)stringDialog.Run(); stringDialog.Hide(); if (response == ResponseType.Ok && !string.IsNullOrWhiteSpace(stringDialog.NodeName)) { this.AddItem(new ResXDataNode(stringDialog.NodeName, stringDialog.NodeText)); editorView.IsDirty = true; } stringDialog.NodeText = ""; stringDialog.NodeName = ""; return; } if (sender == addMenuExistingFileItem) { if (openDialog.Run()) { AddFileAsItem(openDialog.SelectedFile); return; } } }