public ViewModel()
        {
            TaskIsDone = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1 && Index < ToDo.Count && !Done.Contains<String>(ToDo.ElementAt(Index)))
                    {
                        Done.Add(ToDo.ElementAt(Index));
                        ToDo.RemoveAt(Index);
                    }
                }
            };

            NewTask = new ActionCommand()
            {
                Action = () =>
                {
                    if (TaskText != "" && TaskText != null && !ToDo.Contains<String>(TaskText))
                    {
                        Task t = new Task(Id, TaskText);
                        ToDo.Add(t.Content);
                        Id += 1;
                    }
                }
            };

            TaskIsToDo = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1 && Index < Done.Count && !ToDo.Contains<String>(Done.ElementAt(Index)))
                    {
                        ToDo.Add(Done.ElementAt(Index));
                        Done.RemoveAt(Index);
                    }
                }
            };

            _task = new List<string>();
            _done = new ObservableCollection<string>();
            _todo = new ObservableCollection<string>();

            Initialze();
        }
Example #2
0
        public MediaViewModel()
        {
            AddItemToPlaylist = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1 && Index < Media.Count && !Playlist.Contains<IMedia>(Media.ElementAt(Index)))
                        Playlist.Add(Media.ElementAt(Index));
                }
            };

            DelItemFromPlaylist = new ActionCommand()
            {
                Action = () =>
                    {
                        if (Index > -1 && Index < Playlist.Count)
                        {
                            Playlist.RemoveAt(Index);
                        }
                    }
            };

            PlayCommand = new ActionCommand()
            {
                Action = () =>
                {
                    _curSongIndex = Index;
                    if (Index > -1 && Index < Media.Count)
                    {
                        _curSongIndex = Index;
                        MediaFilePath = Media.ElementAt(Index).FileName;
                        if (Play != null)
                            Play.Invoke(this, EventArgs.Empty);
                    }
                }
            };

            NextSong = new ActionCommand()
            {
                Action = () =>
                    {
                        if (_curSongIndex > -1 && _curSongIndex < Playlist.Count)
                        {
                            _curSongIndex += 1;
                            Index = _curSongIndex;
                            PlayCommand.Action();
                        }
                        else
                            _curSongIndex = -1;
                        
                    }
            };

            StopCommand = new ActionCommand()
            {
                Action = () =>
                {
                    if (MediaFilePath != null)
                    {
                        if (Stop != null)
                            Stop.Invoke(this, EventArgs.Empty);
                        MediaFilePath = null;
                    }
                }
            };

            PauseCommand = new ActionCommand()
            {
                Action = () =>
                {
                    if (Pause != null)
                        Pause.Invoke(this, EventArgs.Empty);
                }
            };

            m_media = new ObservableCollection<IMedia>();
            Initialize();
        }
Example #3
0
        public MediaViewModel()
        {
            PlayCommand = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1)
                    {
                        MediaFilePath = MediaMgr.VideoMedias.ElementAt(Index).FileName;
                        if (Play != null)
                            Play.Invoke(this, EventArgs.Empty);
                    }
                }
            };

            PauseCommand = new ActionCommand()
            {
                Action = () =>
                {
                    if (Pause != null)
                        Pause.Invoke(this, EventArgs.Empty);
                }
            };

            m_video = new List<string>();

            Initialze();
        }