Mega Code Archive

 
Categories / C# / WPF
 

DispatcherTimer set up

<Window x:Class="_360Timer.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Concentric Rings" Width="910" Height="512">   <Canvas Name="MainCanvas" Background="#FFE0E0E0"/> </Window> //File:Window.xaml.cs using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Shapes; using System.Windows.Media.Animation; namespace _360Timer {     public partial class Window1 : Window     {         System.Windows.Threading.DispatcherTimer frameTimer;         public Window1()         {             InitializeComponent();             frameTimer = new System.Windows.Threading.DispatcherTimer();             frameTimer.Tick += OnFrame;             frameTimer.Interval = TimeSpan.FromSeconds(1.0 / 60.0);             frameTimer.Start();             this.Show();         }         private void OnFrame(object sender, EventArgs e)         {         }     } }