Ejemplo n.º 1
0
        public PopupModalWindow(IShellPresenter presenter, string title,
                                object content,
                                DialogButtonsSet buttons, DialogButton button, bool allowEscapeAndCloseButton,
                                double width, double height,
                                object details, double detailsHeight)
            : this(presenter)
        {
            if (presenter == null)
            {
                Owner = Application.Current.MainWindow;
            }
            else
            {
                Owner = presenter.View.Window;
            }

            //DataContext = Owner;

            var zoom = (Double)Application.Current.Resources["MagnificationLevel"];

            Width  = zoom * width;
            Height = zoom * height;

            DetailsHeight = zoom * detailsHeight;

            CommandDetailsCollapse.IconProvider.IconDrawScale = zoom;
            CommandDetailsExpand.IconProvider.IconDrawScale   = zoom;

            Title = title;
            Icon  = null;
            ContentPlaceHolder.Content = content;
            DetailsPlaceHolder.Content = details;
            DialogButtons             = buttons;
            DefaultDialogButton       = button;
            AllowEscapeAndCloseButton = allowEscapeAndCloseButton;
        }
Ejemplo n.º 2
0
        public PopupModalWindow(IShellView shellView, string title,
                                object content,
                                DialogButtonsSet buttons, DialogButton button, bool allowEscapeAndCloseButton,
                                double width, double height,
                                object details, double detailsHeight, Window owner)
            : this(shellView)
        {
            if (this != Application.Current.MainWindow)
            {
                try
                {
                    if (owner != null)
                    {
                        Owner = owner;
                    }
                    else
                    {
                        Owner = Application.Current.MainWindow;
                    }
                }
                catch
                {
                    Console.WriteLine(@"Failed to set Owner of popup dialog window !");
#if DEBUG
                    Debugger.Break();
#endif //DEBUG
                }
            }

            var zoom = (ShellView != null ? ShellView.MagnificationLevel : (Double)FindResource("MagnificationLevel"));

            Left   = -1;
            Top    = -1;
            Width  = zoom * width;
            Height = zoom * height;

            DetailsHeight = zoom * detailsHeight;

            CommandDetailsCollapse.SetIconProviderDrawScale(zoom);
            CommandDetailsExpand.SetIconProviderDrawScale(zoom);

            Title = "Tobi: " + title;
            Icon  = null;
            ContentPlaceHolder.Content = content;

            DetailsPlaceHolder.Content = details;
            //if (details != null && details is UIElement)
            //{
            //    ((UIElement)details).IsVisibleChanged += (sender, ev) => DetailsPlaceHolder.Visibility = ((UIElement)details).Visibility;
            //}
            var ui = DetailsPlaceHolder.Content as UIElement;
            if (ui != null)
            {
                DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(UIElement.VisibilityProperty, typeof(UIElement));
                if (dpd != null)
                {
                    dpd.AddValueChanged(ui, delegate
                    {
                        m_PropertyChangeHandler.RaisePropertyChanged(() => HasDetails);
                        //m_PropertyChangeHandler.RaisePropertyChanged(() => IsDetailsExpanded);
                        CommandManager.InvalidateRequerySuggested();
                    });
                }
                //ui.IsVisibleChanged += (obj, args) => m_PropertyChangeHandler.RaisePropertyChanged(() => HasDetails);
            }

            DialogButtons             = buttons;
            DefaultDialogButton       = button;
            AllowEscapeAndCloseButton = allowEscapeAndCloseButton;
        }
Ejemplo n.º 3
0
 public PopupModalWindow(IShellPresenter window, string title, object content,
                         DialogButtonsSet buttons, DialogButton button, bool allowEscapeAndCloseButton, double width, double height)
     : this(window, title, content, buttons, button, allowEscapeAndCloseButton, width, height, null, 0)
 {
 }