コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }