Exemplo n.º 1
0
        private void OnContentTitleLinkDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetData(TrackObjectBase.DraggableFormat) is TrackObjectBase trackObject)
            {
                TracksListPage.Show(trackObject);
            }
            else if (e.Data.GetData(PythonAppObject.DraggableFormat) is PythonAppObject appObject)
            {
                PythonAppsListPage.Show(appObject);
            }
            else if (e.Data.GetData(RaceGridEntry.DraggableFormat) is RaceGridEntry raceGridEntry)
            {
                CarsListPage.Show(raceGridEntry.Car, raceGridEntry.CarSkin?.Id);
            }
            else if (e.Data.GetData(CarObject.DraggableFormat) is CarObject carObject)
            {
                CarsListPage.Show(carObject);
            }
            else
            {
                e.Effects = DragDropEffects.None;
                return;
            }

            e.Effects = DragDropEffects.Copy;
            FancyHints.DragForContentSection.MaskAsUnnecessary();
        }
Exemplo n.º 2
0
        private void TitleLinkContent_OnDrop(object sender, DragEventArgs e)
        {
            var trackObject = e.Data.GetData(TrackObjectBase.DraggableFormat) as TrackObjectBase;

            if (trackObject != null)
            {
                TracksListPage.Show(trackObject);
                e.Effects = DragDropEffects.Copy;
                return;
            }

            var raceGridEntry = e.Data.GetData(RaceGridEntry.DraggableFormat) as RaceGridEntry;

            if (raceGridEntry != null)
            {
                CarsListPage.Show(raceGridEntry.Car, raceGridEntry.CarSkin?.Id);
                e.Effects = DragDropEffects.Copy;
                return;
            }

            var carObject = e.Data.GetData(CarObject.DraggableFormat) as CarObject;

            if (carObject != null)
            {
                CarsListPage.Show(carObject);
                e.Effects = DragDropEffects.Copy;
                return;
            }

            e.Effects = DragDropEffects.None;
        }
Exemplo n.º 3
0
        private void OnContentTitleLinkDrop(object sender, DragEventArgs e)
        {
            var trackObject = e.Data.GetData(TrackObjectBase.DraggableFormat) as TrackObjectBase;

            if (trackObject != null)
            {
                TracksListPage.Show(trackObject);
            }
            else
            {
                var raceGridEntry = e.Data.GetData(RaceGridEntry.DraggableFormat) as RaceGridEntry;
                if (raceGridEntry != null)
                {
                    CarsListPage.Show(raceGridEntry.Car, raceGridEntry.CarSkin?.Id);
                }
                else
                {
                    var carObject = e.Data.GetData(CarObject.DraggableFormat) as CarObject;
                    if (carObject != null)
                    {
                        CarsListPage.Show(carObject);
                    }
                    else
                    {
                        e.Effects = DragDropEffects.None;
                        return;
                    }
                }
            }

            e.Effects = DragDropEffects.Copy;
            FancyHints.DragForContentSection.MaskAsUnnecessary();
        }
Exemplo 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();

            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);
        }
Exemplo n.º 5
0
 private void SelectedCarContextMenuButton_OnClick(object sender, ContextMenuButtonEventArgs e)
 {
     e.Menu = new ContextMenu()
              .AddItem("Change car to random", Model.RandomCarCommand, @"Ctrl+Alt+1")
              .AddItem("Change skin to random", Model.RandomCarSkinCommand, @"Ctrl+Alt+R")
              .AddItem("Randomize everything", Model.RandomizeCommand, @"Alt+R", iconData: (Geometry)TryFindResource(@"ShuffleIconData"))
              .AddSeparator()
              .AddItem("Open car in Content tab", () => {
         CarsListPage.Show(Model.SelectedCar, Model.SelectedCar.SelectedSkin?.Id);
     });
 }
Exemplo n.º 6
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);
        }