コード例 #1
0
ファイル: IterateThread.cs プロジェクト: aarroyoc/Conway
 public IterateThread(ConwayCanvas canvas, MainWindow window, int speed, int n = -1)
 {
     this.canvas = canvas;
     this.window = window;
     this.speed  = speed;
     this.n      = n;
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: aarroyoc/Conway
        public MainWindow()
        {
            InitializeComponent();
            conway = new ConwayCanvas();
            conway.PointerPressed  += ClickStart;
            conway.PointerMoved    += ClickRenderCanvas;
            conway.PointerReleased += ClickEnd;
            panel = this.Find <StackPanel>("panel");
            panel.Children.Add(conway);
            boton        = this.Find <Button>("exec");
            boton.Click += OnClick;
            next         = this.Find <Button>("next");
            next.Click  += NextStep;
            nuevo        = this.Find <Button>("new");
            nuevo.Click += NewPattern;
            load         = this.Find <Button>("load");
            load.Click  += LoadPattern;
            save         = this.Find <Button>("save");
            save.Click  += SavePattern;

            this.speedSelector = this.Find <ComboBox>("speedSelector");

            up        = this.Find <Button>("up");
            up.Click += GoUp;

            left         = this.Find <Button>("left");
            left.Click  += GoLeft;
            down         = this.Find <Button>("down");
            down.Click  += GoDown;
            right        = this.Find <Button>("right");
            right.Click += GoRight;

            iterations = this.Find <TextBlock>("iterations");
            alive      = this.Find <TextBlock>("alive");

            iterButton         = this.Find <Button>("iter-n-do");
            iterButton.Click  += IterN;
            iterBox            = this.Find <TextBox>("iter-n");
            iterBox.TextInput += TextIter;
            iterBlock          = this.Find <TextBlock>("iter-time");

            this.KeyDown         += MoveKey;
            this.Closed          += OnClosed;
            this.PropertyChanged += HandleResize;
            this.Renderer.AddDirty(conway);

            //conway.LoadFile("Patterns/3enginecordership.rle"); //Temporal, para que pueda ejeutarlo en Fedora
        }