Adding final WPF code and working dialogbox