using Psychlops; namespace PsychlopsSilverlight4test { public partial class MainPage : System.Windows.Controls.UserControl { //System.Collections.Generic.IEnumerator main_routine; public System.Windows.Controls.Image master; public PsychlopsMain main; #if DEBUG public System.Windows.Controls.TextBlock DebugConsole; #endif public MainPage() { InitializeComponent(); // Show fps counter Canvas.default_api_canvas = LayoutRoot; Canvas.default_panel = this; this.IsTabStop = true; this.IsEnabled = true; this.MouseEnter += getFocusMouseEnter; System.Windows.Application.Current.Host.Settings.MaxFrameRate = 60; System.Windows.Application.Current.Host.Settings.EnableFrameRateCounter = true; System.Windows.Application.Current.Host.Settings.EnableCacheVisualization = false; //System.Windows.Application.Current.Host.Settings.EnableGPUAcceleration = false; // System.Windows.Media.CompositionTarget.Rendering += new System.EventHandler(CompositionTarget_Rendering); //main_routine = new System.ComponentModel.BackgroundWorker(); //main_routine.DoWork += new System.ComponentModel.DoWorkEventHandler(psychlops_main); //main_routine.RunWorkerAsync(); main = new PsychlopsMain(); // Psychlops.AppState.statusBar. Psychlops.Internal.Main.routine = new System.Threading.Thread(main.psychlops_main); Psychlops.Internal.Main.routine.Start(); //main.initialize(); //main_routine = main.psychlops_main(); Psychlops.Internal.Main.statusBar = AppStatusBar; //Psychlops.Internal.Main.widgetStack = Controller; AppStatusBar.Text = "Now starting Psychlops environment... please wait a minute"; var ur = new System.Uri("Resources/logo.png", System.UriKind.RelativeOrAbsolute); var bitmap = new System.Windows.Media.Imaging.BitmapImage(ur); var img = new System.Windows.Controls.Image(); img.Source = bitmap; System.Windows.Controls.Canvas.SetLeft(img, 100); System.Windows.Controls.Canvas.SetTop(img, 100); LayoutRoot.Children.Add(img); } protected void getFocusMouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { this.Focus(); } private void CompositionTarget_Rendering(object sender, System.EventArgs e) { if (Main.canvas != null) Main.canvas.executeFlip(); //if (nextIntervalFrame-- <= 0) //{ // main_routine.MoveNext(); // nextIntervalFrame = main_routine.Current; //} } } }