diff --git a/Mear/Mear/Models/MusicControls.cs b/Mear/Mear/Models/MusicControls.cs new file mode 100644 index 0000000..8c671c1 --- /dev/null +++ b/Mear/Mear/Models/MusicControls.cs @@ -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; + } +} diff --git a/Mear/Mear/Repositories/Database/DBMusicControls.cs b/Mear/Mear/Repositories/Database/DBMusicControls.cs new file mode 100644 index 0000000..9b41b6c --- /dev/null +++ b/Mear/Mear/Repositories/Database/DBMusicControls.cs @@ -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().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().First().RepeatOn; + + if (repeat != null) + { + return repeat.Value; + } + } + } + catch (Exception ex) + { + var msg = ex.Message; + } + + return false; + } + #endregion + } +}