예제 #1
0
        private static void ShowWindow(IWindowView content,
                                       Action <ToolWindow> hideCallback = null,
                                       Action loadedCallback            = null,
                                       double width          = 400,
                                       double height         = 300,
                                       ResizeMode resizeMode = ResizeMode.NoResize,
                                       bool showInTaskBar    = false,
                                       WindowStartupLocation startupLocation = WindowStartupLocation.CenterOwner,
                                       bool isModal      = false,
                                       WindowStyle style = WindowStyle.SingleBorderWindow)
        {
            if (Application.Current.MainWindow == null || !Application.Current.MainWindow.IsLoaded)
            {
                DispatcherObjectExt.BeginInvoke(() => ShowWindow(content, hideCallback, loadedCallback, width, height, resizeMode, showInTaskBar, startupLocation, isModal, style), DispatcherPriority.Background);

                return;
            }
            var toolWindow = new ToolWindow
            {
                Width                 = width,
                Height                = height,
                Content               = content,
                ResizeMode            = resizeMode,
                ShowInTaskbar         = showInTaskBar,
                WindowStartupLocation = startupLocation,
                Owner                 = Application.Current.MainWindow,
                hideCallback          = hideCallback,
                loadedCallback        = loadedCallback,
                WindowStyle           = style,
            };

            toolWindow.Loaded += OnLoaded;

            toolWindow.AfterHide += OnAfterHide;

            if (isModal)
            {
                toolWindow.ShowDialog();
            }
            else
            {
                toolWindow.Show();
            }
        }
예제 #2
0
        private void OnErrorReadingAssembly(object sender, ErrorAssemblyReadingEventArgs e)
        {
            if (e.NotSupportedAssemblyPaths.Count == 0)
            {
                return;
            }
            StringBuilder unsupportedFilesNames = new StringBuilder();

            foreach (string assembly in e.NotSupportedAssemblyPaths)
            {
                unsupportedFilesNames.Append(assembly);
                unsupportedFilesNames.Append(Environment.NewLine);
            }
            string errorCaption = "Not supported file(s):";

            string errorMessage = unsupportedFilesNames.ToString();

            DispatcherObjectExt.BeginInvoke(() => ToolWindow.ShowDialog(new ErrorMessageWindow(errorMessage, errorCaption), width: 800, height: 500), DispatcherPriority.Background);
        }