Ejemplo n.º 1
0
        private void Render()
        {
            // #1 get all char un single row size
            int             totallenght = 0;
            List <bool[, ]> tmpArray    = msg.ToList().Select(x =>
            {
                var y        = HelperLetterDefinition.Get(x.ToString());
                totallenght += y.GetLength(1);
                return(y);
            }).ToList();

            // #2 create temp array  with all values one behind each other
            bool[,] boolMainMessage = new bool[Definition.Number_Led_X_Max7219, totallenght];

            int localcursor = 0;

            foreach (bool[,] x in tmpArray)
            {
                for (int j = 0; j < x.GetLength(1); j++)
                {
                    for (int inc = 0; inc < Definition.Number_Led_X_Max7219; inc++)
                    {
                        boolMainMessage[inc, localcursor] = x[inc, j];
                    }
                    localcursor++;
                }
            }


            // #3 create new array two time bigger => so that we can write in it (from boolMainMessage)
            bool[,] mainmessage = new bool[totallenght * 2, Definition.Number_Led_X_Max7219 * 2];

            for (int i = 0; i < totallenght; i++)
            {
                for (int j = 0; j < Definition.Number_Led_X_Max7219; j++)
                {
                    mainmessage[i * 2, j * 2]         = boolMainMessage[j, i];
                    mainmessage[i * 2 + 1, j * 2]     = boolMainMessage[j, i];
                    mainmessage[i * 2, j * 2 + 1]     = boolMainMessage[j, i];
                    mainmessage[i * 2 + 1, j * 2 + 1] = boolMainMessage[j, i];
                }
            }

            ModelHelper.RenderingGeneric(mainmessage, _steps);

            //var line1 = HelperMatriceListConvertor.ConvertToList(mainmessage);

            //_steps.ForEach(x => x.Apply(line1));
        }
Ejemplo n.º 2
0
        public ViewModelMain(ViewModelMaxLayout vm)
        {
            steps = new List <IStep> {
                vm, arduino
            };

            XDisplayCommand          = new RelayCommand(o => XDisplayClick());
            DisplayCustomTextCommand = new RelayCommand(o => DisplayCustomTextClick());
            DisplayHourCommand       = new RelayCommand(o => DisplayHourClick());
            ScenarioCommand          = new RelayCommand(o => ScenarioClick());
            ImportCommand            = new RelayCommand(o => ImportClick());
            DesignModeCommand        = new RelayCommand(o => DesignModeClick());

            InitUsbCommand = new RelayCommand(o => InitUSBClick());

            Line1        = "Hello World ! 123456";
            Line2        = "@coucou #ABC";
            IsSimulation = false;
            Reverse2     = true;
            var a = HelperLetterDefinition.Get("a");//force to load setup

            Scenarios += "BIGTEXT(msg=Coucou)" + Environment.NewLine;
            Scenarios += "MOVIE(file=pacman.xml)" + Environment.NewLine;
            Scenarios += "SNAKE()" + Environment.NewLine;
            Scenarios += "HOUR()" + Environment.NewLine;
            Scenarios += "SNOW()" + Environment.NewLine;
            Scenarios += "TEXT(msg1=#coucou c'est nous!;msg2=C0mment c@ v@ ? )" + Environment.NewLine;
            Scenarios += "PIXEL()" + Environment.NewLine;
            Scenarios += "HOUR()" + Environment.NewLine;
            Scenarios += "TEXT(msg1=prout;msg2=123456789 ? )" + Environment.NewLine;
            Scenarios += "FILLING()" + Environment.NewLine;
            Scenarios += "CLEAR()" + Environment.NewLine;

            ComPort = "COM5";
            ComRate = "115200";

            int rate = Int32.Parse(ComRate);

            arduino.Rate = rate;
            arduino.Port = ComPort;
        }