public PlaystationControllerPage() { this.InitializeComponent(); GlobalSettings.ApplyThemeTo(this); CancellationToken = new CancellationTokenSource(); this.Loaded += (s1, e1) => { Triangle_TextBlock.Foreground = new SolidColorBrush(Colors.ForestGreen); Circle_TextBlock.Foreground = new SolidColorBrush(Colors.IndianRed); Ex_TextBlock.Foreground = new SolidColorBrush(Colors.DodgerBlue); Square_TextBlock.Foreground = new SolidColorBrush(Colors.MediumPurple); Initialize(); controller = new PlaystationController(); controller.Connected += (s2, e2) => { SetConnectedAsync(); }; controller.Disconnected += (s2, e2) => { SetDisonnectedAsync(); }; controller.Refresh(); }; }
public ControllerDeadzonePage() { this.InitializeComponent(); GlobalSettings.ApplyThemeTo(this); RightDeadzoneCoordinatesGrid.BorderThickness = new Windows.UI.Xaml.Thickness(0); LeftDeadzoneCoordinatesGrid.BorderThickness = new Windows.UI.Xaml.Thickness(0); RightDeadzoneSliderGrid.BorderThickness = new Windows.UI.Xaml.Thickness(0); LeftDeadzoneSliderGrid.BorderThickness = new Windows.UI.Xaml.Thickness(0); CancellationToken = new CancellationTokenSource(); LeftPainter = new Painter(CreateAnEllipse(5, 5), LeftCanvas, LEFT); RightPainter = new Painter(CreateAnEllipse(5, 5), RightCanvas, RIGHT); this.Loaded += (s1, e1) => { switch (GlobalSettings.ControllerType) { case CONTROLLER_TYPE.XBOX: XboxController xboxController = new XboxController(); xboxController.Connected += (s2, e2) => { SetConnectedAsync(); }; xboxController.Disconnected += (s2, e2) => { SetDisconnectedAsync(); }; xboxController.Refresh(); Controller = xboxController; break; case CONTROLLER_TYPE.GENERIC: GenericController genericController = new GenericController(); genericController.Connected += (s2, e2) => { SetConnectedAsync(); }; genericController.Disconnected += (s2, e2) => { SetDisconnectedAsync(); }; genericController.Refresh(); Controller = genericController; break; case CONTROLLER_TYPE.PLAYSTATION: PlaystationController playstationController = new PlaystationController(); playstationController.Connected += (s2, e2) => { SetConnectedAsync(); }; playstationController.Disconnected += (s2, e2) => { SetDisconnectedAsync(); }; playstationController.Refresh(); Controller = playstationController; break; } }; }