wpf - Create popup "toaster" notifications in Windows with .NET -


I am using .NET and creating a desktop app / service that is notified in the corner of my desktop Will display, when some events are triggered I do not want to use a regular message box B / C which would be very intrusive, I want to slide to see the information and then want to fade after a few seconds. I'm thinking of something that will work out like Outlook alerts when a new message arrives. The question is: Should I use WPF for this? I have not done anything with WPF, but try it to appreciate what that end means the best it is a way to meet with regular NET libraries?

WPF makes it absolutely trivial: it will take practically ten minutes or less these steps Raise:

  1. Create a window, set AllowTransparency = "true" and add a grid to it
  2. A ScaleTransform with the origin of 0 of the grid Set RenderTransform, 1
  3. Gray that ScaleX from 0 to 1 then 1 to 0
  4. Window.Top and Window.Left calculation in the creator animate animating opacity for place But one anne Registration window in the corner of the bottom right hand to create screens.

All this is for this.

To use Expression Blend, it took about 8 minutes to generate the working code as following:

   Window X: Class = "NotificationWindow" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" Title = "notification popup" width = "300" SizeToContent = "height" WindowStyle = "none". AllowTransparency = "right" background = "transparent" & gt; & Lt; Grid Render Transformer = "0,1" & gt; & Lt ;! - Notification Area - & gt; & Lt; Border border border = "1" background = "beige" borderbush = "black" cornerreadia = "10" & gt; & Lt; Stackpayel margin = "20" & gt; & Lt; TextBlock TextWrapping = "Wrap" margin = "5" & gt; & Lt; Bold & gt; Notification Data & lt; / Bold & gt; & Lt; Lineback / & gt; & Lt; Lineback / & gt; Something just happened and you are being informed about it. & Lt; / TextBlock & gt; & Lt; Checkbox content = "checkable" margin = "5 5 0 5" /> & Lt; Button content = "clickable" horizontal align = "center" /> & Lt; / StackPanel & gt; & Lt; / Border & gt; & Lt ;! - Animation - & gt; & Lt; Grid.Triggers & gt; & Lt; Event Trigger Routing Avent = "Framework Element. Loaded" & gt; & Lt; BeginStoryboard & gt; & Lt; Storyboard & gt; & Lt; Double animation tool's frame storyboard. Targetproperty = "(UIElement.RenderTransform). (ScaleTransform.ScaleY)" & gt; & Lt; SplineDoubleKeyFrame Keytime = "0: 0: 0" value = "0" /> & Lt; SplineDoubleKeyFrame Keytime = "0: 0: 0.5" value = "1" /> & Lt; / DoubleAnimationUsingKeyFrames & gt; & Lt; Using Double AnimationFeel Storyboard Targetproperty = "(UIElement.Opacity)" & gt; & Lt; SplineDoubleKeyFrame Keytime = "0: 0: 2" value = "1" /> & Lt; SplineDoubleKeyFrame Kitaim = "0: 0: 4" value = "0" / & gt; & Lt; / DoubleAnimationUsingKeyFrames & gt; & Lt; / Storyboard & gt; & Lt; / BeginStoryboard & gt; & Lt; / EventTrigger & gt; & Lt; /Grid.Triggers> & Lt; Grid.RenderTransform & gt; & Lt; Scale Transform Scale Y = "1" /> & Lt; /Grid.RenderTransform> & Lt; / Grid & gt; & Lt; / Window & gt;  

With the code behind:

  using the system; Using System.Windows; Using System.Windows.Threading; Public Partial Class Notification Window {Public Notification Window () {Initialization (); Dispatcher.BeginInvoke (DispatcherPriority.ApplicationIdle, new Action (() = & gt; {var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; change var = PresentationSource.FromVisual (it) .CompositionTarget.TransformFromDevice; var corner = Change .Transform (new working (workingArea.Right, workingArea.Bottom)); this.Left = corner.x - this.ActualWidth - 100; this.Top = corner.Y - this.ActualHeight;}); }}  

Since WPF Regular One of the .NET libraries, the answer is yes, it is is to complete it with "regular .net libraries".

If you are asking that there is a way to do this without using WPF, then still the answer is, but it is very complex and will take more than 5 days to 5 days.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -