コード例 #1
0
        private void AddCopyButton_Click(object sender, EventArgs e)
        {
            var copyClip = new LedMatrix();

            copyClip.SetContent(_clips.GetAt(_clips.Count - 1));
            AddClip(copyClip);
        }
コード例 #2
0
        public void Remove(LedMatrix matrix)
        {
            if (matrix == null)
            {
                throw new ArgumentNullException();
            }

            matrix.LedMatrixCopy  -= OnLedMatrixCopy;
            matrix.LedMatrixPaste -= OnLedMatrixPaste;
            _content.Remove(matrix);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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());
        }