Ejemplo n.º 1
0
        private void SkinLivery_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            var control = new CarBlock {
                Car          = Model.Car,
                SelectedSkin = Model.CarSkin,
                SelectSkin   = SettingsHolder.Drive.KunosCareerUserSkin,
                OpenShowroom = true
            };

            var dialog = new ModernDialog {
                Content       = control,
                Width         = 640,
                Height        = 720,
                MaxWidth      = 640,
                MaxHeight     = 720,
                SizeToContent = SizeToContent.Manual,
                Title         = Model.Car.DisplayName
            };

            dialog.Buttons = new[] { dialog.OkButton, dialog.CancelButton };
            dialog.ShowDialog();

            if (dialog.IsResultOk)
            {
                Model.CarSkin = control.SelectedSkin;
            }
        }
        private void CarPreview_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var ev = Model.AcObject.SelectedEvent;

            if (ev == null)
            {
                return;
            }

            var control = new CarBlock {
                Car          = ev.CarObject,
                SelectedSkin = ev.CarSkin,
                SelectSkin   = SettingsHolder.Drive.KunosCareerUserSkin,
                OpenShowroom = true
            };

            var dialog = new ModernDialog {
                Content       = control,
                Width         = 640,
                Height        = 720,
                MaxWidth      = 640,
                MaxHeight     = 720,
                SizeToContent = SizeToContent.Manual,
                Title         = ev.CarObject.DisplayName
            };

            dialog.Buttons = new[] { dialog.OkButton, dialog.CancelButton };
            dialog.ShowDialog();

            if (dialog.IsResultOk && SettingsHolder.Drive.KunosCareerUserSkin)
            {
                ev.CarSkin = control.SelectedSkin;
            }
        }
Ejemplo n.º 3
0
        public void SetCarObjectMenu(ContextMenu menu, CarObject car, CarSkinObject skin)
        {
            menu.AddItem("Manage setups", () => CarSetupsListPage.Open(car))
            .AddItem("Manage skins", () => CarSkinsListPage.Open(car))
            .AddSeparator();
            CarBlock.OnShowroomContextMenu(menu, car, skin);

            menu.AddSeparator();

            var ratingBar = new RatingBar {
                Rating = car.Rating ?? 0
            };

            ratingBar.SetBinding(RatingBar.RatingProperty, new Binding("Rating")
            {
                Source = car
            });
            menu.AddItem(new MenuItem {
                StaysOpenOnClick = true,
                Header           = new DockPanel {
                    Margin   = new Thickness(0d, 0d, -40d, 0d),
                    Children =
                    {
                        new TextBlock       {
                            Text = "Rating:", Width = 80
                        },
                        ratingBar,
                        new FavouriteButton {
                            IsChecked = car.IsFavourite
                        }
                    }
                }
            });
            menu.AddItem(new MenuItem {
                StaysOpenOnClick = true,
                Header           = new DockPanel {
                    Margin   = new Thickness(0d, 0d, -40d, 0d),
                    Children =
                    {
                        new TextBlock  {
                            Text = "Notes:", Width = 80
                        },
                        new NotesBlock {
                            AcObject = car
                        }
                    }
                }
            });

            menu.AddSeparator();

            if (!QuickDrive.IsActive())
            {
                menu.AddItem("Open car in Quick Drive", () => QuickDrive.Show(car, skin?.Id));
            }

            menu.AddItem("Open car in Content tab", () => CarsListPage.Show(car, skin?.Id))
            .AddItem(AppStrings.Toolbar_Folder, car.ViewInExplorer);
        }
Ejemplo n.º 4
0
        public void SetCarObjectMenu(ContextMenu menu, CarObject car, CarSkinObject skin)
        {
            menu.AddItem("Manage setups", () => CarSetupsListPage.Open(car))
            .AddItem("Manage skins", () => CarSkinsListPage.Open(car))
            .AddSeparator();
            CarBlock.OnShowroomContextMenu(menu, car, skin);

            menu.AddSeparator();

            if (!QuickDrive.IsActive())
            {
                menu.AddItem("Open car in Quick Drive", () => QuickDrive.Show(car, skin?.Id));
            }

            menu.AddItem("Open car in Content tab", () => CarsListPage.Show(car, skin?.Id))
            .AddItem(AppStrings.Toolbar_Folder, car.ViewInExplorer);
        }
Ejemplo n.º 5
0
        private void OpponentSkin_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var entry = (sender as FrameworkElement)?.DataContext as RaceGridEntry;

            if (entry?.SpecialEntry != false)
            {
                return;
            }

            var dataGrid = (DetailsPopup.Content as FrameworkElement)?.FindVisualChild <DataGrid>();

            if (dataGrid != null)
            {
                dataGrid.SelectedItem = entry;
            }

            DetailsPopup.StaysOpen = true;

            var control = new CarBlock {
                Car          = entry.Car,
                SelectedSkin = entry.CarSkin ?? entry.Car.SelectedSkin,
                SelectSkin   = true,
                OpenShowroom = true
            };

            var dialog = new ModernDialog {
                Content       = control,
                Width         = 640,
                Height        = 720,
                MaxWidth      = 640,
                MaxHeight     = 720,
                SizeToContent = SizeToContent.Manual,
                Title         = entry.Car.DisplayName
            };

            dialog.Buttons = new[] { dialog.OkButton, dialog.CancelButton };
            dialog.ShowDialog();

            if (dialog.IsResultOk)
            {
                entry.CarSkin = control.SelectedSkin;
            }

            DetailsPopup.StaysOpen = false;
        }
Ejemplo n.º 6
0
        private void OnOpponentCellClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 2)
            {
                var entry = (sender as FrameworkElement)?.DataContext as RaceGridEntry;
                if (entry?.SpecialEntry != false)
                {
                    return;
                }

                var control = new CarBlock {
                    Car          = entry.Car,
                    SelectedSkin = entry.CarSkin ?? entry.Car.SelectedSkin,
                    SelectSkin   = true,
                    OpenShowroom = true
                };

                var dialog = new ModernDialog {
                    Content       = control,
                    Width         = 640,
                    Height        = 720,
                    MaxWidth      = 640,
                    MaxHeight     = 720,
                    SizeToContent = SizeToContent.Manual,
                    Title         = entry.Car.DisplayName
                };

                dialog.Buttons = new[] { dialog.OkButton, dialog.CancelButton };
                dialog.ShowDialog();

                if (dialog.IsResultOk)
                {
                    entry.CarSkin = control.SelectedSkin;
                }
            }
        }
Ejemplo n.º 7
0
        private void CreateCarBlock(CarAutopark car)
        {
            CarBlock cb = new CarBlock(car, FindResource("LastPhoto"), FindResource("NextPhoto"));

            spCarList.Children.Add(cb.GetBlock());
        }