コード例 #1
0
        private void DeleteBtn_Click(object s, RoutedEventArgs ea)
        {
            MainContent mc = ((MainWindow)Application.Current.MainWindow).MainContent;

            List <Monument> conflicting = mc.typeConflictingMonuments(Id);

            if (conflicting == null)
            {
                AreYouSure ars = new AreYouSure("Are you sure you want to delete this type?");
                ars.Owner = Application.Current.MainWindow;
                ars.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                ars.ShowDialog();

                if (ars.DialogResult.HasValue && !ars.DialogResult.Value)
                {
                    return;
                }
            }
            else
            {
                DeleteTypeDialog dtDialog = new DeleteTypeDialog(new ObservableCollection <Monument>(conflicting));

                dtDialog.Owner = Application.Current.MainWindow;
                dtDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                dtDialog.ShowDialog();
                if (dtDialog.DialogResult.HasValue && dtDialog.DialogResult.Value)
                {
                    mc.removeTypeAndMonuments(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.removeTypeCallbackFun(this.Id);
            };
            sb.Begin();
        }
コード例 #2
0
        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);
        }