Exemple #1
0
        private void Fly_Click(object sender, RoutedEventArgs e)
        {
            double        num;
            List <double> X = new List <double>();
            List <double> Y = new List <double>();

            if (double.TryParse(TextSpeed.Text, out num))
            {
                using (StreamWriter sr = new StreamWriter("C:\\Users\\Максим\\source\\repos\\GameFly\\Properties\\Speed.txt"))
                {
                    sr.WriteLine(num);
                }
            }

            double num2;

            if (double.TryParse(TextAngl.Text, out num2))
            {
                using (StreamWriter sr = new StreamWriter("C:\\Users\\Максим\\source\\repos\\GameFly\\Properties\\Angle.txt"))
                {
                    sr.WriteLine(num2);
                }
            }
            FlyObj flyObj = new FlyObj();

            flyObj.Position();
        }
Exemple #2
0
        private void Draw_Click(object sender, RoutedEventArgs e)
        {
            Line A = new Line();
            Line O = new Line();

            ICanFly.Children.Add(A);
            ICanFly.Children.Add(O);
            A.Margin          = new Thickness(25, ICanFly.Height - 20, 0, 25);
            O.Margin          = new Thickness(27, ICanFly.Height - 20, 0, 25);
            A.StrokeThickness = 5;
            O.StrokeThickness = 5;
            A.X2     = ICanFly.Width - 25;
            O.Y2     = -ICanFly.Height + 61;
            A.Stroke = Brushes.Red;
            O.Stroke = Brushes.Red;
            List <double> X    = new List <double>();
            List <double> Y    = new List <double>();
            FlyObj        temp = new FlyObj();

            temp.Coordinates(X, Y);
            for (int i = 0; i < Y.Count; i++)
            {
                var    c = new Ellipse();
                double left = 25, top = ICanFly.Height - 25, right = 0, bottom = 25;
                c.Width  = 8;
                c.Height = 8;
                if (i == Y.Count / 2)
                {
                    c.Fill   = Brushes.CadetBlue;
                    c.Stroke = Brushes.Red;
                    Line projection = new Line();
                    ICanFly.Children.Add(projection);
                    projection.Margin          = new Thickness(left + X[i] + 2, top - Y[i] + 2, right, bottom);
                    projection.Stroke          = Brushes.CadetBlue;
                    projection.StrokeThickness = 2;
                    DoubleCollection collection = new DoubleCollection();
                    collection.Add(0.5);
                    projection.StrokeDashArray = collection;
                    projection.Y2 = Y[i];
                }
                else
                {
                    c.Fill   = Brushes.Violet;
                    c.Stroke = Brushes.Violet;
                }
                ICanFly.Children.Add(c);
                c.Margin = new Thickness(left + X[i], top - Y[i], right, bottom);
            }
            Data.Text = "Максимальная высота = " + Convert.ToString(Y[(Y.Count) / 2]) + '\n' +
                        "Время полета = " + temp.Get_Time();
        }
Exemple #3
0
        public MainWindow()
        {
            FlyObj fly = new FlyObj();

            fly.Position();
        }