/// <summary> /// Change this user controls's icons based on the theme /// </summary> /// <param name="theme"></param> public void UpdateTheme(object sender) { if (this.Reminder == null) { btnDelete.Image = Properties.Resources.Bin_Disabled; btnEdit.Image = Properties.Resources.Edit_Disabled; btnSettings.Image = Properties.Resources.gearDisabled; btnDisable.Image = Properties.Resources.turnedOffTwo; } else if (MaterialSkin.MaterialSkinManager.Instance.Theme == MaterialSkin.MaterialSkinManager.Themes.DARK) { btnEdit.Image = Properties.Resources.EditPenWhite; btnDelete.Image = Properties.Resources.Bin_white; btnDisable.Image = Properties.Resources.disableWhite; btnSettings.Image = Properties.Resources.gearWhite; //toolstrip previewToolStripMenuItem.Image = Properties.Resources.eyeWhite; duplicateToolStripMenuItem.Image = Properties.Resources.duplicateWhite; hideReminderToolStripMenuItem.Image = Properties.Resources.hideWhite; postponeToolStripMenuItem.Image = Properties.Resources.zzzWhite; removePostponeToolStripMenuItem.Image = Properties.Resources.zzzCancelWhite; skipToNextDateToolStripMenuItem.Image = Properties.Resources.skipWhite; toolStripMenuItem1.Image = Properties.Resources.permanentelyWhite; //permanentelydelete toolstrip pbConditionalReminder.Image = Properties.Resources.wwwLight; } else if (MaterialSkin.MaterialSkinManager.Instance.Theme == MaterialSkin.MaterialSkinManager.Themes.LIGHT) {//Light btnEdit.Image = Properties.Resources.editPenDark; btnDelete.Image = Properties.Resources.binDark; btnDisable.Image = Properties.Resources.disableDark; btnSettings.Image = Properties.Resources.gearDark; //toolstrip previewToolStripMenuItem.Image = Properties.Resources.eyeDark; duplicateToolStripMenuItem.Image = Properties.Resources.duplicateDark; hideReminderToolStripMenuItem.Image = Properties.Resources.hideDark; postponeToolStripMenuItem.Image = Properties.Resources.zzzDark; removePostponeToolStripMenuItem.Image = Properties.Resources.zzzCancelDark; skipToNextDateToolStripMenuItem.Image = Properties.Resources.skipForwardDark; toolStripMenuItem1.Image = Properties.Resources.permanentelyDark; pbConditionalReminder.Image = Properties.Resources.wwwDark; } BLFormLogic.SetImageAlpha(pbConditionalReminder, 50); if (this.Reminder != null && this.Reminder.Enabled == 0) { btnDisable.Image = Properties.Resources.turnedOffTwo; lblReminderName.Visible = false; lblReminderNameDisabled.Visible = true; lblDate.FontType = MaterialSkin.MaterialSkinManager.fontType.Body2; lblRepeat.FontType = MaterialSkin.MaterialSkinManager.fontType.Body2; } }
//Loads reminder data into the controls private void Enable() { MaterialSkin.MaterialSkinManager.Themes theme = MaterialSkin.MaterialSkinManager.Instance.Theme; lblReminderName.Visible = true; lblReminderNameDisabled.Visible = false; lblRepeat.FontType = MaterialSkin.MaterialSkinManager.fontType.Subtitle2; lblDate.FontType = MaterialSkin.MaterialSkinManager.fontType.Subtitle2; //Enabled icons if (theme == MaterialSkin.MaterialSkinManager.Themes.DARK) { btnDelete.Image = Properties.Resources.Bin_white; btnEdit.Image = Properties.Resources.EditPenWhite; btnSettings.Image = Properties.Resources.gearWhite; btnDisable.Image = Properties.Resources.disableWhite; pbConditionalReminder.Image = Properties.Resources.wwwLight; } else { btnDelete.Image = Properties.Resources.binDark; btnEdit.Image = Properties.Resources.editPenDark; btnSettings.Image = Properties.Resources.gearDark; btnDisable.Image = Properties.Resources.disableDark; pbConditionalReminder.Image = Properties.Resources.wwwDark; } BLFormLogic.SetImageAlpha(pbConditionalReminder, 50); //if the reminder is disabled, use this icon instead if (rem.Enabled == 0) { btnDisable.Image = Properties.Resources.turnedOffTwo; lblReminderName.Visible = false; lblReminderNameDisabled.Visible = true; lblDate.FontType = MaterialSkin.MaterialSkinManager.fontType.Body2; lblRepeat.FontType = MaterialSkin.MaterialSkinManager.fontType.Body2; } //Reset location pbRepeat.Location = new Point(168, pbRepeat.Location.Y); lblRepeat.Location = new Point(195, lblRepeat.Location.Y); if (rem.HttpId == null) { pbConditionalReminder.Visible = false; DateTime date = Convert.ToDateTime(rem.Date.Split(',')[0]); if (date.ToShortDateString() == DateTime.Now.ToShortDateString()) { lblDate.Text = "Today " + date.ToShortTimeString(); } else { lblDate.Text = date.ToShortDateString() + " " + date.ToShortTimeString(); } //Postpone logic if (rem.PostponeDate != null && !string.IsNullOrWhiteSpace(rem.PostponeDate)) { pbDate.BackgroundImage = Properties.Resources.RemindMeZzz; Font font = new Font(lblRepeat.Font, FontStyle.Bold | FontStyle.Italic); lblDate.Font = font; if (Convert.ToDateTime(rem.PostponeDate).ToShortDateString() == DateTime.Now.ToShortDateString()) { lblDate.Text = "Today " + Convert.ToDateTime(rem.PostponeDate).ToShortTimeString(); } else { lblDate.Text = Convert.ToDateTime(rem.PostponeDate).ToShortDateString() + " " + Convert.ToDateTime(rem.PostponeDate).ToShortTimeString(); } } else { pbDate.BackgroundImage = Properties.Resources.RemindMe; Font font = new Font(lblRepeat.Font, FontStyle.Bold); lblDate.Font = font; } } else { pbConditionalReminder.Visible = true; lblDate.Text = "Conditional"; pbDate.BackgroundImage = Properties.Resources.RemindMe; } AdvancedReminderProperties props = BLLocalDatabase.AVRProperty.GetAVRProperties(rem.Id); if (props != null && !string.IsNullOrWhiteSpace(props.BatchScript)) { pbDate.BackgroundImage = Properties.Resources.terminal1; } //If some country has a longer date string, move the repeat icon/text more to the right so it doesnt overlap while (lblDate.Bounds.IntersectsWith(pbRepeat.Bounds)) { pbRepeat.Location = new Point(pbRepeat.Location.X + 5, pbRepeat.Location.Y); lblRepeat.Location = new Point(lblRepeat.Location.X + 5, lblRepeat.Location.Y); } lblReminderName.Text = rem.Name; lblRepeat.Text = BLReminder.GetRepeatTypeText(rem); SetTooltips(); /*if (rem.Enabled == 1) * { * btnDisable.Image = Properties.Resources.turnedOn; * lblReminderName.ForeColor = Color.White; * lblDate.ForeColor = Color.White; * lblRepeat.ForeColor = Color.White; * } * else * { * //Disabled reminder, make text gray * * lblReminderName.ForeColor = Color.Silver; * lblDate.ForeColor = Color.Silver; * lblRepeat.ForeColor = Color.Silver; * }*/ btnSettings.Enabled = true; btnDelete.Enabled = true; btnEdit.Enabled = true; btnDisable.Enabled = true; }