private void IconButton_Okay_Click(object sender, EventArgs e) { var newName = NewNameBox.Text.Trim(); IList<string> badChars = new List<string>(); if (newName.Equals(string.Empty)) { return; } if (newName.Equals(_actionable.DisplayName)) { NavigateOnSuccess(Utils.CreateActionableFromPath(_actionable.Path)); return; } else if (!FileUtils.IsValidFileName(newName, out badChars)) { MessageBox.Show("You used the following invalid characters: " + badChars.ToString(), "Invalid characters", MessageBoxButton.OK); return; } else if (!FileUtils.IsUniqueFileName(newName, _actionable.Name, _actionable.Path.Parent.PathString)) { MessageBox.Show("An item with the same name already exists in that location.\n\nNote that names are case-insensitive.", "Invalid name", MessageBoxButton.OK); return; } else if (newName.Equals(".")) { MessageBox.Show("The name \".\" is an invalid file name.", "Invalid name", MessageBoxButton.OK); return; } else if (newName.StartsWith(".")) { var r = MessageBox.Show("Items whose names start with '.' are hidden. You can enable showing hidden files in the application's settings.", "Hidden file", MessageBoxButton.OKCancel); if (r == MessageBoxResult.Cancel) return; } try { var act = _actionable.Rename(newName); NavigateOnSuccess(act); } catch (Exception ex) { return; } }
private void bw_RunWorkerCompletedSchueler(object sender, RunWorkerCompletedEventArgs e) { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); Schueler[] schueler = (Schueler[])json_serializer.Deserialize<Schueler[]>((String)e.Result); List<Schueler> content = new List<Schueler>(schueler); Console.WriteLine(content.ToString()); cmbSchueler.ItemsSource = content; }
private void bw_RunWorkerCompletedRatings(object sender, RunWorkerCompletedEventArgs e) { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); StandRating[] staendeR = (StandRating[])json_serializer.Deserialize<StandRating[]>((String)e.Result); List<StandRating> content = new List<StandRating>(staendeR); currentStand.standratings = content; Console.WriteLine("Staende: " + content.ToString()); gridRatings.ItemsSource = content; lblMessage.Content = content.Count + " Ratings Loaded"; if(gridRatings.Items.Count != 0) { calcAvgRatings(); } else { btnResetRatings.IsEnabled = false; lblMessage.Content = "Dieser Stand hat keine Ratings"; } }