示例#1
0
 public static void UpdateButtonSpacing(ButtonSpaces btn)
 {
     if (btn != null)
     {
         DLLocalDatabase.ButtonSpacing.UpdateButtonSpacing(btn);
     }
 }
示例#2
0
            /// <summary>
            /// Gets the amount of button spaces for 1 button, right now that's the same for all, but maybe that could change in the future
            /// </summary>
            /// <returns></returns>
            public static int GetButtonSpacing()
            {
                int spacing = -1;

                using (RemindMeDbEntities db = new RemindMeDbEntities())
                {
                    int count = db.ButtonSpaces.Where(o => o.Id >= 0).Count();
                    if (count == 0)
                    {
                        ButtonSpaces spaceObj = new ButtonSpaces();
                        spaceObj.Id        = 0;
                        spaceObj.Reminders = 5;
                        //spaceObj.MessageCenter = 5;
                        //more buttons possibly

                        spacing = 5;

                        db.ButtonSpaces.Add(spaceObj);
                        db.SaveChanges();
                    }
                    else
                    {
                        spacing = Convert.ToInt32((from b in db.ButtonSpaces select b.Reminders).SingleOrDefault());
                    }



                    db.Dispose();
                }

                return(spacing);
            }
示例#3
0
        private void btnPlus_Click(object sender, EventArgs e)
        {          
            foreach (Control b in Form1.Instance.pnlSide.Controls)            
                if (b is Bunifu.Framework.UI.BunifuFlatButton && SpacesInFront((Bunifu.Framework.UI.BunifuFlatButton)b) < 15)                
                    b.Text = " " + b.Text;
                                              
            ButtonSpaces btn = new ButtonSpaces();
            btn.Id = 0;
            btn.Reminders = SpacesInFront(Form1.Instance.btnReminders);

            BLLocalDatabase.ButtonSpacing.UpdateButtonSpacing(btn);
        }
示例#4
0
        private void btnMin_Click(object sender, EventArgs e)
        {            
            foreach (Control b in Form1.Instance.pnlSide.Controls)            
                if (b is Bunifu.Framework.UI.BunifuFlatButton && b.Text[0] == ' ')                
                    b.Text = b.Text.Substring(1, b.Text.Length - 1);                
                          
            
            ButtonSpaces btn = new ButtonSpaces();
            btn.Id = 0;
            btn.Reminders = SpacesInFront(Form1.Instance.btnReminders);

            BLLocalDatabase.ButtonSpacing.UpdateButtonSpacing(btn);
        }
示例#5
0
 public static void UpdateButtonSpacing(ButtonSpaces btn)
 {
     using (RemindMeDbEntities db = new RemindMeDbEntities())
     {
         var count = db.ButtonSpaces.Where(o => o.Id >= 0).Count();
         if (count == 1)
         {
             db.ButtonSpaces.Attach(btn);
             var entry = db.Entry(btn);
             entry.State = System.Data.Entity.EntityState.Modified; //Mark it for update
             db.SaveChanges();                                      //push to database
             db.Dispose();
         }
         else
         {//The settings table is still empty
             db.ButtonSpaces.Add(btn);
             db.SaveChanges();
             db.Dispose();
         }
     }
 }