예제 #1
0
        public MainPage()
        {
            this.InitializeComponent();
            _numRows = MIN_ROWS;

            _mazeRunner = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/luna.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _mazeEnd = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/doghouse.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _mazeComplete = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/dogInHouse.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _newSolidBorderThickness = new Thickness(_borderThickness);
            _newButtonStyle          = (Style)this.Resources["MazeCellStyle"];

            _mazeCreator = Creator.GetCreator();

            _solutionTimer          = new DispatcherTimer();
            _solutionTimer.Interval = TimeSpan.FromSeconds(0.1);
            _solutionTimer.Tick    += OnSolutionTimerTick;

            _cellCreationTimer          = new DispatcherTimer();
            _cellCreationTimer.Interval = TimeSpan.FromMilliseconds(50);
            _cellCreationTimer.Tick    += OnCellCreationTimer_Tick;

            _openCellTimer          = new DispatcherTimer();
            _openCellTimer.Interval = TimeSpan.FromMilliseconds(50);
            _openCellTimer.Tick    += OnOpenCellTimer_Tick;

            _mazeCells   = new List <Point>();
            _breadCrumbs = new List <Point>();

            Loaded += MainPage_Loaded;

            CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) {
                GazeInput.GetGazePointer(this).Click();
            });

            var sharedSettings = new ValueSet();

            GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) =>
            {
                GazeInput.LoadSettings(sharedSettings);
            });
        }
예제 #2
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

            VersionTextBlock.Text = GetAppVersion();

            GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.Transparent);

            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            LoadedImageSurface loadedSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/BorderDot.png"), new Size(_cellSize, _cellSize));

            _breadCrumbBrush         = _compositor.CreateSurfaceBrush();
            _breadCrumbBrush.Surface = loadedSurface;

            _numRows = MIN_ROWS;

            _mazeRunner = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/luna.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _mazeEnd = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/doghouse.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _mazeComplete = new Image
            {
                Source            = new BitmapImage(new Uri(this.BaseUri, "/Assets/dogInHouse.png")),
                VerticalAlignment = VerticalAlignment.Center
            };

            _newSolidBorderThickness = new Thickness(_borderThickness);
            _newButtonStyle          = (Style)this.Resources["MazeCellStyle"];

            _mazeCreator = Creator.GetCreator();

            _solutionTimer          = new DispatcherTimer();
            _solutionTimer.Interval = TimeSpan.FromSeconds(0.1);
            _solutionTimer.Tick    += OnSolutionTimerTick;

            _cellCreationTimer          = new DispatcherTimer();
            _cellCreationTimer.Interval = TimeSpan.FromMilliseconds(50);
            _cellCreationTimer.Tick    += OnCellCreationTimer_Tick;

            _openCellTimer          = new DispatcherTimer();
            _openCellTimer.Interval = TimeSpan.FromMilliseconds(50);
            _openCellTimer.Tick    += OnOpenCellTimer_Tick;

            _mazeCells   = new List <Point>();
            _breadCrumbs = new List <Point>();

            Loaded += MainPage_Loaded;

            CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) {
                GazeInput.GetGazePointer(this).Click();
            });

            var sharedSettings = new ValueSet();

            GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) =>
            {
                GazeInput.LoadSettings(sharedSettings);
            });
        }