using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MiniBar2k.Common;

namespace MiniBar2k.PPC
{
    public partial class MainForm : Form
    {
        private FoobarController fbc;
        private FoobarUI fbui;

        public MainForm()
        {
            InitializeComponent();

            fbc = new FoobarController();
            fbui = new FoobarUI(fbc, dataGrid1, MainMenu, GridMenu, lblTitle, btnStop, btnPause, btnPlay, btnPrev, btnNext, btnRand, btnHome, btnAlbum, btnSearch, pnlStatus);
            fbui.OnAbout += OnAbout;
            fbui.OnSettings += OnSettings;
            fbui.OnSearch += OnSearch;
        }

        public void OnAbout(object sender)
        {
            AboutForm form = new AboutForm();
            form.ShowDialog();
        }

        public void OnSettings(object sender)
        {
            SettingsForm form = new SettingsForm();
            form.ShowDialog();
        }

        public void OnSearch(object sender)
        {
            SearchForm form = new SearchForm();
            fbui.Search(form, form.tbSearch, form.btnSearch, form.lbSearch, form.btnDisplay, form.SearchMenu);
            form.ShowDialog();
        }

        private void Form1_Closing(object sender, CancelEventArgs e)
        {
            fbc.Disconnect();
        }
    }
}