コード例 #1
0
ファイル: DialogCoordinator.cs プロジェクト: ycccq/TailBlazer
        public void Show(IDialogViewModel view, object content, Action <object> onClosed = null)
        {
            _disposer.Disposable = Disposable.Empty;
            view.DialogContent   = content;
            view.IsDialogOpen    = true;

            var closedCallback = view.WhenValueChanged(v => v.IsDialogOpen, false)
                                 .Where(isOpen => !isOpen)
                                 .Subscribe(_ => _disposer.Disposable = Disposable.Empty);

            _disposer.Disposable = Disposable.Create(() =>
            {
                closedCallback.Dispose();
                view.IsDialogOpen = false;
                onClosed?.Invoke(view.DialogContent);
            });
        }
コード例 #2
0
        public void Show(IDialogViewModel view, object content, Action<object> onClosed = null)
        {
            _disposer.Disposable = Disposable.Empty;
                view.DialogContent = content;
                view.IsDialogOpen = true;

                var closedCallback = view.WhenValueChanged(v => v.IsDialogOpen, false)
                    .Where(isOpen => !isOpen)
                    .Subscribe(_ => _disposer.Disposable = Disposable.Empty);

                _disposer.Disposable = Disposable.Create(() =>
                {
                    closedCallback.Dispose();
                    view.IsDialogOpen = false;
                    onClosed?.Invoke(view.DialogContent);
                });
        }