private void BandwidthCheckButton_Click(object sender, RoutedEventArgs args) { var dialog = new BandwidthCheckDialog(); dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); if (dialog.Result.HasValue) { ((SettingViewModel)this.DataContext).MaxUpstreamRate = dialog.Result.Value; } }