Esempio n. 1
0
        public SelectCarDialog(CarObject car)
        {
            _selectedCar = new DelayedPropertyWrapper <CarObject>(SelectedCarChanged);

            SelectedCar = car;
            _instance   = new WeakReference <SelectCarDialog>(this);

            DataContext = this;
            InputBindings.AddRange(new[] {
                new InputBinding(OpenInShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Control)),
                new InputBinding(OpenInShowroomOptionsCommand, new KeyGesture(Key.H, ModifierKeys.Control | ModifierKeys.Shift)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt | ModifierKeys.Control))
            });
            InitializeComponent();

            CarBlock.BrandArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = BrandUri(SelectedCar.Brand);
            };

            CarBlock.ClassArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = ClassUri(SelectedCar.CarClass);
            };

            CarBlock.YearArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = YearUri(SelectedCar.Year);
            };

            CarBlock.CountryArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = CountryUri(SelectedCar.Country);
            };

            Buttons = new [] { OkButton, CancelButton };
        }
Esempio n. 2
0
        public AcListPage() {
            SelectMode = false;

            _selectedWrapper = new DelayedPropertyWrapper<AcItemWrapper>(async v => {
                CurrentObject = v?.Loaded();

                if (v != null && SettingsHolder.Content.ScrollAutomatically) {
                    await Task.Delay(1);
                    _list?.ScrollIntoView(_list.SelectedItem);
                }
            });
        }
Esempio n. 3
0
        public AcListPage()
        {
            SelectMode = false;

            _selectedWrapper = new DelayedPropertyWrapper <AcItemWrapper>(async v => {
                CurrentObject = v?.Loaded();

                if (v != null && SettingsHolder.Content.ScrollAutomatically)
                {
                    await Task.Delay(1);
                    _list?.ScrollIntoView(_list.SelectedItem);
                }
            });
        }
Esempio n. 4
0
            public ViewModel([NotNull] TrackObjectBase selectedTrackConfiguration)
            {
                _selectedTrackConfiguration = new DelayedPropertyWrapper <TrackObjectBase>(v => {
                    if (v == null)
                    {
                        return;
                    }

                    v.MainTrackObject.SelectedLayout = v;
                    CurrentPreviewImage = v.PreviewImage;

                    OnPropertyChanged(nameof(SelectedTrackConfiguration));
                    OnPropertyChanged(nameof(SelectedTrack));
                });

                SelectedTrackConfiguration = selectedTrackConfiguration;
            }
Esempio n. 5
0
        public SelectCarDialog(CarObject car, string defaultFilter = null)
        {
            _selectedCar = new DelayedPropertyWrapper <CarObject>(SelectedCarChanged);

            SelectedCar = car;
            _instance   = new WeakReference <SelectCarDialog>(this);

            DataContext = this;
            InputBindings.AddRange(new[] {
                new InputBinding(ToggleFavouriteCommand, new KeyGesture(Key.B, ModifierKeys.Control)),
                new InputBinding(OpenInShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Control)),
                new InputBinding(OpenInShowroomOptionsCommand, new KeyGesture(Key.H, ModifierKeys.Control | ModifierKeys.Shift)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt | ModifierKeys.Control))
            });
            InitializeComponent();

            CarBlock.BrandArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = BrandUri(SelectedCar.Brand);
            };

            CarBlock.ClassArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = ClassUri(SelectedCar.CarClass);
            };

            CarBlock.YearArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = YearUri(SelectedCar.Year);
            };

            CarBlock.CountryArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = CountryUri(SelectedCar.Country);
            };

            Buttons = new [] { OkButton, CancelButton };

            if (defaultFilter != null)
            {
                Tabs.SavePolicy     = SavePolicy.SkipLoadingFlexible;
                Tabs.SelectedSource = UriExtension.Create("/Pages/Miscellaneous/AcObjectSelectList.xaml?Type=car&Filter={0}&Title={0}", defaultFilter);
            }
        }
Esempio n. 6
0
        public SelectCarDialog(CarObject car) {
            _selectedCar = new DelayedPropertyWrapper<CarObject>(SelectedCarChanged);

            SelectedCar = car;
            _instance = new WeakReference<SelectCarDialog>(this);

            DataContext = this;
            InputBindings.AddRange(new[] {
                new InputBinding(OpenInShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Control)),
                new InputBinding(OpenInShowroomOptionsCommand, new KeyGesture(Key.H, ModifierKeys.Control | ModifierKeys.Shift)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt)),
                new InputBinding(OpenInCustomShowroomCommand, new KeyGesture(Key.H, ModifierKeys.Alt | ModifierKeys.Control))
            });
            InitializeComponent();

            CarBlock.BrandArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = BrandUri(SelectedCar.Brand);
            };

            CarBlock.ClassArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = ClassUri(SelectedCar.CarClass);
            };

            CarBlock.YearArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = YearUri(SelectedCar.Year);
            };

            CarBlock.CountryArea.PreviewMouseLeftButtonDown += (sender, args) => {
                Tabs.SelectedSource = CountryUri(SelectedCar.Country);
            };

            Buttons = new [] { OkButton, CancelButton };
        }
Esempio n. 7
0
            public ViewModel(TrackObjectBase selectedTrackConfiguration) {
                _selectedTrackConfiguration = new DelayedPropertyWrapper<TrackObjectBase>(v => {
                    if (v == null) return;

                    v.MainTrackObject.SelectedLayout = v;
                    CurrentPreviewImage = v.PreviewImage;

                    OnPropertyChanged(nameof(SelectedTrackConfiguration));
                    OnPropertyChanged(nameof(SelectedTrack));
                });

                SelectedTrackConfiguration = selectedTrackConfiguration;
            }