Ejemplo n.º 1
0
        private void SetGraph(GraphEmbedding graphEmbedding)
        {
            PauseButton_Click(null, null);
            this.RunAlgorithmButton.IsEnabled = true;
            this.StaticGraphCanvas.Children.Clear();
            this.GraphVisual = GraphVisual.Create(StaticGraphCanvas, NodeBrush, NumBrush, LineBrush, PenLineCap);
            foreach (var node in graphEmbedding.Graph.Nodes)
            {
                GraphVisual.AddNode(node, graphEmbedding.Embedding[node]);
            }
            foreach (var edge in graphEmbedding.Graph.Edges)
            {
                GraphVisual.AddEdge(edge);
            }
            var scaleViewStackPanel = new StackPanel();

            this.ScaleViewViewer.Content = scaleViewStackPanel;
            WeightsHandler.Create(scaleViewStackPanel, NodeBrush, LineBrush, GraphVisual.NodeWidth,
                                  GraphVisual.MinLineThickness,
                                  GraphVisual.MaxLineThickness, GraphVisual.MinWeight, GraphVisual.MaxWeight);
            var edges = EdgesHandler.Create(this.WeightsViewer);

            foreach (var edge in graphEmbedding.Graph.Edges)
            {
                edges.AddEdge(edge, active: false);
            }
        }
    public static bool Prefix(
        MechLabPanel ___mechLab,
        ref float ___currentTonnage,
        TextMeshProUGUI ___totalTonnage,
        UIColorRefTracker ___totalTonnageColor,
        TextMeshProUGUI ___remainingTonnage,
        UIColorRefTracker ___remainingTonnageColor)
    {
        try
        {
            var mechDef = ___mechLab.CreateMechDef();
            if (mechDef == null)
            {
                return(false);
            }

            WeightsHandler.AdjustInfoWidget(
                mechDef,
                ___remainingTonnageColor,
                ___totalTonnageColor,
                ___totalTonnage,
                ___remainingTonnage,
                out ___currentTonnage
                );
            return(false);
        }
        catch (Exception e)
        {
            Control.Logger.Error.Log(e);
        }
        return(true);
    }