コード例 #1
0
        public Results(CombinedNode node)
        {
            this.node = node;
            InitializeComponent();
            NodeValue result = node.CalcValue;

            lbl_origin.Content = result.Origin;
            lbl_val.Content    = result.Value;
            List <CombinedNode> nodei = node.GetChildren();

            foreach (var item in nodei)
            {
                if (item.Children.Count != 0)
                {
                    GraphControl kontrola = new GraphControl(item);
                    stck_grafi.Children.Add(kontrola);
                }
            }
            List <OdločitvenoDrevoLibrary.Point> tocke;

            if (node.Type == NodeType.Event)
            {
                tocke = node.GetPoints(1, 1, true);
            }
            else
            {
                tocke = node.GetPoints(1, 1, false);
            }
            foreach (var item in tocke)
            {
                draw(item);
            }
            card_tree.Height = tocke.Count() * 40;
            //Canavas_drevo.Height = tocke.Sum(x => x.Y) * 5;
        }
コード例 #2
0
        /// <summary>
        /// Returns a <see cref="T:System.Windows.DataTemplate" /> based on what type of node is displayed.
        /// </summary>
        /// <param name="item">The data object for which to select the template.</param>
        /// <param name="container">The data-bound object.</param>
        /// <returns>
        /// Returns a <see cref="T:System.Windows.DataTemplate" /> or null. The default value is null.
        /// </returns>
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            FrameworkElement element = (FrameworkElement)container;

            if (item is Transformation)
            {
                return(element.FindResource("TransformationNodeTemplate") as DataTemplate);
            }
            else if (item is OutputNode)
            {
                return(element.FindResource("OutputNodeTemplate") as DataTemplate);
            }
            else if (item is DataSource)
            {
                return(element.FindResource("DataSourceNodeTemplate") as DataTemplate);
            }
            else if (item is CombinedNode)
            {
                CombinedNode combinedNode = (CombinedNode)item;
                if (combinedNode.InputNodes.Length == 0)
                {
                    return(element.FindResource("DataSourceNodeTemplate") as DataTemplate);
                }
                if (combinedNode.InputNodes.Length > 0)
                {
                    return(element.FindResource("TransformationNodeTemplate") as DataTemplate);
                }
            }

            return(base.SelectTemplate(item, container));
        }
コード例 #3
0
        public GraphControl(CombinedNode node)
        {
            this.node = node;
            InitializeComponent();
            //Doda vrednosti
            List <string>        labele = new List <string>();
            ChartValues <double> vals   = new ChartValues <double>();

            foreach (var child in node.Children)
            {
                vals.Add(child.CalcValue.Value);
                labele.Add(child.Name);
            }
            chartvals        = vals;
            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "Values",
                    Values = vals
                }
            };
            Labels    = labele.ToArray();
            Formatter = value => value.ToString();

            DataContext = this;
        }
コード例 #4
0
        //Izbira vozlišča na levi strani :)
        private void node_click(object sender, MouseButtonEventArgs e)
        {
            Label        temp    = sender as Label;
            CombinedNode vsebina = temp.DataContext as CombinedNode;

            SelectedNode = vsebina;
            PrepareCard();
        }
コード例 #5
0
        private void child_click(object sender, MouseButtonEventArgs e)
        {
            Grid         temp     = sender as Grid;
            CombinedNode selected = temp.DataContext as CombinedNode;

            SelectedNode = selected;
            Update();
        }
コード例 #6
0
 public MainWindow()
 {
     InitializeComponent();
     baseNode               = new CombinedNode();
     SelectedNode           = baseNode;
     baseNode.Name          = "My base node";
     list_nodes.ItemsSource = baseNode.GetChildren();
     PrepareCard();
 }
コード例 #7
0
        private void Import_click(object sender, MouseButtonEventArgs e)
        {
            string path       = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/tree.xml";
            var    serializer = new XmlSerializer(typeof(CombinedNode));

            using (var stream = File.OpenRead(path))
            {
                CombinedNode node = (CombinedNode)serializer.Deserialize(stream);
                this.baseNode = node;
                SelectedNode  = baseNode;
                Update();
            }
        }
コード例 #8
0
        private static CombinedNode PripraviDrevo()
        {
            CombinedNode baseNode = new CombinedNode();

            baseNode.Children.Add(new CombinedNode());
            baseNode.Children.Add(new CombinedNode());
            baseNode.Children.Add(new CombinedNode());
            CombinedNode newChild = new CombinedNode();

            newChild.Children.Add(new CombinedNode());
            newChild.Children.Add(new CombinedNode());
            newChild.Children.Add(new CombinedNode());
            baseNode.Children.Add(newChild);
            return(baseNode);
        }
コード例 #9
0
 private void delete_click(object sender, MouseButtonEventArgs e)
 {
     if (SelectedNode == baseNode)
     {
         MessageBox.Show("You can't delete the base!");
     }
     else
     {
         bool response = baseNode.Delete(SelectedNode);
         if (!response)
         {
             MessageBox.Show("Failed");
         }
         else
         {
             SelectedNode = baseNode;
             Update();
         }
     }
 }
コード例 #10
0
 public UITransactionMerge(CombinedNode mergedNode, Connection[] oldConnections)
 {
     this._mergedNode     = mergedNode;
     this._oldConnections = oldConnections;
 }
コード例 #11
0
ファイル: AnimManager.cs プロジェクト: FourFangedCow/UnityVN
 CombinedNode CreateCombinedNode(StreamReader sr)
 {
     string line;
     CombinedNode combinedNode = new CombinedNode(0);
     do {
         line = sr.ReadLine ();
         if(line != null) {
             ANode newNode = ProcessString (sr, line);
             if(newNode != null) {
                 combinedNode.Nodes.Add(newNode);
                 if(newNode.Duration > combinedNode.Duration)
                     combinedNode.Duration = newNode.Duration;
             }
         }
     } while(line != "#END");
     return combinedNode;
 }
コード例 #12
0
 public UITransactionUnmerge(CombinedNode mergedNode, Connection[] newConnections)
 {
     this._mergedNode     = mergedNode;
     this._newConnections = newConnections;
 }