Left TODO for implementing the Repeat table. #35

This commit is contained in:
amazing-username
2019-06-05 16:09:00 -07:00
parent 11aca0668f
commit d1d3894732
2 changed files with 92 additions and 0 deletions
+19
View File
@@ -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
}
}