Left TODO for implementing the Repeat table. #35
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
using SQLite;
|
||||
|
||||
namespace Mear.Models
|
||||
{
|
||||
[DataContract]
|
||||
[Table("MusicControls")]
|
||||
public class MusicControls
|
||||
{
|
||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
public bool ShuffleOn { get; set; } = false;
|
||||
public bool RepeatOn { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Mear.Models;
|
||||
|
||||
namespace Mear.Repositories.Database
|
||||
{
|
||||
// TODO: Implement the database functionality #35
|
||||
public class DBMusicControls : DBRepository
|
||||
{
|
||||
#region Fields
|
||||
#endregion
|
||||
|
||||
|
||||
#region Properties
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
public DBMusicControls()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
public bool IsShuffleOn()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DoesTableExist("MusicControls"))
|
||||
{
|
||||
bool? shuffle = _Db.Table<MusicControls>().First().ShuffleOn;
|
||||
|
||||
if (shuffle != null)
|
||||
{
|
||||
return shuffle.Value; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = ex.Message;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool IsRepeatOn()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DoesTableExist("MusicControls"))
|
||||
{
|
||||
bool? repeat = _Db.Table<MusicControls>().First().RepeatOn;
|
||||
|
||||
if (repeat != null)
|
||||
{
|
||||
return repeat.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = ex.Message;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user