Пример #1
0
        private void ShowWaitPanel(bool doPrompt = true, UserConfirmationHandler confirmationHandler = null)
        {
            if (doPrompt == true && confirmationHandler == null)
            {
                throw new ArgumentNullException("confirmationHandler is required when doPrompt==true");
            }

            _userConfirmationHandler = confirmationHandler;

            _window = (MetroWindow)Application.Current.MainWindow;
            _window.ShowTitleBar = false;

            if (_window.Content is Grid)
            {
                _mainGrid = _window.Content as Grid;

                _dialog = new SimpleDialog();

                Panel promptButtonPanel = null;

                if (_userConfirmationHandler != null)
                {
                    promptButtonPanel = CreateButtonPanel();
                }

                if (_mainGrid.ColumnDefinitions.Count > 0)
                {
                    Grid.SetColumnSpan(_dialog, _mainGrid.ColumnDefinitions.Count);
                }
                if (_mainGrid.RowDefinitions.Count > 0)
                {
                    Grid.SetRowSpan(_dialog, _mainGrid.RowDefinitions.Count);
                }

                _dialog.Content = CreateContentPanel(promptButtonPanel);
            }

            _mainGrid.Children.Add(_dialog);
        }