コード例 #1
0
        private void OnLnkMailToTelerikClicked(object sender, RoutedEventArgs e)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.Append("mailto:[email protected]?subject=Exception error");

            DispatcherObjectExt.BeginInvoke(() =>
            {
                try
                {
                    Process.Start(stringBuilder.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }, DispatcherPriority.Background);
        }
コード例 #2
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();
            }
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: smitcham/JustAssembly
        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);
        }
コード例 #4
0
        protected override void OnActivated(EventArgs e)
        {
            var windowView = this.Content as IWindowView;

            if (windowView != null)
            {
                if (!string.IsNullOrEmpty(windowView.Title))
                {
                    this.Title = windowView.Title;
                }
                if (windowView.Icon != null)
                {
                    this.Icon = windowView.Icon;
                }
                DispatcherObjectExt.BeginInvoke(() => windowView.TrySetFocus());
                windowView.SendCloseRequest += OnWindowViewCloseRequest;
            }
            base.OnActivated(e);
        }