Beispiel #1
0
        /// <summary>
        /// Performs the specified action on the currently active document.
        /// </summary>
        /// <param name="action">The action to perform.</param>
        private void ActionActive(ActionActiveEnum action)
        {
            var documentPane = dockingManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();

            if (documentPane == null)
            {
                return;
            }

            var layoutContent = documentPane.Children.FirstOrDefault(l => l.IsActive || l.IsSelected);

            if (layoutContent != null &&
                layoutContent.Content is DocumentViewHost host)
            {
                if (host.DataContext is DocumentViewModel viewModel)
                {
                    if (action == ActionActiveEnum.Save)
                    {
                        viewModel.Save.Execute(null);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Performs the specified action on the currently active document.
        /// </summary>
        /// <param name="action">The action to perform.</param>
        private void ActionActive(ActionActiveEnum action)
        {
            var documentPane = dockingManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
            if (documentPane == null)
            {
                return;
            }

            var layoutContent = documentPane.Children.FirstOrDefault(l => l.IsActive || l.IsSelected);
            if (layoutContent != null
                && layoutContent.Content is DocumentViewHost)
            {
                var viewModel = ((DocumentViewHost)layoutContent.Content).DataContext as DocumentViewModel;
                if (viewModel != null)
                {
                    if (action == ActionActiveEnum.Save)
                    {
                        viewModel.Save.Execute(null);
                    }
                }
            }
        }