示例#1
0
        private void UpdateNetwork()
        {
            Network network = Network;

            stackPanel1.Children.Clear();

            if (network == null) return;

            // Add Input Layer
            NetworkLayer layer = new NetworkLayer();
            layer.InputOnly = true;
            layer.Inputs = Network.InputsCount;
            layer.Layer = null;
            layer.Name = "Input";
            layer.Index = 0;
            stackPanel1.Children.Add(layer);

            // Add Hidden Layers
            for (int i = 0; i < network.Layers.Length; i++)
            {
                layer = new NetworkLayer();
                layer.InputOnly = false;
                layer.Layer = network.Layers[i] as ActivationLayer;
                layer.Name = "Hidden" + i;
                layer.Index = i + 1;
                layer.MouseLeftButtonDown += new MouseButtonEventHandler(Layer_MouseLeftButtonDown);
                stackPanel1.Children.Add(layer);
            }

            SelectedIndex = 1;
        }
示例#2
0
        private void UpdateIndex()
        {
            int selectedIndex = SelectedIndex;

            if (selectedIndex < 1 || selectedIndex > stackPanel1.Children.Count)
                return;

            if (selectedIndex >= stackPanel1.Children.Count)
                return;

            var element = stackPanel1.Children[selectedIndex];
            NetworkLayer current = (element as NetworkLayer);
            foreach (NetworkLayer layer in stackPanel1.Children)
            {
                layer.BorderBrush = Brushes.Transparent;
            }

            if (selectedIndex > 0)
            {
                current.BorderBrush = Brushes.Black;
            }
        }