private void buttonStop_Click(object sender, System.EventArgs e) { try { this.timer.Stop(); string saveFileName = this.saveDirPath + "/" + this.textBoxName.Text + "/" + this.getAvailableLineNumber() + ".wwb"; if (this.curPathLine != null) { this.curPathLine.SaveToFile(saveFileName); if (File.Exists(saveFileName)) { this.listBoxPaths.Items.Add(Path.GetFileName(saveFileName)); } this.curPathList.Add(this.curPathLine); this.curPathLine = null; } this.listBoxPaths.Enabled = true; this.textBoxName.Enabled = true; this.buttonStart.Enabled = true; this.buttonStop.Enabled = false; this.buttonSave.Enabled = true; this.numericUpDownHeight.Enabled = true; this.numericUpDownFrequency.Enabled = true; } catch (Exception caught) { Log.Write(caught); } }
private void textBoxName_TextChanged(object sender, System.EventArgs e) { if (this.curPathList.Count > 0) { foreach (PathLine pl in this.curPathList) { this.worldWindow.CurrentWorld.RenderableObjects.Remove(pl.Name); pl.Dispose(); } this.curPathList.Clear(); } this.listBoxPaths.Items.Clear(); DirectoryInfo inDir = new DirectoryInfo(this.saveDirPath + "/" + this.textBoxName.Text); if (inDir.Exists) { foreach (FileInfo file in inDir.GetFiles("*.wwb")) { this.listBoxPaths.Items.Add(file.Name); PathLine newPathLine = new PathLine(this.textBoxName.Text + " - " + file.Name, this.worldWindow.CurrentWorld, file.FullName, (float)this.numericUpDownHeight.Value, System.Drawing.Color.Red); newPathLine.IsOn = true; this.curPathList.Add(newPathLine); this.worldWindow.CurrentWorld.RenderableObjects.Add(newPathLine); } } }
private void buttonStart_Click(object sender, System.EventArgs e) { try { this.listBoxPaths.Enabled = false; this.textBoxName.Enabled = false; this.buttonStop.Enabled = true; this.buttonStart.Enabled = false; this.buttonSave.Enabled = false; this.numericUpDownHeight.Enabled = false; this.numericUpDownFrequency.Enabled = false; World.Settings.ShowCrosshairs = true; this.curPathLine = new PathLine(this.textBoxName.Text + " - " + this.getAvailableLineNumber() + ".wwb", this.worldWindow.CurrentWorld, null, (float)this.numericUpDownHeight.Value, System.Drawing.Color.Red); this.worldWindow.CurrentWorld.RenderableObjects.Add(this.curPathLine); this.curPathLine.IsOn = true; this.curHeight = (float)this.numericUpDownHeight.Value; this.lastPosition = new Microsoft.DirectX.Vector2((float)this.worldWindow.DrawArgs.WorldCamera.Latitude.Degrees, (float)this.worldWindow.DrawArgs.WorldCamera.Longitude.Degrees); this.curPathLine.AddPointToPath(this.lastPosition.X, this.lastPosition.Y, false, (float)this.numericUpDownHeight.Value); if (this.timer == null) { this.timer = new System.Timers.Timer((double)this.numericUpDownFrequency.Value); this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); } else { this.timer.Interval = (double)this.numericUpDownFrequency.Value; } this.timer.Start(); } catch (Exception caught) { Log.Write(caught); } }