aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
blob: 4e200ada66585dd58222f72c775e6c47e4a01c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.PPC.Common;
using Tango.PPC.Common.Modules;
using Tango.PPC.UI.ViewsContracts;
using Tango.SharedUI;

namespace Tango.PPC.UI.ViewModels
{
    /// <summary>
    /// Represents the layout view containing the main menu and all modules.
    /// </summary>
    /// <seealso cref="Tango.PPC.Common.PPCViewModel{Tango.PPC.UI.ViewsContracts.ILayoutView}" />
    public class LayoutViewVM : PPCViewModel<ILayoutView>
    {
        /// <summary>
        /// Gets or sets the module loader.
        /// </summary>
        [TangoInject]
        public IPPCModuleLoader ModuleLoader { get; set; }

        /// <summary>
        /// Called when the application has been started.
        /// </summary>
        public override void OnApplicationStarted()
        {
            base.OnApplicationStarted();
            ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded;
        }

        /// <summary>
        /// Handles the ModulesLoaded event of the ModuleLoader.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ModuleLoader_ModulesLoaded(object sender, EventArgs e)
        {
            View.ApplyModules(ModuleLoader.UserModules);
        }

        /// <summary>
        /// Called when the instance of IPPCView is available.
        /// </summary>
        public override void OnViewAttached()
        {
            
        }
    }
}