public PostContentEditorWindow(PostContent toLoad) { InitializeComponent(); StatusContext = new StatusControlContext(); StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(async() => { PostContent = await PostContentEditorContext.CreateInstance(StatusContext, toLoad); PostContent.RequestContentEditorWindowClose += (_, _) => { Dispatcher?.Invoke(Close); }; AccidentalCloserHelper = new WindowAccidentalClosureHelper(this, StatusContext, PostContent); await ThreadSwitcher.ResumeForegroundAsync(); DataContext = this; }); }
public FileContentEditorWindow(FileInfo initialFile) { InitializeComponent(); StatusContext = new StatusControlContext(); StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(async() => { FileContent = await FileContentEditorContext.CreateInstance(StatusContext, initialFile); FileContent.RequestContentEditorWindowClose += (sender, args) => { Dispatcher?.Invoke(Close); }; AccidentalCloserHelper = new WindowAccidentalClosureHelper(this, StatusContext, FileContent); await ThreadSwitcher.ResumeForegroundAsync(); DataContext = this; }); }