private void OnComparisonSelectorFlyoutClosed(ComparisonSelectorFlyoutVM flyoutVm)
        {
            if (!flyoutVm.IsProceed)
            {
                return;
            }

            if (flyoutVm.SelectedComparison is NewComparisonVM)
            {
                DockingViewManager.Instance.DocumentManager.OpenDocument(StatComparisonDocumentServiceBase.CreateUri())
                .ContinueWith(t =>
                {
                    if (t.Result == null)
                    {
                        this.LogError("failed to create stat comparison document");
                    }
                    else
                    {
                        App.BeginInvokeBackground(() =>
                        {
                            this.AddToComparisonDocument(flyoutVm.TankKeys, t.Result);
                        });
                    }
                });
            }
            else
            {
                var comparisonVm = (AvailableComparisonVM)flyoutVm.SelectedComparison;
                this.AddToComparisonDocument(flyoutVm.TankKeys, comparisonVm.DocumentVM);
                DockingViewManager.Instance.DocumentManager.SelectDocument(comparisonVm.Document);
            }
        }
        private void AddToComparison(TankUnikey[] keys)
        {
            var flyoutVm = new ComparisonSelectorFlyoutVM(keys);
            var flyout   = new Flyout
            {
                Header  = this.L("stat_comparer", "add_to_comparison_flyout_title"),
                IsModal = true,
                Content = new ComparisonSelectorFlyoutView {
                    ViewModel = flyoutVm
                },
                CloseCommand = new RelayCommand(() => this.OnComparisonSelectorFlyoutClosed(flyoutVm)),
                Position     = FlyoutPosition.Left,
                MinWidth     = 200
            };

            FlyoutManager.Instance.Open(flyout);

            flyoutVm.Closed += (o, e) =>
            {
                FlyoutManager.Instance.Close(flyout);
                this.OnComparisonSelectorFlyoutClosed(flyoutVm);
            };
        }