public MainWindowViewModel()
        {
            _openStreamingcmd = new RelayCommand(OpenStreamingCmd, CanStreaming);
            _openMediacmd = new RelayCommand(OpenMediaCmd, CanOpenMedia);
            _quitcmd = new RelayCommand(QuitCmd, () => true);
            _aboutcmd = new RelayCommand(AboutCmd, CanAbout);
            _tipscmd = new RelayCommand(TipsCmd, CanTips);
            _konamiAcmd = new RelayCommand(KonamiCmd, () => true);
            _konamiBcmd = new RelayCommand(KonamiCmd, () => true);
            _konamiDowncmd = new RelayCommand(KonamiCmd, () => true);
            _konamiLeftcmd = new RelayCommand(KonamiCmd, () => true);
            _konamiRightcmd = new RelayCommand(KonamiCmd, () => true);
            _konamiUpcmd = new RelayCommand(KonamiCmd, () => true);

            PlaylistViewModel playlist = new PlaylistViewModel(this);
            MainViewModel mainView = new MainViewModel(this, playlist) { IsCurrentPage = true };

            _about = null;
            _tips = null;
            _stream = null;
            _k = new Konami();
            _page = new ViewModelBase[(int)PageEnum.COUNT_PAGE];
            _page[(int)PageEnum.MAIN] = mainView;
            _page[(int)PageEnum.PLAYLIST] = playlist;
            CurrentPageBase = _page[(int)PageEnum.MAIN];
        }
        public MainWindowViewModel()
        {
            _openStreamingcmd = new RelayCommand(OpenStreamingCmd, CanStreaming);
            _openMediacmd     = new RelayCommand(OpenMediaCmd, CanOpenMedia);
            _quitcmd          = new RelayCommand(QuitCmd, () => true);
            _aboutcmd         = new RelayCommand(AboutCmd, CanAbout);
            _tipscmd          = new RelayCommand(TipsCmd, CanTips);
            _konamiAcmd       = new RelayCommand(KonamiCmd, () => true);
            _konamiBcmd       = new RelayCommand(KonamiCmd, () => true);
            _konamiDowncmd    = new RelayCommand(KonamiCmd, () => true);
            _konamiLeftcmd    = new RelayCommand(KonamiCmd, () => true);
            _konamiRightcmd   = new RelayCommand(KonamiCmd, () => true);
            _konamiUpcmd      = new RelayCommand(KonamiCmd, () => true);

            PlaylistViewModel playlist = new PlaylistViewModel(this);
            MainViewModel     mainView = new MainViewModel(this, playlist)
            {
                IsCurrentPage = true
            };

            _about  = null;
            _tips   = null;
            _stream = null;
            _k      = new Konami();
            _page   = new ViewModelBase[(int)PageEnum.COUNT_PAGE];
            _page[(int)PageEnum.MAIN]     = mainView;
            _page[(int)PageEnum.PLAYLIST] = playlist;
            CurrentPageBase = _page[(int)PageEnum.MAIN];
        }
Exemple #3
0
        private void listView_Drop(object sender, DragEventArgs e)
        {
            PlaylistViewModel ctx = (PlaylistViewModel)DataContext;

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];

                foreach (string cur in files)
                {
                    ctx.AddFromDrop(cur);
                }
            }
        }
        public MainViewModel(MainWindowViewModel model, PlaylistViewModel playlist)
        {
            _nextcmd = new RelayCommand(NextCmd, CanNext);
            _previouscmd = new RelayCommand(PreviousCmd, CanPrevious);
            _playlistcmd = new RelayCommand(PlaylistCmd, () => true);
            _playcmd = new RelayCommand(PlayCmd, () => true);
            _repeatcmd = new RelayCommand(RepeatCmd, () => true);
            _randcmd = new RelayCommand(RandCmd, () => true);
            _stopcmd = new RelayCommand(StopCmd, () => true);
            _fullscreencmd = new RelayCommand(FullScreenCmd, CanFullScreen);
            _exitfullscreencmd = new RelayCommand(ExitFullScreenCmd, () => true);
            _changevolumecmd = new RelayCommand(ChangeVolumeCmd, () => true);
            _mediainfoscmd = new RelayCommand(MediaInfosCmd, CanMediaInfos);

            _typeFilter = WMP.Model.MediaFilter.TITLE;
            _playmediacmd = new RelayCommand(playMediaCmd, () => true);
            _addvideoscmd = new RelayCommand(addVideoCmd, () => true);
            _addsongscmd = new RelayCommand(addSongCmd, () => true);
            _addpicturescmd = new RelayCommand(addPictureCmd, () => true);
            _addsongtoplaylist = new RelayCommand(addSongToPlayList, () => true);
            _addvideotoplaylist = new RelayCommand(addVideoToPlayList, () => true);
            _addpicturetoplaylist = new RelayCommand(addPictureToPlayList, () => true);
            _deletevideocmd = new RelayCommand(deleteVideoCmd, () => true);
            _deletesongcmd = new RelayCommand(deleteSongCmd, () => true);
            _deletepicturecmd = new RelayCommand(deletePictureCmd, () => true);
            _clearvideos = new RelayCommand(clearVideos, () => true);
            _clearpictures = new RelayCommand(clearPictures, () => true);
            _clearsongs = new RelayCommand(clearSongs, () => true);
            _clearallcmd = new RelayCommand(clearAll, () => true);

            ListVideos = new ObservableCollection<VideoMedia>();
            ListSongs = new ObservableCollection<AudioMedia>();
            ListPictures = new ObservableCollection<PictureMedia>();

            _rand = 0;
            _playlist = playlist;
            _isRandEnabled = false;
            _repeatState = repeatStatus.NONE    ;
            _model = model;
            _media = null;
            _search = "";
            _mediaInfosOpen = false;
            _mediaInfos = new Window[(int)t_MediaType.NONE];
            _mediaInfos[(int)t_MediaType.AUDIO] = null;
            _mediaInfos[(int)t_MediaType.VIDEO] = null;
            _mediaInfos[(int)t_MediaType.PICTURE] = null;
            _mediaInfosFillers = new Action[(int)t_MediaType.NONE];
            _mediaInfosFillers[(int)t_MediaType.AUDIO] = new Action(FillAudioModel);
            _mediaInfosFillers[(int)t_MediaType.VIDEO] = new Action(FillVideoModel);
            _mediaInfosFillers[(int)t_MediaType.PICTURE] = new Action(FillPictureModel);
            _createMediaWindow = new Func<Window>[(int)t_MediaType.NONE];
            _createMediaWindow[(int)t_MediaType.AUDIO] = new Func<Window>(CreateAudioWindow);
            _createMediaWindow[(int)t_MediaType.VIDEO] = new Func<Window>(CreateVideoWindow);
            _createMediaWindow[(int)t_MediaType.PICTURE] = new Func<Window>(CreatePictureWindow);
            _infosModels = new ViewModelBase[(int)t_MediaType.NONE];
            _infosModels[(int)t_MediaType.AUDIO] = new AudioMediaViewModel();
            _infosModels[(int)t_MediaType.VIDEO] = new VideoMediaViewModel();
            _infosModels[(int)t_MediaType.PICTURE] = new PictureMediaViewModel();
            _fullScreen = false;
            _rnd = new Random();
            _progress = new Timer(200);
            _progress.Elapsed += ProgressElapsed;
            _player = new MediaElement();
            _player.LoadedBehavior = MediaState.Manual;
            _player.MediaOpened += MediaLoaded;
            _player.MediaEnded += OnMediaEnded;
            _player.MediaFailed += OnMediaFailed;

            loadPicturesLibrary();
            loadSongsLibrary();
            loadVideosLibrary();
        }
Exemple #5
0
        private void Image_Drop(object sender, DragEventArgs e)
        {
            PlaylistViewModel ctx = (PlaylistViewModel)DataContext;

            ctx.DeleteCmd();
        }
Exemple #6
0
        public MainViewModel(MainWindowViewModel model, PlaylistViewModel playlist)
        {
            _nextcmd           = new RelayCommand(NextCmd, CanNext);
            _previouscmd       = new RelayCommand(PreviousCmd, CanPrevious);
            _playlistcmd       = new RelayCommand(PlaylistCmd, () => true);
            _playcmd           = new RelayCommand(PlayCmd, () => true);
            _repeatcmd         = new RelayCommand(RepeatCmd, () => true);
            _randcmd           = new RelayCommand(RandCmd, () => true);
            _stopcmd           = new RelayCommand(StopCmd, () => true);
            _fullscreencmd     = new RelayCommand(FullScreenCmd, CanFullScreen);
            _exitfullscreencmd = new RelayCommand(ExitFullScreenCmd, () => true);
            _changevolumecmd   = new RelayCommand(ChangeVolumeCmd, () => true);
            _mediainfoscmd     = new RelayCommand(MediaInfosCmd, CanMediaInfos);

            _typeFilter           = WMP.Model.MediaFilter.TITLE;
            _playmediacmd         = new RelayCommand(playMediaCmd, () => true);
            _addvideoscmd         = new RelayCommand(addVideoCmd, () => true);
            _addsongscmd          = new RelayCommand(addSongCmd, () => true);
            _addpicturescmd       = new RelayCommand(addPictureCmd, () => true);
            _addsongtoplaylist    = new RelayCommand(addSongToPlayList, () => true);
            _addvideotoplaylist   = new RelayCommand(addVideoToPlayList, () => true);
            _addpicturetoplaylist = new RelayCommand(addPictureToPlayList, () => true);
            _deletevideocmd       = new RelayCommand(deleteVideoCmd, () => true);
            _deletesongcmd        = new RelayCommand(deleteSongCmd, () => true);
            _deletepicturecmd     = new RelayCommand(deletePictureCmd, () => true);
            _clearvideos          = new RelayCommand(clearVideos, () => true);
            _clearpictures        = new RelayCommand(clearPictures, () => true);
            _clearsongs           = new RelayCommand(clearSongs, () => true);
            _clearallcmd          = new RelayCommand(clearAll, () => true);

            ListVideos   = new ObservableCollection <VideoMedia>();
            ListSongs    = new ObservableCollection <AudioMedia>();
            ListPictures = new ObservableCollection <PictureMedia>();

            _rand           = 0;
            _playlist       = playlist;
            _isRandEnabled  = false;
            _repeatState    = repeatStatus.NONE;
            _model          = model;
            _media          = null;
            _search         = "";
            _mediaInfosOpen = false;
            _mediaInfos     = new Window[(int)t_MediaType.NONE];
            _mediaInfos[(int)t_MediaType.AUDIO]   = null;
            _mediaInfos[(int)t_MediaType.VIDEO]   = null;
            _mediaInfos[(int)t_MediaType.PICTURE] = null;
            _mediaInfosFillers = new Action[(int)t_MediaType.NONE];
            _mediaInfosFillers[(int)t_MediaType.AUDIO]   = new Action(FillAudioModel);
            _mediaInfosFillers[(int)t_MediaType.VIDEO]   = new Action(FillVideoModel);
            _mediaInfosFillers[(int)t_MediaType.PICTURE] = new Action(FillPictureModel);
            _createMediaWindow = new Func <Window> [(int)t_MediaType.NONE];
            _createMediaWindow[(int)t_MediaType.AUDIO]   = new Func <Window>(CreateAudioWindow);
            _createMediaWindow[(int)t_MediaType.VIDEO]   = new Func <Window>(CreateVideoWindow);
            _createMediaWindow[(int)t_MediaType.PICTURE] = new Func <Window>(CreatePictureWindow);
            _infosModels = new ViewModelBase[(int)t_MediaType.NONE];
            _infosModels[(int)t_MediaType.AUDIO]   = new AudioMediaViewModel();
            _infosModels[(int)t_MediaType.VIDEO]   = new VideoMediaViewModel();
            _infosModels[(int)t_MediaType.PICTURE] = new PictureMediaViewModel();
            _fullScreen            = false;
            _rnd                   = new Random();
            _progress              = new Timer(200);
            _progress.Elapsed     += ProgressElapsed;
            _player                = new MediaElement();
            _player.LoadedBehavior = MediaState.Manual;
            _player.MediaOpened   += MediaLoaded;
            _player.MediaEnded    += OnMediaEnded;
            _player.MediaFailed   += OnMediaFailed;

            loadPicturesLibrary();
            loadSongsLibrary();
            loadVideosLibrary();
        }