protected virtual void SelectItem( TopPanelItem item )
        {
            foreach (TopPanelItem panelItem in Items)
                panelItem.IsSelected = false;

            item.IsSelected = true;
        }
Esempio n. 2
0
        private TopPanelItem AssignPluginButton(TopPanelWrapperItem item)
        {
            var button = new TopPanelItem()
            {
                DataContext = item
            };

            return(button);
        }
Esempio n. 3
0
        protected virtual void SelectItem(TopPanelItem item)
        {
            foreach (TopPanelItem panelItem in Items)
            {
                panelItem.IsSelected = false;
            }

            item.IsSelected = true;
        }
Esempio n. 4
0
        private TopPanelItem AssignPanelButton(string contentTemplate, ContextMenu menu, string tooltip, out TopPanelWrapperItem panelItem)
        {
            panelItem = new TopPanelWrapperItem(new SDK.Plugins.TopPanelItem {
                Title = ResourceProvider.GetString(tooltip)
            }, mainModel);
            var item = new TopPanelItem()
            {
                DataContext = panelItem
            };

            item.SetResourceReference(TopPanelItem.ContentTemplateProperty, contentTemplate);
            LeftClickContextMenuBehavior.SetEnabled(item, true);
            menu.SetResourceReference(ContextMenu.StyleProperty, "TopPanelMenu");
            item.ContextMenu = menu;
            return(item);
        }
Esempio n. 5
0
        private TopPanelItem AssignPanelButton(string contentTemplate, RelayCommand <object> command, string tooltip, out TopPanelWrapperItem panelItem)
        {
            panelItem = new TopPanelWrapperItem(new SDK.Plugins.TopPanelItem {
                Title = tooltip
            }, mainModel)
            {
                Command = command
            };

            var item = new TopPanelItem()
            {
                DataContext = panelItem
            };

            item.SetResourceReference(TopPanelItem.ContentTemplateProperty, contentTemplate);
            return(item);
        }
        public ScreenshotsVisualizer(IPlayniteAPI api) : base(api)
        {
            // Manual dll load
            try
            {
                string PluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string PathDLL    = Path.Combine(PluginPath, "VirtualizingWrapPanel.dll");
                if (File.Exists(PathDLL))
                {
                    var DLL = Assembly.LoadFile(PathDLL);
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, false, true, PluginDatabase.PluginName);
            }

            // Custom theme button
            EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(OnCustomThemeButtonClick));

            // Custom elements integration
            AddCustomElementSupport(new AddCustomElementSupportArgs
            {
                ElementList = new List <string> {
                    "PluginButton", "PluginSinglePicture", "PluginListScreenshots", "PluginListScreenshotsVertical", "PluginViewItem"
                },
                SourceName = PluginDatabase.PluginName
            });

            // Settings integration
            AddSettingsSupport(new AddSettingsSupportArgs
            {
                SourceName   = PluginDatabase.PluginName,
                SettingsRoot = $"{nameof(PluginSettings)}.{nameof(PluginSettings.Settings)}"
            });

            // Initialize top & side bar
            if (API.Instance.ApplicationInfo.Mode == ApplicationMode.Desktop)
            {
                topPanelItem = new TopPanelItem()
                {
                    Icon = new TextBlock
                    {
                        Text       = "\uea38",
                        FontSize   = 20,
                        FontFamily = resources.GetResource("CommonFont") as FontFamily
                    },
                    Title     = resources.GetString("LOCSsv"),
                    Activated = () =>
                    {
                        var windowOptions = new WindowOptions
                        {
                            ShowMinimizeButton = false,
                            ShowMaximizeButton = true,
                            ShowCloseButton    = true,
                            Width  = 1280,
                            Height = 740
                        };

                        var    ViewExtension   = new SsvScreenshotsManager();
                        Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCSsv"), ViewExtension, windowOptions);
                        windowExtension.ResizeMode = ResizeMode.CanResize;
                        windowExtension.ShowDialog();
                    },
                    Visible = PluginSettings.Settings.EnableIntegrationButtonHeader
                };

                ssvViewSidebar = new SsvViewSidebar(this);
            }
        }