Exemple #1
0
        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();
        }
Exemple #2
0
        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);
        }