예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            Instance = this;
            for (int i = 0; i < 17; i++)
            {
                for (int j = 0; j < 14; j++)
                {
                    var newfPoint = new FieldVector
                                        {
                                            Height = 16,
                                            Width = 12,
                                            HorizontalAlignment = HorizontalAlignment.Left,
                                            VerticalAlignment = VerticalAlignment.Top,
                                            Margin = new Thickness((45*i) + 20, (45*j) + 12, 0, 0)
                                        };
                    gridField.Children.Add(newfPoint);
                }
            }
            _timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            _timer.Tick += TimerTick;

            CalculatePositions();
            //var x = Window.GetWindow(this).
        }
        public SingleChargeSolver()
        {
            InitializeComponent();
            Instance = this;

            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    var newfPoint = new FieldVector
                                        {
                                            Height = 14,
                                            Width = 8,
                                            HorizontalAlignment = HorizontalAlignment.Left,
                                            VerticalAlignment = VerticalAlignment.Top,
                                            Margin = new Thickness((45*i) + 21, (45*j) + 12, 0, 0)
                                        };
                    gridField.Children.Add(newfPoint);
                }
            }

            var group = new TransformGroup();

            var transfer = new TranslateTransform
                               {
                                   X = 190,
                                   Y = 118
                               };

            group.Children.Add(transfer);
            positiveCharge1.RenderTransform = group;

            _charges.Add(positiveCharge1.MyCharge);
            CalculatePositions();
        }