public Computing() { Result = new Moment(0); //Tmr = new Timer(3000); //Tmr.AutoReset = true; //Tmr.Elapsed += Tmr_Elapsed; InpFileName = @"D:\ballistics\ballisticwpf\config.txt"; OutFileName = @"D:\ballistics\ballisticwpf\result.txt"; //string InpFileName = @"C:\Users\Andrey\Documents\Visual Studio 2015\Projects\ballistics\ballisticwpf\config.txt"; //string OutFileName = @"C:\Users\Andrey\Documents\Visual Studio 2015\Projects\ballistics\ballisticwpf\result.txt"; Config = new Configuration(0); Config.ReadConfugurationFromFile(InpFileName); bool ExistFlag = File.Exists(OutFileName); if (ExistFlag) { File.Delete(OutFileName); } Positions = new PointCollection(); Positions.Add(new Point(0, 0)); Chart = new Polyline(); Chart.Points = Positions; //BgrWork = ((BackgroundWorker)this.FindResource("bgrWork")); //ComplexArg = new ComplexForAsyns(Config); }
/// <summary> /// Просчитывает характеристики движения /// </summary> /// <param name="t">Момент времени</param> /// <param name="Config">Конфигурация</param> /// <returns></returns> //public event EventHandler<MomentUpdate> Update; public int ComputingMoment(double t, Configuration Config) { CurrentTime = t; CurrentZ = Config.z0 + Config.speed * Math.Sin(Config.radAlpha) * t + ((Config.boostZ * Math.Pow(t, 2)) / 2); CurrentX = Config.x0 + Config.speed * Math.Cos(Config.radAlpha) * t + ((Config.boostX * Math.Pow(t, 2)) / 2); //speed = Config.speed; //CurrentSpeedY = Config.speed * Math.Sin(Config.radAlpha) + (Config.boostZ) * t; //speedX = Config.x0; return 0; }
public MainWindow() { InitializeComponent(); param.IsChecked = true; Config = new Configuration(0); }
public StartEventArgs(Configuration StartConfig) { this.Config = StartConfig; }
//private void Tmr_Elapsed(object sender, ElapsedEventArgs e) //{ // UpdateMoment.ReadFromFile(UpdFStr); // UpdateWindow(UpdateMoment); // throw new NotImplementedException(); //} public void GoComputing(object sender, StartEventArgs e) { this.Config = e.Config; InitializeComponent(); textBlock_SX.Text = Config.x0.ToString(); textBlock_SZ.Text = Config.z0.ToString(); textBlock_SS.Text = Config.speed.ToString(); textBlock_SB.Text = Config.boostZ.ToString(); textBlock_F.Text = Config.frequency.ToString(); textBlockOutX.Text = Config.x0.ToString(); textBlockOutZ.Text = Config.z0.ToString(); textBlockOutSpeedZ.Text = Config.speed.ToString(); Show(); double FullTime = (-1) * 2 * (this.Config.speed * Math.Sin(this.Config.radBeta)) / this.Config.boostZ; File.AppendAllText(this.OutFileName, "Start"); for (double t = 0; t < FullTime; t += this.Config.frequency) { Result.ComputingMoment(t, this.Config); Result.WriteToFile(this.OutFileName); Positions.Add(new Point(Result.CurrentX, Result.CurrentZ)); progressBar.Value = (int)(100 * (t / FullTime)); this.UpdateLayout(); } }