예제 #1
0
        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;
            });
        }
예제 #2
0
        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;
            });
        }