Newer
Older
Correlator / Correlator / ViewModel / MenuViewModel.cs
using Correlator.UserControlPage;
using Correlator.Util;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;

namespace Correlator.ViewModel
{
    public class MenuViewModel : ViewModelBase
    {
        public RelayCommand GoAudioWindowCommand { get; set; }
        public RelayCommand GoPictureWindowCommand { get; set; }
        public RelayCommand CloseWindowCommand { get; set; }

        public MenuViewModel()
        {
            GoAudioWindowCommand = new RelayCommand(() =>
            {
                var audioFileUserControl = new AudioFileUserControl();
                UserControlManager.UserControlMap["audioFileUserControl"] = audioFileUserControl;
                Messenger.Default.Send("", MessengerToken.AddAudioFile);
            });

            GoPictureWindowCommand = new RelayCommand(() =>
            {
                var pictureFileUserControl = new PictureFileUserControl();
                UserControlManager.UserControlMap["pictureFileUserControl"] = pictureFileUserControl;
                Messenger.Default.Send("", MessengerToken.AddPictureFile);
            });

            CloseWindowCommand = new RelayCommand(() => { Messenger.Default.Send("", MessengerToken.RemoveMenu); });
        }
    }
}