/// <summary> /// Constructor /// </summary> /// <param name="w">The window</param> /// <param name="path">The file</param> public SendToViewModel(SendToWindow w, string path) { Content = new ChooseRecipient(); Button = new SendButton(this); SendWindow = w; ClickedPath = path; }
/// <summary> /// Opens the Send To Window /// </summary> /// <param name="path">The path</param> private void OpenWindow(string path) { // You cannot open a new WPF window from a thread different from a different thread, as it must be STA. // So I call the Main Window Dispatcher, which maintains a queue of jobs to do and executes them. MainWindowDispatcher.InvokeAsync(() => { SendToWindow w = new SendToWindow(path) { Topmost = true, WindowState = WindowState.Normal }; w.Show(); w.Activate(); w.Topmost = false; }); }