Ejemplo n.º 1
0
        /// <summary>
        /// Shows the dialog at a manually specfied location offset from the specified parent screen.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="parent">The parent screen.</param>
        /// <param name="leftOffset">The position of the window's left edge</param>
        /// <param name="topOffset">The position of the window's top edge</param>
        /// <param name="additionalSettings">Additional settings for the dialog.</param>
        /// <returns>The view model dialog's result.</returns>
        public virtual bool ShowDialog(object viewModel, Screen parent, int leftOffset, int topOffset, IDictionary <string, object> additionalSettings = null)
        {
            var window            = parent.GetView(ViewAware.DefaultContext) as Window;
            var screenCoordinates = new Point(window?.Left ?? 0.0, window?.Top ?? 0.0);

            screenCoordinates.X += leftOffset;
            screenCoordinates.Y += topOffset;

            var settings = DialogSettings.Create().AtLocation(screenCoordinates.X, screenCoordinates.Y).WithIcon(_icon).Merge(additionalSettings);

            return(ShowDialogCore(viewModel, settings));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="additionalSettings">Additional settings for the dialog.</param>
        /// <returns>The view model dialog's result.</returns>
        public virtual bool ShowDialog(object viewModel, IDictionary <string, object> additionalSettings = null)
        {
            var settings = DialogSettings.Create().Centered().WithIcon(_icon).Merge(additionalSettings);

            return(ShowDialogCore(viewModel, settings));
        }