private void DeleteAction_Click(object s, RoutedEventArgs ea) { MainContent mc = ((MainWindow)Application.Current.MainWindow).MainContent; List <Monument> conflicting = mc.tagConflictingMonuments(Id); if (conflicting == null) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this tag?"); ars.Owner = Application.Current.MainWindow; ars.WindowStartupLocation = WindowStartupLocation.CenterOwner; ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } } else { DeleteTagDialog dtDialog = new DeleteTagDialog(new ObservableCollection <Monument>(conflicting)); dtDialog.Owner = Application.Current.MainWindow; dtDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; dtDialog.ShowDialog(); if (dtDialog.DialogResult.HasValue && dtDialog.DialogResult.Value) { mc.removeTagFromMonuments(Id); } else { return; } } DoubleAnimation animation = new DoubleAnimation(); animation.To = 0; //animation.From = 1; animation.Duration = TimeSpan.FromMilliseconds(300); animation.EasingFunction = new QuadraticEase(); Storyboard sb = new Storyboard(); sb.Children.Add(animation); Root.Opacity = 1; Root.Visibility = Visibility.Visible; Storyboard.SetTarget(sb, Root); Storyboard.SetTargetProperty(sb, new PropertyPath(Control.OpacityProperty)); sb.Completed += delegate(object sender, EventArgs e) { Root.Visibility = Visibility.Collapsed; this.RemoveTagCallback(this.Id); }; sb.Begin(); }
private void DeleteAction(object sender, RoutedEventArgs e) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this tag?"); ars.Owner = Application.Current.MainWindow; ars.WindowStartupLocation = WindowStartupLocation.CenterOwner; ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } RemoveMonumentCallback(MyMonument.Id); }
private void RemoveMonumentCommand_Executed(object sender, ExecutedRoutedEventArgs e) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this monument?"); ars.Owner = Application.Current.MainWindow; ars.WindowStartupLocation = WindowStartupLocation.CenterOwner; ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } int toRemove = MainContent.MonumentTable.EnlargenedMonuments.First(); Monument m = MainContent.Monuments.SingleOrDefault(x => x.Id == toRemove); this.MainContent.removeMonumentCallback(m.Id); MainContent.MonumentTable.EnlargenedMonuments.Remove(toRemove); }
private void DeleteTagCommand_Executed(object sender, ExecutedRoutedEventArgs e) { string toRemove = this.EnlargenedTags.First(); MainContent mc = ((MainWindow)Application.Current.MainWindow).MainContent; List <Monument> conflicting = mc.tagConflictingMonuments(toRemove); if (conflicting == null) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this tag?"); ars.Owner = Application.Current.MainWindow; ars.WindowStartupLocation = WindowStartupLocation.CenterOwner; ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } } else { DeleteTagDialog dtDialog = new DeleteTagDialog(new ObservableCollection <Monument>(conflicting)); dtDialog.Owner = Application.Current.MainWindow; dtDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; dtDialog.ShowDialog(); if (dtDialog.DialogResult.HasValue && dtDialog.DialogResult.Value) { mc.removeTagFromMonuments(toRemove); } else { return; } } Tag t = this.Tags.SingleOrDefault(x => x.Id == toRemove); this.RemoveTagCallback(toRemove); this.EnlargenedTags.Remove(toRemove); }
private void DeleteTypeCommand_Executed(object sender, ExecutedRoutedEventArgs e) { int toRemove = this.EnlargenedTypes.First(); MainContent mc = ((MainWindow)Application.Current.MainWindow).MainContent; List <Monument> conflicting = mc.typeConflictingMonuments(toRemove); if (conflicting == null) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this type?"); ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } } else { DeleteTypeDialog dtDialog = new DeleteTypeDialog(new ObservableCollection <Monument>(conflicting)); dtDialog.ShowDialog(); if (dtDialog.DialogResult.HasValue && dtDialog.DialogResult.Value) { mc.removeTypeAndMonuments(toRemove); } else { return; } } Type t = this.Types.SingleOrDefault(x => x.Id == toRemove); this.RemoveTypeCallback(toRemove); this.EnlargenedTypes.Remove(toRemove); }
private void deleteMenuAction(object s, RoutedEventArgs ea) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this monument?"); ars.Owner = Application.Current.MainWindow; ars.WindowStartupLocation = WindowStartupLocation.CenterOwner; ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } DoubleAnimation animation = new DoubleAnimation(); animation.To = 0; //animation.From = 1; animation.Duration = TimeSpan.FromMilliseconds(300); animation.EasingFunction = new QuadraticEase(); Storyboard sb = new Storyboard(); sb.Children.Add(animation); Root.Opacity = 1; Root.Visibility = Visibility.Visible; Storyboard.SetTarget(sb, Root); Storyboard.SetTargetProperty(sb, new PropertyPath(Control.OpacityProperty)); sb.Completed += delegate(object sender, EventArgs e) { Root.Visibility = Visibility.Collapsed; RemoveMonumentCallback(MonumentId); }; sb.Begin(); }