Beispiel #1
0
        public Audio(FullscreenAppViewModel mainModel)
        {
            InitializeComponent();

            SliderInterfaceVolume.Minimum             = 0;
            SliderInterfaceVolume.Maximum             = 1;
            SliderInterfaceVolume.SmallChange         = 0.05;
            SliderInterfaceVolume.LargeChange         = 0.05;
            SliderInterfaceVolume.TickFrequency       = 0.05;
            SliderInterfaceVolume.IsSnapToTickEnabled = true;
            BindingTools.SetBinding(
                SliderInterfaceVolume,
                Slider.ValueProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.InterfaceVolume),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            SliderMusicVolume.Minimum             = 0;
            SliderMusicVolume.Maximum             = 1;
            SliderMusicVolume.SmallChange         = 0.05;
            SliderMusicVolume.LargeChange         = 0.05;
            SliderMusicVolume.TickFrequency       = 0.05;
            SliderMusicVolume.IsSnapToTickEnabled = true;
            BindingTools.SetBinding(
                SliderMusicVolume,
                Slider.ValueProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.BackgroundVolume),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleMuteInBackground,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.MuteInBackground),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            SelectorBehaviors.SetEnumSource(SelectAudioApi, typeof(AudioInterfaceApi));
            BindingTools.SetBinding(
                SelectAudioApi,
                Selector.SelectedValueProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.AudioInterfaceApi),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);
        }
Beispiel #2
0
        public General(FullscreenAppViewModel mainModel)
        {
            InitializeComponent();

            SelectMonitor.ItemsSource       = mainModel.AppSettings.Fullscreen.AvailableScreens;
            SelectMonitor.DisplayMemberPath = nameof(System.Windows.Forms.Screen.DeviceName);
            BindingTools.SetBinding(
                SelectMonitor,
                Selector.SelectedIndexProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.Monitor),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleBattery,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.ShowBattery),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleBatteryPercentage,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.ShowBatteryPercentage),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleClock,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.ShowClock),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                TogglePrimaryDisplayOnly,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.UsePrimaryDisplay),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleAsyncImageLoad,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.AsyncImageLoading),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                ToggleMinimizeAfterGame,
                ToggleButton.IsCheckedProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.MinimizeAfterGameStartup),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);

            BindingTools.SetBinding(
                SelectImageScaler,
                Selector.SelectedValueProperty,
                mainModel.AppSettings.Fullscreen,
                nameof(FullscreenSettings.ImageScalerMode),
                BindingMode.TwoWay,
                UpdateSourceTrigger.PropertyChanged);
            SelectorBehaviors.SetEnumSource(SelectImageScaler, typeof(Playnite.ImageLoadScaling));
        }