Feedback welcomed

Coordinator
Sep 10, 2014 at 7:59 PM
For those of you who are using these controls, I would love to get your feedback whether it's positive or negative or any ideas for improvement.
Oct 9, 2014 at 9:42 AM
The sample application does seem to show a ToastPopUp when you click the button ?? though the binding is there ? Did you test it?
Coordinator
Oct 9, 2014 at 4:28 PM
Are you referring to the "Click Once" application or the source code? I got latest from the trunk on a new computer, compiled, ran the solution and didn't see an issue. I also downloaded the "Click Once" application on the same computer and it worked as expected. Can you please provide more details of your issue and I'll look into it? Thanks!
Oct 9, 2014 at 6:12 PM
Edited Oct 9, 2014 at 6:12 PM
I mean when you click the three buttons (mentioned below) in your sample (Click Once or After Building in VS 2013/W7),nothing Pops up...

Pop Toast
Pop Toast with Resource
Pop Toast with Formatted InLines

I tested on another machine , it works, so its my machine probably the 1920x1080 resolution and the toast windows is not adding up... it should be appearing somewhere...! :-)
Coordinator
Oct 9, 2014 at 6:21 PM
Interesting. I’ve been testing with that resolution including multiple screens. If you are using multiple screens, try swapping them and see if that makes a difference…it shouldn’t. I may have to put some debug code in there to provide some feedback such as the coordinates that it’s trying to set the window or something. I’ll try and put something together tomorrow.
Coordinator
Oct 10, 2014 at 1:36 PM
I've added some "debug" info to the Trunk version. When the toast window adjusts it's location, it will write the following to the output window. Just get latest from the Trunk and let me know if you see anything strange.
Window Title: My Title; Top = 545.06; Left = 1620
Window Title: My Title; Top = 647.55; Left = 1620
Window Title: My Title; Top = 750.04; Left = 1620
Window Title: My Title; Top = 852.53; Left = 1620
Window Title: My Title; Top = 955.02; Left = 1620
Window Title: My Title; Top = 1057.51; Left = 1620
Also, are there any other windows open when you are having this issue? TopMost is set to true on these windows...I suppose another window could be "hiding" it.

Thanks,

Lawrence
Oct 10, 2014 at 3:50 PM
Edited Oct 10, 2014 at 3:52 PM
:-)

I tested the code on a button in a new sample(res 1920x1080).Actually I had to click the button eight times to "show a toast" or "bring it up?"

Window Title: My Title; Top = 960.8; Left = 1620


Window Title: My Title; Top = 890.4; Left = 1620


Window Title: My Title; Top = 805.6; Left = 1620


Window Title: My Title; Top = 735.2; Left = 1620


Window Title: My Title; Top = 649.6; Left = 1620


Window Title: My Title; Top = 580; Left = 1620


Window Title: My Title; Top = 494.4; Left = 1620


Window Title: My Title; Top = 424; Left = 1620


Window Title: My Title; Top = 339.2; Left = 1620


Window Title: My Title; Top = 268.8; Left = 1620


Window Title: My Title; Top = 183.2; Left = 1620


Window Title: My Title; Top = 113.6; Left = 1620


Window Title: My Title; Top = 28; Left = 1620


Window Title: My Title; Top = 976; Left = 1320


Window Title: My Title; Top = 890.4; Left = 1320


Window Title: My Title; Top = 820; Left = 1320


Window Title: My Title; Top = 28.1399999999997; Left = 1620


Window Title: My Title; Top = 113.34; Left = 1620


Window Title: My Title; Top = 183.583333333333; Left = 1620


Window Title: My Title; Top = 268.783333333333; Left = 1620


Window Title: My Title; Top = 339.026666666666; Left = 1620


Window Title: My Title; Top = 424.226666666666; Left = 1620


Window Title: My Title; Top = 494.47; Left = 1620


Window Title: My Title; Top = 579.67; Left = 1620


Window Title: My Title; Top = 649.913333333333; Left = 1620


Window Title: My Title; Top = 735.113333333333; Left = 1620


Window Title: My Title; Top = 805.356666666667; Left = 1620


Window Title: My Title; Top = 890.556666666667; Left = 1620


Window Title: My Title; Top = 960.8; Left = 1620


Window Title: My Title; Top = 820.313333333333; Left = 1620


Window Title: My Title; Top = 890.556666666667; Left = 1620


Window Title: My Title; Top = 975.756666666667; Left = 1620

private void Button_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            // This example shows how to register the available events
            var toast = new ToastPopUp(
                "My Title",
                "This is the main content.",
                "Click this Hyperlink",
                NotificationType.Information);

            // This is what will be passed back through the HyperlinkClicked event.
            toast.HyperlinkObjectForRaisedEvent = new object();

            toast.Show();

            // Passing rich text as inlines and overrides the image.
            var inlines = new List<Inline>();
            inlines.Add(new Run() { Text = "This is the first line of my main content." });
            inlines.Add(new Run() { Text = Environment.NewLine });
            inlines.Add(new Run("This text will be italic.") { FontStyle = FontStyles.Italic });


            new ToastPopUp("My Title", "This is the main content.", NotificationType.Information).Show();
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }

Coordinator
Oct 10, 2014 at 4:11 PM
Is this a WPF or WinForms application?
Oct 10, 2014 at 4:13 PM
wpf
Coordinator
Oct 10, 2014 at 4:27 PM
Interesting. Have you tried stepping through the "AdjustWindow" function of the ToasPopUp window? Since you are not seeing the first windows, this might be more visible from your end then mine, since I'm unable to reproduce the issue.

I'm betting that I'm getting something back from
Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
that I'm not expecting or haven't tested. How many monitors do you have?
Oct 10, 2014 at 4:36 PM
Edited Oct 10, 2014 at 4:39 PM
single monitor, resolution @ 1920x1080
  • Screen.PrimaryScreen.WorkingArea.Size {Width = 1920 Height = 1046} System.Drawing.Size
Coordinator
Oct 10, 2014 at 4:53 PM
I unplugged my second monitor and running the same resolution as you are...worked fine. This type of troubleshooting is always difficult. Have you tried stepping through the "AdjustWindows" function to see if you notice anything unusual? The function isn't overly complex, just a little logic to stack the windows. I apologize for not having an answer for you, but I would greatly appreciate if you can help me understand why it's not working (calculating) correctly in your environment. Then, I can push out an update with the fix.
Oct 10, 2014 at 5:39 PM
Edited Oct 10, 2014 at 5:41 PM
I just did a small hack to get it working on my machine(but covers the taskbar though)..(tested with aero and non aero win7). You can check it out.....

Also i see you do a foreach over the wpf windows, well this could spike the cpu......

private void AdjustWindows()
    {
        lock (lockObject)
        {

            double width = SystemParameters.PrimaryScreenWidth;
            double height = SystemParameters.PrimaryScreenHeight;

            Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;

            //this.Left = workingArea.Right - this.ActualWidth;
            //double top = workingArea.Bottom - this.ActualHeight;

            this.Left = width- this.ActualWidth;
            double top = height - this.ActualHeight;

            foreach (Window window in System.Windows.Application.Current.Windows)
            {
                string windowName = window.GetType().Name;

                if (windowName.Equals(this.name) && window != this)
                {
                    window.Topmost = true;

                    if (this.Left == window.Left)
                    {
                        top = top - window.ActualHeight;
                    }

                    if (top < 0)
                    {
                        this.Left = this.Left - this.ActualWidth;
                        top = workingArea.Bottom - this.ActualHeight;
                    }
                }
            }

            this.Top = top;

            Console.WriteLine(string.Format("Window Title: {0}; Top = {1}; Left = {2}", this.title, this.Top, this.Left));
        }
    }
(Some info : https://stackoverflow.com/questions/24441443/transform-screen-primaryscreen-workingarea-to-wpf-dimensions-at-higher-dpi-setti)
Coordinator
Oct 13, 2014 at 1:07 PM
I've made a small change to your suggestion that takes the taskbar height into consideration. Please get the latest on the Trunk and see if that solves your problem. If it does, I'll release an update.
                this.Left = SystemParameters.WorkArea.Width - this.ActualWidth;
                double top = SystemParameters.WorkArea.Height - this.ActualHeight;
Oct 13, 2014 at 5:21 PM
I had checked, the toast pop up is working as expected.
Coordinator
Oct 13, 2014 at 5:24 PM
Awesome! I'll push out an update. Thanks for your help! I'm glad we were able to figure it out.
Nov 14, 2014 at 5:13 PM
I ran into a problem where keyboard focus was in a TextBox, a timer fired that caused a toast popup to appear while the user was typing into the TextBox, and keyboard focus got changed to the toast window. This was confusing to the user who was typing into the TextBox because now his keystrokes didn't appear in the TextBox.

I fixed this by modifying ToastPopUp.Show() as follows:
      public new void Show() {
         // Remember which element has keyboard focus before we show the toast window.
         var focusedElement = Keyboard.FocusedElement;

         Topmost = true;
         base.Show();

         Owner = Application.Current.MainWindow;
         Closed += NotificationWindowClosed;
         AdjustWindows();

         if ( focusedElement != null ) {
            // Restore keyboard focus to the original element that had focus. That way if someone
            // was typing into a control we don't steal keyboard focus away from that control.
            focusedElement.Focusable = true;
            Keyboard.Focus( focusedElement );
         }
      }
Thanks for this helpful toast control!
Coordinator
Nov 14, 2014 at 6:02 PM
Thanks for the feedback. I've taken your recommendation and updated the project and released a new version along with an updated NuGet package. Glad you are finding the controls useful.

Take care,

Lawrence
Nov 14, 2014 at 6:12 PM
Thanks!

Here is another thing that would be helpful for me to have. I changed these times by editing the XAML. It would be great to be able to change these times via code.

Add a means for me to specify these times:
  1. Fade-in time when the toast becomes visible.
  2. Time for how long the toast is visible at full opacity.
  3. Fade-out time when the toast is going away.
It would be great to have this ability because I would not need to create a custom version and could just use your NuGet package.
Coordinator
Nov 14, 2014 at 6:22 PM
Now that the control is getting more traction and usage, it definitely makes sense to add these features. I went ahead and created "features" in the "issues" section of this site. When I get a bit of free time, I'll add these soon. I appreciate your feedback!
Jan 14, 2015 at 7:24 PM
This control is exactly what I've been looking for! Related to the above question, is it possible to override the default styles without working on a forked copy of the project?
Coordinator
Jan 14, 2015 at 7:53 PM
I'm glad you found this! Unfortunately, I haven't had the time to add those features. This project started off probably the same way you found me...I couldn't find anything that really met my needs. The color scheme that you see here is what matches the project that this all started from. If you would like to grab the latest branch and make the changes, I would be happy to merge those into the trunk and cut a new release that way you will always get the updated releases from NuGet.

If nothing else, you can also add a feature request in the "Issues" tab of this site and I will see about getting it knocked out with the others that have been requested.

Take care,

Lawrence
Coordinator
Feb 6, 2015 at 3:43 PM
The release of 2.7.0.0 exposes FontColor, BorderColor and Background properties for the ToastPopUp control.
Marked as answer by accessguru on 4/23/2015 at 5:38 AM