Exemple #1
0
 public DirectControl()
 {
     rectangle = new System.Windows.Shapes.Rectangle();
     try
     {
         CreateDirectImage();
         //throw new Exception("Artificial exception");
     }
     catch (Exception e)
     {
         // In case of error, just display message on Control
         messageBlock = new TextBlock() { Margin = new Thickness(5), Foreground = Brushes.Red };
         messageBlock.Text = "Error initializing DirectX control: " +  e.Message;
         messageBlock.Text += "\rTry installing latest DirectX End-User Runtime";
         this.Children.Add(messageBlock);
         directImage = null;
         initializationFailed = true;
         return;
     }
     directImage.RenderRequested += new EventHandler(directImage_RenderRequested);
     this.Children.Add(rectangle);
     RecreateImage();
     this.IsVisibleChanged += new DependencyPropertyChangedEventHandler(DirectControl_IsVisibleChanged);
     frontBufferCheckTimer.Tick += new EventHandler(frontBufferCheckTimer_Tick);
     frontBufferCheckTimer.Interval = TimeSpan.FromSeconds(0.5);
     frontBufferCheckTimer.Start();
 }
 public DirectControl()
 {
     rectangle = new System.Windows.Shapes.Rectangle();
     try
     {
         CreateDirectImage();
         //throw new Exception("Artificial exception");
     }
     catch (Exception e)
     {
         // In case of error, just display message on Control
         messageBlock = new TextBlock()
         {
             Margin = new Thickness(5), Foreground = Brushes.Red
         };
         messageBlock.Text  = "Error initializing DirectX control: " + e.Message;
         messageBlock.Text += "\rTry installing latest DirectX End-User Runtime";
         this.Children.Add(messageBlock);
         directImage          = null;
         initializationFailed = true;
         return;
     }
     directImage.RenderRequested += new EventHandler(directImage_RenderRequested);
     this.Children.Add(rectangle);
     RecreateImage();
     this.IsVisibleChanged         += new DependencyPropertyChangedEventHandler(DirectControl_IsVisibleChanged);
     frontBufferCheckTimer.Tick    += new EventHandler(frontBufferCheckTimer_Tick);
     frontBufferCheckTimer.Interval = TimeSpan.FromSeconds(0.5);
     frontBufferCheckTimer.Start();
 }
 public void Register(DirectImage image)
 {
     if (imageList.Contains(image))
     {
         throw new Exception("Multiple registration attempted.");
     }
     imageList.Add(image);
 }
 public void Unregister(DirectImage image)
 {
     imageList.Remove(image);
 }
 public void Unregister(DirectImage image)
 {
     imageList.Remove(image);
 }
 public void Register(DirectImage image)
 {
     if (imageList.Contains(image)) throw new Exception("Multiple registration attempted."); 
     imageList.Add(image);
 }
 public DirectPath()
 {
     this.geometry    = null;
     this.directImage = null;
 }
Exemple #8
0
 public DirectPath()
 {
     this.geometry = null;
     this.directImage = null;
 }