示例#1
0
        public void InitializeCommandsTest()
        {
            var database    = new GameDatabase();
            var controllers = new GameControllerFactory();
            var model       = new DesktopAppViewModel(
                database,
                null,
                null,
                null,
                new PlayniteSettings(),
                new DesktopGamesEditor(
                    new GameDatabase(),
                    controllers,
                    new PlayniteSettings(),
                    null,
                    null,
                    null),
                null,
                new ExtensionFactory(database, controllers),
                null);

            var props = typeof(DesktopAppViewModel).GetProperties();

            foreach (var prop in props)
            {
                if (prop.Name.EndsWith("Command"))
                {
                    var cmd = prop.GetValue(model, null);
                    if (cmd == null)
                    {
                        Assert.Fail($"{prop.Name} is not defined.");
                    }
                }
            }
        }
示例#2
0
 public MainMenu(DesktopAppViewModel model)
 {
     if (model != null)
     {
         mainModel = model;
         InitializeItems();
     }
 }
示例#3
0
 public SoftwareToolSidebarItem(AppSoftware app, DesktopAppViewModel model)
 {
     this.app   = app;
     this.model = model;
     Type       = SiderbarItemType.Button;
     Icon       = app.Icon;
     Title      = app.Name;
     Activated  = () => model.StartSoftwareToolCommand.Execute(app);
 }
示例#4
0
 public GameGroupMenu(PlayniteSettings settings, DesktopAppViewModel mainModel)
 {
     this.settings      = settings;
     this.mainModel     = mainModel;
     CollapseCommand    = new RelayCommand <object>((a) => Collapse());
     CollapseAllCommand = new RelayCommand <object>((a) => CollapseAll());
     ExpandCommand      = new RelayCommand <object>((a) => Expand());
     ExpandAllCommand   = new RelayCommand <object>((a) => ExpandAll());
     Opened            += GameGroupMenu_Opened;
 }
示例#5
0
 public ExplorerPanel(DesktopAppViewModel mainModel)
 {
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         this.mainModel = new DesignMainViewModel();
     }
     else if (mainModel != null)
     {
         this.mainModel = mainModel;
     }
 }
示例#6
0
 public GameListItem(DesktopAppViewModel mainModel)
 {
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         this.mainModel = new DesignMainViewModel();
     }
     else if (mainModel != null)
     {
         this.mainModel = mainModel;
     }
 }
示例#7
0
 public FilterPanel(DesktopAppViewModel mainModel)
 {
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         this.mainModel = DesignMainViewModel.DesignIntance;
     }
     else if (mainModel != null)
     {
         this.mainModel = mainModel;
     }
 }
示例#8
0
 public MainMenu(DesktopAppViewModel model)
 {
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         mainModel = DesignMainViewModel.DesignIntance;
     }
     else if (model != null)
     {
         mainModel = model;
         InitializeItems();
     }
 }
示例#9
0
        public LibraryListView(DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            this.mainModel.AppSettings.ViewSettings.PropertyChanged += ViewSettings_PropertyChanged;
        }
示例#10
0
        public Library(DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = new DesignMainViewModel();
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            mainModel.AppSettings.PropertyChanged += AppSettings_PropertyChanged;
        }
示例#11
0
        public Sidebar(DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            DataContext = this.mainModel;
        }
示例#12
0
        public MainWindow(DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = new DesignMainViewModel();
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            DataContext = this.mainModel;
        }
示例#13
0
        public GameMenu(DesktopAppViewModel model)
        {
            if (model == null)
            {
                return;
            }

            this.model          = model;
            resources           = new ResourceProvider();
            Opened             += GameMenu_Opened;
            Closed             += GameMenu_Closed;
            DataContextChanged += GameMenu_DataContextChanged;
        }
示例#14
0
        public GameMenu(DesktopAppViewModel model)
        {
            if (model == null)
            {
                return;
            }

            context             = SynchronizationContext.Current;
            this.model          = model;
            resources           = new ResourceProvider();
            Opened             += GameMenu_Opened;
            DataContextChanged += GameMenu_DataContextChanged;
            InitializeItems();
        }
示例#15
0
        public TopPanel(DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            Loaded   += TopPanel_Loaded;
            Unloaded += TopPanel_Unloaded;
        }
示例#16
0
        public BaseGamesView(ViewType viewType, DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = new DesignMainViewModel();
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            this.viewType = viewType;
            mainModel.AppSettings.ViewSettings.PropertyChanged += ViewSettings_PropertyChanged;
        }
示例#17
0
        public FilterPresetsMenu(DesktopAppViewModel model)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                mainModel = DesignMainViewModel.DesignIntance;
            }
            else if (model != null)
            {
                mainModel = model;
                Opened   += FilterPresetsMenu_Opened;
            }

            Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
            StaysOpen = false;
        }
示例#18
0
        public BaseGamesView(ViewType viewType, DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            this.viewType = viewType;
            Loaded       += BaseGamesView_Loaded;
            Unloaded     += BaseGamesView_Unloaded;
        }
示例#19
0
        public GameOverview(ViewType viewType, DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
                DataContext    = this.mainModel.SelectedGameDetails;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            this.viewType = viewType;
            this.mainModel.AppSettings.PropertyChanged += AppSettings_PropertyChanged;
            this.mainModel.AppSettings.ViewSettings.PropertyChanged += ViewSettings_PropertyChanged;
        }
示例#20
0
        public MainSidebarViewItem(Control view, DesktopAppViewModel model, ApplicationView appView)
        {
            this.view    = view;
            this.AppView = appView;
            this.model   = model;
            Type         = SiderbarItemType.View;
            Opened       = () =>
            {
                if (AppView == ApplicationView.Statistics)
                {
                    model.LibraryStats.Calculate();
                }

                return(view);
            };
        }
示例#21
0
        public GameOverview(ViewType viewType, DesktopAppViewModel mainModel)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.mainModel = DesignMainViewModel.DesignIntance;
                DataContext    = this.mainModel.SelectedGameDetails;
            }
            else if (mainModel != null)
            {
                this.mainModel = mainModel;
            }

            this.viewType = viewType;
            Loaded       += GameOverview_Loaded;
            Unloaded     += GameOverview_Unloaded;
        }
示例#22
0
 public LibraryGridView(DesktopAppViewModel mainModel) : base(ViewType.Grid, mainModel)
 {
     Loaded   += LibraryGridView_Loaded;
     Unloaded += LibraryGridView_Unloaded;
 }
示例#23
0
 public TrayContextMenu(DesktopAppViewModel model)
 {
     mainModel = model;
     mainModel.GamesEditor.PropertyChanged += GamesEditor_PropertyChanged;
     InitializeItems();
 }
示例#24
0
 public LibraryDetailsView(DesktopAppViewModel mainModel) : base(ViewType.Details, mainModel)
 {
 }
示例#25
0
 public LibraryGridView(DesktopAppViewModel mainModel) : base(ViewType.Grid, mainModel)
 {
 }
示例#26
0
 public MainViewAPI(DesktopAppViewModel mainModel)
 {
     this.mainModel = mainModel;
 }
示例#27
0
 public DetailsViewGameOverview(DesktopAppViewModel mainModel) : base(ViewType.Details, mainModel)
 {
 }
示例#28
0
 public GridViewGameOverview(DesktopAppViewModel mainModel) : base(ViewType.Grid, mainModel)
 {
 }
示例#29
0
 public TrayContextMenu(DesktopAppViewModel model)
 {
     mainModel = model;
     Opened   += TrayContextMenu_Opened;
 }