public ViewModelDesignEditor(ViewModelMaxLayout vmlayout, ArduinoDriver arduinoDriver)
 {
     _vmlayout             = vmlayout;
     arduino               = arduinoDriver;
     ClearCommand          = new RelayCommand(o => ClearClick());
     Forwar2ArduinoCommand = new RelayCommand(c => Forwar2ArduinoClick());
     InvertCommand         = new RelayCommand(x => InvertClick());
     SaveCommand           = new RelayCommand(s => SaveToFile());
     LoadCommand           = new RelayCommand(l => LoadClick());
     ShiftRightCommand     = new RelayCommand(s => ShiftRightClick());
     Datas = new ObservableCollection <binderClass>();
 }
예제 #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;
        }
        public static List <binderClass> Get(string path2file, ViewModelMaxLayout _vmlayout, DesignEditor view)
        {
            List <binderClass> data = new List <binderClass>();
            var result = DeSerializeObject <List <int> >(path2file);

            if (result != null && result.Count > 0)
            {
                do
                {
                    //var x1 = result.Take(8).ToList();
                    //var l1 = HelperMatriceInteger.RevertBuildList(x1);
                    //result.RemoveRange(0, 8);

                    //var x2 = result.Take(8).ToList();
                    //var l2 = HelperMatriceInteger.RevertBuildList(x2);
                    //result.RemoveRange(0, 8);

                    //var x3 = result.Take(8).ToList();
                    //var l3 = HelperMatriceInteger.RevertBuildList(x3);
                    //result.RemoveRange(0, 8);

                    //var x4 = result.Take(8).ToList();
                    //var l4 = HelperMatriceInteger.RevertBuildList(x4);
                    //result.RemoveRange(0, 8);

                    //var x5 = result.Take(8).ToList();
                    //var l5 = HelperMatriceInteger.RevertBuildList(x5);
                    //result.RemoveRange(0, 8);

                    //var x6 = result.Take(8).ToList();
                    //var l6 = HelperMatriceInteger.RevertBuildList(x6);
                    //result.RemoveRange(0, 8);

                    //var x7 = result.Take(8).ToList();
                    //var l7 = HelperMatriceInteger.RevertBuildList(x7);
                    //result.RemoveRange(0, 8);

                    //var x8 = result.Take(8).ToList();
                    //var l8 = HelperMatriceInteger.RevertBuildList(x8);
                    //result.RemoveRange(0, 8);

                    //var x9 = result.Take(8).ToList();
                    //var l9 = HelperMatriceInteger.RevertBuildList(x9);
                    //result.RemoveRange(0, 8);

                    //var x10 = result.Take(8).ToList();
                    //var l10 = HelperMatriceInteger.RevertBuildList(x10);
                    //result.RemoveRange(0, 8);

                    //List<bool[,]> screen = new List<bool[,]> { l1, l2, l3, l4, l5, l6, l7, l8, l9, l10 };

                    List <bool[, ]> screen = new List <bool[, ]>();
                    for (int i = 0; i < 10; i++)
                    {
                        screen.Add(Next(result));
                    }


                    if (_vmlayout != null)
                    {
                        _vmlayout.Apply(screen);
                    }

                    BitmapImage newimg = null;
                    if (view != null)
                    {
                        view.maxlayout.UpdateLayout();
                        newimg = DesignEditor.GetImage(view.maxlayout);
                    }

                    data.Add(new binderClass {
                        imageSource = newimg, rawData = screen
                    });
                }while (result.Count > 0);
            }
            return(data);
        }