Example #1
0
        public MW_ViewModel(PlaylistViewModel avm,LibraryViewModel lvm, MainWindow mw)
        {
            _backupVolume = 0;
            Volume = DEFAULT_VOLUME;
            Mute = false;
            _avm = avm;
            _lvm = lvm;
            _mw = mw;

            ClickHandlers = new Dictionary<ButtonType, EventHandler<ActionClickArgs> >();
            ButtonClicks = new Dictionary<ButtonType, ICommand>()
            {
                { ButtonType.Play, new ButtonClick(new Action(btnPlay_Action)) },
                { ButtonType.Pause, new ButtonClick(new Action(btnPause_Action)) },
                { ButtonType.Next, new ButtonClick(new Action(btnNext_Action)) },
                { ButtonType.Prev, new ButtonClick(new Action(btnPrev_Action)) },
                { ButtonType.Stop, new ButtonClick(new Action(btnStop_Action)) },
                { ButtonType.Open, new ButtonClick(new Action(btnOpen_Action)) },
                { ButtonType.Export, new ButtonClick(new Action(btnExport_Action)) },
                { ButtonType.Import, new ButtonClick(new Action(btnImport_Action)) },
                { ButtonType.Clean, new ButtonClick(new Action(btnClean_Action)) },
                { ButtonType.ImportFolder, new ButtonClick(new Action(btnImportFolder_Action)) },
                { ButtonType.Volume, new ButtonClick(new Action(btnVolume_Action)) }
            };
            IsPlaying = false;
        }
Example #2
0
        public MainWindow()
        {
            PlaylistViewModel avm = new PlaylistViewModel();
            LibraryViewModel lvm = new LibraryViewModel();
            MW_ViewModel	vm = new MW_ViewModel(avm, lvm, this);
            this.DataContext = vm;

            vm.ClickHandlers.Add(ButtonType.Play, action_Play);
            vm.ClickHandlers.Add(ButtonType.Pause, action_Pause);
            vm.ClickHandlers.Add(ButtonType.Stop, action_Stop);
            vm.OpenHandler += action_Open;
            vm.SetMediaHandler += setMediaElement;

            _mouseIsDown = false;
            SeekerIsEnabled = false;
            SeekerMax = 1;

            InitializeComponent();

            _seekerTimer = new DispatcherTimer();
            _seekerTimer.Interval = TimeSpan.FromMilliseconds(200);
            _seekerTimer.Tick += SeekerTick;

            PlaylistGrid.DataContext = avm;
            Library_tab.DataContext = lvm;
        }