﻿using BriskApp.Common.Plate;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;

namespace Dite.Pages.AddNewHandler
{
    [ControllerView(typeof(AddNewHandlerView))]
    [ControllerConfig(typeof(AddNewHandlerConfig))]
    public class AddNewHandlerController : ModuleControllerBase
    {
        private readonly INavigationService _navigationService;
        private readonly AddNewHandlerViewModel _viewModel;

        public AddNewHandlerController(IComponentFactory factory, AddNewHandlerViewModel viewModel, INavigationService navigationService)
            :base(factory)
        {
            _viewModel = viewModel;
            _navigationService = navigationService;
        }

        public override void LoadAsync(object parameter)
        {
            Debug.WriteLine("-- AddNewHandlerController LoadAsync");
            SetContext(_viewModel);
            _navigationService.RegisterContent(this, _viewModel);
            _viewModel.LoadAsync(parameter);
        }

        public override void UnloadAsync()
        {
            _viewModel.Dispose();
        }
    }

    internal class AddNewHandlerConfig : IModuleControllerConfig
    {
        public Color BackgroundColor => Colors.DarkSlateBlue;
    }
}
