private void BtnSfoglia_MouseUp(object sender, MouseButtonEventArgs e) { switch (SelectorType) { case SelectorType.File: DialogUtils.File(x => { if (!string.IsNullOrEmpty(x)) { txtFilePath.Text = x; OnSelection?.Invoke(x); } }); break; case SelectorType.Folder: DialogUtils.Folder(x => { if (!string.IsNullOrEmpty(x)) { txtFilePath.Text = x; OnSelection?.Invoke(x); } }); break; default: break; } }