public void Load(StorageDirectory colorListFolder)
        {
            Items.Clear();

            if (!colorListFolder.ExistsLocal())
            {
                return;
            }

            foreach (var folder in colorListFolder.GetLocalFolders())
            {
                var files = folder.GetLocalFiles().ToList();

                var colorFolder = new ColorFolder();
                colorFolder.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(folder.Name);

                var imageFile = files.FirstOrDefault(file => file.Name == "image.png");
                if (imageFile != null)
                {
                    colorFolder.Logo = new Bitmap(imageFile.LocalPath);
                }

                var schemaFile = files.FirstOrDefault(file => file.Name == "color_scheme.txt");
                colorFolder.Schema = schemaFile != null?
                                     ColorSchema.Parse(File.ReadAllText(schemaFile.LocalPath)) :
                                         new ColorSchema();


                Items.Add(colorFolder);
            }
        }
Example #2
0
		public void RefreshData(ColorSchema colorSchema)
		{
			foreach (var week in _weekControls)
				week.RefreshData(colorSchema);

			pnMonday.BackColor =
				pnTuesday.BackColor =
					pnWednesday.BackColor =
						pnThursday.BackColor =
							pnFriday.BackColor =
								pnSaturday.BackColor =
									pnSunday.BackColor = colorSchema.LineColor;
			laMonday.BackColor =
				laTuesday.BackColor =
					laWednesday.BackColor =
						laThursday.BackColor =
							laFriday.BackColor =
								laSaturday.BackColor =
									laSunday.BackColor = colorSchema.HeaderBackColor;
			laMonday.ForeColor =
				laTuesday.ForeColor =
					laWednesday.ForeColor =
						laThursday.ForeColor =
							laFriday.ForeColor =
								laSaturday.ForeColor =
									laSunday.ForeColor = colorSchema.HeaderForeColor;
		}
Example #3
0
		public static ColorSchema Parse(string content)
		{
			var result = new ColorSchema();
			var headerName = String.Empty;
			foreach (var line in content.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
			{
				if (String.IsNullOrEmpty(line)) continue;
				if (line.StartsWith("*"))
					headerName = line.Substring(1).Trim();
				else
				{
					var colorParts = line.Split(new[] { "," }, StringSplitOptions.None)
						.Select(part =>
						{
							int temp;
							if (Int32.TryParse(part, out temp))
								return temp;
							return -1;
						})
						.Where(part => part != -1)
						.ToArray();
					if (colorParts.Length != 3) continue;
					var color = Color.FromArgb(colorParts[0], colorParts[1], colorParts[2]);
					switch (headerName)
					{
						case "Day Names":
							result.HeaderForeColor = color;
							break;
						case "Dead Day Number Fill":
							result.InactiveBackColor = color;
							break;
						case "Dead Day Number Text":
							result.InactiveForeColor = color;
							break;
						case "Dead Day Square Fill":
							result.InactiveBodyColor = color;
							break;
						case "Active Day Number Text":
							result.ActiveForeColor = color;
							break;
						case "Lines":
							result.LineColor = color;
							break;
					}
				}
			}
			return result;
		}
Example #4
0
		public void RefreshData(ColorSchema colorSchema)
		{
			_allowToSave = false;
			_colorSchema = colorSchema;
			labelControlData.Text = Day.Summary;
			pbLogo.Image = Day.Logo.TinyImage;
			pbLogo.Visible = Day.Logo.ContainsData;
			pbLogo.Height = Day.Logo.ContainsData ? Day.Logo.TinyImage.Height : 0;
			memoEditSimpleComment.EditValue = Day.Comment;
			toolStripMenuItemEdit.Visible = true;
			toolStripMenuItemEdit.Enabled = true;
			toolStripMenuItemDelete.Enabled = Day.ContainsData;
			pnCalendarNoteArea.Visible = Day.HasNotes;
			RefreshColor();
			UpdateTooltip();
			_allowToSave = true;
		}
        public static ColorSchema Parse(string content)
        {
            var result     = new ColorSchema();
            var headerName = String.Empty;

            foreach (var line in content.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
            {
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }
                if (line.StartsWith("*"))
                {
                    headerName = line.Substring(1).Trim();
                }
                else
                {
                    var colorParts = line.Split(new[] { "," }, StringSplitOptions.None)
                                     .Select(part =>
                    {
                        int temp;
                        if (Int32.TryParse(part, out temp))
                        {
                            return(temp);
                        }
                        return(-1);
                    })
                                     .Where(part => part != -1)
                                     .ToArray();
                    if (colorParts.Length != 3)
                    {
                        continue;
                    }
                    var color = Color.FromArgb(colorParts[0], colorParts[1], colorParts[2]);
                    switch (headerName)
                    {
                    case "Day Names":
                        result.HeaderForeColor = color;
                        break;

                    case "Dead Day Number Fill":
                        result.InactiveBackColor = color;
                        break;

                    case "Dead Day Number Text":
                        result.InactiveForeColor = color;
                        break;

                    case "Dead Day Square Fill":
                        result.InactiveBodyColor = color;
                        break;

                    case "Active Day Number Text":
                        result.ActiveForeColor = color;
                        break;

                    case "Lines":
                        result.LineColor = color;
                        break;
                    }
                }
            }
            return(result);
        }
Example #6
0
		public void RefreshData(ColorSchema colorSchema)
		{
			foreach (var day in _dayControls)
				day.RefreshData(colorSchema);
		}