Example #1
0
        private void DeleteIdea(ExIdea idea)
        {
            foreach (ExIdea child in idea.Children(Key.Left))
            {
                DeleteIdea(child);
            }
            foreach (ExIdea child in idea.Children(Key.Right))
            {
                DeleteIdea(child);
            }
            foreach (ExIdea child in idea.Children(Key.Up))
            {
                DeleteIdea(child);
            }
            foreach (ExIdea child in idea.Children(Key.Down))
            {
                DeleteIdea(child);
            }

            canvas.Children.Remove(idea);
            if (idea.parent_rel != null)
            {
                canvas.Children.Remove(idea.parent_rel);
            }
        }
Example #2
0
        private void New_Click(object sender, RoutedEventArgs e)
        {
            ExIdea idea = new ExIdea()
            {
                Margin = new Thickness((int)canvas.RenderSize.Width / 2, (int)canvas.RenderSize.Height / 2 - 100, 0, 0)
            };

            idea.notify += Active;

            canvas.Children.Add(idea);

            door_img.Visibility = Visibility.Hidden;
        }
Example #3
0
        public void AddRelation(ExIdea child)
        {
            var relation = new Line()
            {
                Stroke          = new SolidColorBrush(Colors.Black),
                StrokeThickness = 1,
                X1 = this.Margin.Left + this.Width / 2,
                Y1 = this.Margin.Top + this.Height / 2,
                X2 = child.Margin.Left + child.Width / 2,
                Y2 = child.Margin.Top + child.Height / 2
            };

            relations.Add(relation);
            child.parent_rel = relation;
        }
Example #4
0
        private ExIdea MakeIdea(Key direction)
        {
            const int each_distance = 100;
            const int peer_distance = 200;

            ExIdea idea     = new ExIdea();
            var    children = active_idea.Children(direction);

            int sign     = (children.Count % 2 == 1) ? -1 : 1;
            int distance = sign * (children.Count + 1) / 2 * each_distance;

            switch (direction)
            {
            case Key.Left:
                idea.Margin = new Thickness(active_idea.Margin.Left - peer_distance,
                                            active_idea.Margin.Top + distance, 0, 0);
                break;

            case Key.Right:
                idea.Margin = new Thickness(active_idea.Margin.Left + peer_distance,
                                            active_idea.Margin.Top + distance, 0, 0);
                break;

            case Key.Up:
                idea.Margin = new Thickness(active_idea.Margin.Left + distance * 2,
                                            active_idea.Margin.Top - peer_distance, 0, 0);
                break;

            case Key.Down:
                idea.Margin = new Thickness(active_idea.Margin.Left + distance * 2,
                                            active_idea.Margin.Top + peer_distance, 0, 0);
                break;
            }
            idea.notify += Active;

            children.Add(idea);
            active_idea.AddRelation(idea);

            canvas.Children.Add(idea);
            canvas.Children.Add(idea.parent_rel);
            Canvas.SetZIndex(canvas.Children[canvas.Children.Count - 1], -1);

            return(idea);
        }
Example #5
0
        private void Active(object sender)
        {
            if (active_idea == (ExIdea)sender)
            {
                active_idea.BorderThickness = new Thickness(0);

                active_idea            = null;
                SettingDock.Visibility = Visibility.Hidden;
            }
            else
            {
                if (active_idea != null)
                {
                    active_idea.BorderThickness = new Thickness(0);
                }

                active_idea = (ExIdea)sender;
                active_idea.BorderThickness = new Thickness(1);
                setting_name.Text           = active_idea.Name;
                setting_fontsize.Text       = active_idea.FontSize.ToString();

                SettingDock.Visibility = Visibility.Visible;
            }
        }