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(); }
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; }
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(); }
private void SelectedTrackContextMenuButton_OnClick(object sender, ContextMenuButtonEventArgs e) { e.Menu = new ContextMenu() .AddItem("Change track to random", Model.RandomTrackCommand, @"Ctrl+Alt+2") .AddItem("Randomize everything", Model.RandomizeCommand, @"Alt+R", iconData: (Geometry)TryFindResource(@"ShuffleIconData")) .AddSeparator() .AddItem("Open track in Content tab", () => { TracksListPage.Show(Model.SelectedTrack); }, isEnabled: AppKeyHolder.IsAllRight); }
public void SetTrackObjectMenu(ContextMenu menu, TrackObjectBase track) { var mainTrack = track.MainTrackObject; mainTrack.SkinsManager.EnsureLoaded(); if (mainTrack.EnabledOnlySkins.Count > 0) { foreach (var skinObject in mainTrack.EnabledOnlySkins) { var item = new MenuItem { Header = skinObject.DisplayName.ToTitle(), IsCheckable = true, StaysOpenOnClick = true, ToolTip = skinObject.Description }; item.SetBinding(MenuItem.IsCheckedProperty, new Binding { Path = new PropertyPath(nameof(skinObject.IsActive)), Source = skinObject }); menu.Items.Add(item); } menu.AddSeparator(); } menu.AddItem("Manage skins", () => TrackSkinsListPage.Open(track.MainTrackObject)); menu.AddSeparator(); if (!QuickDrive.IsActive()) { menu.AddItem("Open track in Quick Drive", () => QuickDrive.Show(track: track)); } menu.AddItem("Open track in Content tab", () => TracksListPage.Show(track), isEnabled: InternalUtils.IsAllRight) .AddItem(AppStrings.Toolbar_Folder, track.ViewInExplorer); }
public void SetTrackObjectMenu(ContextMenu menu, TrackObjectBase track) { var mainTrack = track.MainTrackObject; mainTrack.SkinsManager.EnsureLoaded(); if (mainTrack.EnabledOnlySkins.Count > 0) { foreach (var skinObject in mainTrack.EnabledOnlySkins) { var item = new MenuItem { Header = skinObject.DisplayName.ToTitle(), IsCheckable = true, StaysOpenOnClick = true, ToolTip = skinObject.Description }; item.SetBinding(MenuItem.IsCheckedProperty, new Binding { Path = new PropertyPath(nameof(skinObject.IsActive)), Source = skinObject }); menu.Items.Add(item); } menu.AddSeparator(); } menu.AddItem("Manage skins", () => TrackSkinsListPage.Open(track.MainTrackObject)); menu.AddSeparator(); var ratingBar = new RatingBar { Rating = track.MainTrackObject.Rating ?? 0 }; ratingBar.SetBinding(RatingBar.RatingProperty, new Binding("Rating") { Source = track.MainTrackObject }); 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 = track.MainTrackObject.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 = track.MainTrackObject } } } }); menu.AddSeparator(); if (!QuickDrive.IsActive()) { menu.AddItem("Open track in Quick Drive", () => QuickDrive.Show(track: track)); } menu.AddItem("Open track in Content tab", () => TracksListPage.Show(track), isEnabled: InternalUtils.IsAllRight) .AddItem(AppStrings.Toolbar_Folder, track.ViewInExplorer); }