示例#1
0
        public OtherControllerPage()
        {
            this.InitializeComponent();

            GlobalSettings.ApplyThemeTo(this);

            CancellationToken = new CancellationTokenSource();

            this.Loaded += (s1, e1) =>
            {
                X_Button_TextBlock.Foreground = new SolidColorBrush(Colors.Blue);
                Y_Button_TextBlock.Foreground = new SolidColorBrush(Colors.Yellow);
                B_Button_TextBlock.Foreground = new SolidColorBrush(Colors.Red);
                A_Button_TextBlock.Foreground = new SolidColorBrush(Colors.LawnGreen);

                Initialize();

                controller = new GenericController();

                controller.Connected += (s2, e2) =>
                {
                    SetConnectedAsync();
                };

                controller.Disconnected += (s2, e2) =>
                {
                    SetDisonnectedAsync();
                };

                controller.Refresh();
            };
        }
示例#2
0
        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();
            };
        }
示例#3
0
        public HomePage()
        {
            this.InitializeComponent();

            GlobalSettings.ApplyThemeTo(this);

            HomePageSettingsGrid.BorderThickness = new Thickness(0);

            LoadController();
        }
示例#4
0
        public SettingsPage()
        {
            this.InitializeComponent();

            GlobalSettings.ApplyThemeTo(this);

            this.Loaded += (s, e) =>
            {
                Defaults();
            };
        }
示例#5
0
        public AboutPage()
        {
            this.InitializeComponent();

            GlobalSettings.ApplyThemeTo(this);

            string text = "Controller icons made by smashicons."
                          + "\n\n" +
                          "Keyboard icon made by freepik." + "\n\n" +
                          "Generic Controller icon made by freepik." + "\n\n";

            About_Text.Text = text;
        }
示例#6
0
        public MainPage()
        {
            this.InitializeComponent();

            GlobalSettings.ApplyDefaults();
            GlobalSettings.ApplyThemeTo(this);

            Press.DirectionBrushes = new List <Brush>();
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.PRESSED), new SolidColorBrush(Colors.LawnGreen));
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.UP), new SolidColorBrush(Colors.Red));
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.DOWN), new SolidColorBrush(Colors.Yellow));
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.LEFT), new SolidColorBrush(Colors.DodgerBlue));
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.RIGHT), new SolidColorBrush(Colors.White));
            Press.DirectionBrushes.Insert((int)Math.Sqrt((int)Press.DIRECTION.NONE), new SolidColorBrush(Colors.LawnGreen));

            Press.DirectionHit = new List <double>();
            Press.DirectionHit = new List <double>();

            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.PRESSED), 0.1);
            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.UP), 0.1);
            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.DOWN), 0.1);
            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.LEFT), 0.1);
            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.RIGHT), 0.1);
            Press.DirectionHit.Insert((int)Math.Sqrt((int)Press.DIRECTION.NONE), 0.1);

            NavView.ItemInvoked += NavigationView_OnItemInvoked;

            NavView.SelectionChanged += (s, e) =>
            {
                if (_lastItem == null)
                {
                    return;
                }
            };

            NavView.Loaded += (s, e) =>
            {
                var settings = (NavigationViewItem)NavView.SettingsItem;
                settings.IsTabStop   = false;
                NavView.PaneClosing += (ss, ee) =>
                {
                    NavView.IsPaneOpen = true;
                };
            };

            ContentFrame.Navigate(typeof(HomePage));
            Home_Navigation.IsSelected = true;
        }
示例#7
0
        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;
                }
            };
        }
示例#8
0
 private void Dark_Radio_Button_Checked(object sender, RoutedEventArgs e)
 {
     Light_Radio_Button.IsChecked = false;
     GlobalSettings.Theme         = GlobalSettings.DARK;
     GlobalSettings.ApplyThemeTo(this);
 }