private void AddCopyButton_Click(object sender, EventArgs e) { var copyClip = new LedMatrix(); copyClip.SetContent(_clips.GetAt(_clips.Count - 1)); AddClip(copyClip); }
public void Remove(LedMatrix matrix) { if (matrix == null) { throw new ArgumentNullException(); } matrix.LedMatrixCopy -= OnLedMatrixCopy; matrix.LedMatrixPaste -= OnLedMatrixPaste; _content.Remove(matrix); }
public void SetContent(LedMatrix src) { for (int r = 0; r < 8; r++) { for (int c = 0; c < 8; c++) { _matrix[r, c] = src._matrix[r, c]; } } Refresh(); }
public void Add(LedMatrix matrix) { if (matrix == null) { throw new ArgumentNullException(); } matrix.LedMatrixCopy += OnLedMatrixCopy; matrix.LedMatrixPaste += OnLedMatrixPaste; matrix.LedMatrixMove += OnLedMatrixMove; matrix.LedMatrixDelete += OnLedMatrixDelete; _content.Add(matrix); }
private void AddClip(LedMatrix clip = null) { if (clip == null) { clip = new LedMatrix(); } clip.Top = 10; clip.ShowActionButtons = true; clip.Width = 170; clip.Left = (_clips.Count * (clip.Width + 10)) + 10; clip.Parent = ClipsContainer; _clips.Add(clip); ClipCountLabel.Text = _clips.Count.ToString(); }
public IEnumerable <LedMatrix> ReadFromFile(string filePath) { var file = System.IO.File.OpenRead(filePath); var zippedContent = new byte[file.Length]; file.Read(zippedContent, 0, zippedContent.Length); file.Close(); var serializedContent = Unzip(zippedContent); var rawContent = System.Text.Json.JsonSerializer.Deserialize <IEnumerable <byte[]> >(serializedContent); var clips = new List <LedMatrix>(); foreach (var matrixContent in rawContent) { var clip = new LedMatrix(); clip.Content = matrixContent; clips.Add(clip); } return(clips.ToArray()); }