private void reset(object sender, MouseButtonEventArgs e) { EditKraam editkraam = new EditKraam(); editkraam.Show(); this.Close(); }
public void StartSketch(object sender, RoutedEventArgs e) { if (listView.SelectedIndex < 0) { return; } string selected_file_name = composition_names[listView.SelectedIndex]; string plankinfo = File.ReadAllText(Path.Combine(SoufTools.compositions_path, selected_file_name + ".json")); PlankInfo[] result = JsonConvert.DeserializeObject <PlankInfo[]>(plankinfo); EditKraam editkraam = new EditKraam(); if (result != null) { foreach (PlankInfo p in result) { editkraam.Add_plank(p.X, p.Y, p.Width, p.Height); } } editkraam.Show(); Close(); }
private void randomPlank(object sender, MouseButtonEventArgs e) { var rand = new Random(); int planktimes = rand.Next(5, 12); if (planks.Count != 0) { EditKraam editkraam = new EditKraam(); planks.Clear(); editkraam.randomPlank(sender, e); editkraam.Show(); this.Close(); } else { for (int i = 0; i < planktimes; i++) { var width = rand.Next(2, 11); var height = rand.Next(2, 11); var x = rand.Next(0, 800); var y = rand.Next(0, 800); if (true) { var width_plank = Convert.ToInt16(width); var height_plank = Convert.ToInt16(height); var x_plank = Convert.ToInt16(x); var y_plank = Convert.ToInt16(y); SetColor("#654321"); Plank p = new Plank( planks.Count, Rect(x_plank, y_plank, width_plank * GRID_SIZE, height_plank * GRID_SIZE) ); planks.Add(p); selectedPlank = p; Plank.selectedPlank = planks.Count() - 1; CheckPlanks(); } } } }