//@Converter private Visibility DeviceLayoutTypeConverter(DeviceLayoutType type) => type == DeviceLayoutType.Phone ? Visibility.Collapsed : Visibility.Visible;
// DeviceLayout private void ConstructDeviceLayout() { DeviceLayout deviceLayout = this.SettingViewModel.Setting.DeviceLayout; // Type { DeviceLayoutType type = deviceLayout.FallBackType; bool isAdaptive = deviceLayout.IsAdaptive; this.PhoneButton.IsChecked = (isAdaptive == false && type == DeviceLayoutType.Phone); this.PadButton.IsChecked = (isAdaptive == false && type == DeviceLayoutType.Pad); this.PCButton.IsChecked = (isAdaptive == false && type == DeviceLayoutType.PC); this.AdaptiveButton.IsChecked = (isAdaptive); this.PhoneButton.Click += async(s, e) => await this.SetDeviceLayoutType(DeviceLayoutType.Phone, false); this.PadButton.Click += async(s, e) => await this.SetDeviceLayoutType(DeviceLayoutType.Pad, false); this.PCButton.Click += async(s, e) => await this.SetDeviceLayoutType(DeviceLayoutType.PC, false); this.AdaptiveButton.Click += async(s, e) => await this.SetDeviceLayoutType(DeviceLayoutType.PC, true); } // Adaptive { int phone = deviceLayout.PhoneMaxWidth; int pad = deviceLayout.PadMaxWidth; this.AdaptiveWidthGrid.PhoneWidth = phone; this.AdaptiveWidthGrid.PadWidth = pad; this.AdaptiveWidthGrid.SetWidth(); this.AdaptiveWidthGrid.ScrollModeChanged += (s, mode) => { this.ScrollViewer.HorizontalScrollMode = mode; this.ScrollViewer.VerticalScrollMode = mode; }; this.AdaptiveWidthGrid.PhoneWidthChanged += async(s, value) => { // Setting DeviceLayout layout = this.SettingViewModel.Setting.DeviceLayout; { layout.PhoneMaxWidth = value; DeviceLayoutType type = layout.GetActualType(this.ActualWidth); this.SettingViewModel.DeviceLayoutType = type; } await this.Save(); }; this.AdaptiveWidthGrid.PadWidthChanged += async(s, value) => { // Setting DeviceLayout layout = this.SettingViewModel.Setting.DeviceLayout; { layout.PadMaxWidth = value; DeviceLayoutType type = layout.GetActualType(this.ActualWidth); this.SettingViewModel.DeviceLayoutType = type; } await this.Save(); }; } this.ResetAdaptiveWidthButton.Click += async(s, e) => { DeviceLayout default2 = DeviceLayout.Default; int phone2 = default2.PhoneMaxWidth; int pad2 = default2.PadMaxWidth; this.AdaptiveWidthGrid.PhoneWidth = phone2; this.AdaptiveWidthGrid.PadWidth = pad2; this.AdaptiveWidthGrid.SetWidth(); // Setting DeviceLayout layout = this.SettingViewModel.Setting.DeviceLayout; { layout.PhoneMaxWidth = phone2; layout.PadMaxWidth = pad2; DeviceLayoutType type = layout.GetActualType(this.ActualWidth); this.SettingViewModel.DeviceLayoutType = type; } await this.Save(); }; }