Пример #1
0
        private static void OnFinish(GraphResult result)
        {
            foreach (KeyValuePair <ConnectionPoint, GraphPath> pair in result)
            {
                var inPoint = pair.Key;
                var path    = pair.Value;
                Write(inPoint.GetCurrentColor());
                var first = true;

                foreach (var color in path.ColorPath)
                {
                    Write(first ? ": " : ", ");
                    first = false;

                    var first2 = true;
                    foreach (var c in color.DeMix())
                    {
                        Write(first2 ? "<" : ", ");
                        first2 = false;
                        Write(c);
                    }
                    Write(">");
                }
                Write("\n");
            }
            if (counter == 0)
            {
                counter++;
                //graph.ClearGraph();
                //graph.Start();
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private GraphResult getGraphResult(final java.util.Map<String,VirtualNodeHack> nodeMap, final java.util.Map<String,java.util.Set<VirtualRelationshipHack>> relationshipMap)
        private GraphResult GetGraphResult(IDictionary <string, VirtualNodeHack> nodeMap, IDictionary <string, ISet <VirtualRelationshipHack> > relationshipMap)
        {
            IList <Relationship> relationships = new LinkedList <Relationship>();

            foreach (ISet <VirtualRelationshipHack> relationship in relationshipMap.Values)
            {
                ((IList <Relationship>)relationships).AddRange(relationship);
            }

            GraphResult graphResult;

            graphResult = new GraphResult(new List <Node>(nodeMap.Values), relationships);

            return(graphResult);
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var txt = System.IO.File.ReadAllText("\\WorkingCurrent\\gv\\Network.gv");

            using (GraphResult g = GraphProvider.Generate(txt, "dot", "bmp"))
            {
                if (g != null)
                {
                    using (var bitmap = new Bitmap(g.Image.Width, g.Image.Height))
                    {
                        using (var gx = Graphics.FromImage(bitmap))
                        {
                            gx.DrawImage(g.Image, 0, 0);
                        }
                        bitmap.Save("\\WorkingCurrent\\gv\\test.jpg");
                    }
                }
            }
        }
Пример #4
0
        private async Task <GraphResult> GetGraphResultAsync(HttpResponseMessage response)
        {
            GraphResult graphResult = JsonConvert.DeserializeObject <GraphResult>(await response.Content.ReadAsStringAsync());

            if (!response.IsSuccessStatusCode)
            {
                if (graphResult != null && graphResult.errors.Any())
                {
                    throw new TicketAppException($"Error loading graph data from server. {graphResult.errors.First().message}");
                }
                else
                {
                    throw new TicketAppException($"The server returned status {(int)response.StatusCode}");
                }
            }

            if (graphResult?.errors?.Any() ?? false)
            {
                throw new TicketAppException($"Error response from GraphQL server. {graphResult.errors.First().message}");
            }

            return(graphResult);
        }
Пример #5
0
        private static void OnFinish(GraphResult result)
        {
            foreach (KeyValuePair<ConnectionPoint, GraphPath>  pair in result)
            {
                var inPoint = pair.Key;
                var path = pair.Value;
                Write(inPoint.GetCurrentColor());
                var first = true;

                foreach (var color in path.ColorPath)
                {
                    Write(first ? ": " : ", ");
                    first = false;

                    var first2 = true;
                    foreach (var c in color.DeMix())
                    {

                        Write(first2 ? "<" : ", ");
                        first2 = false;
                        Write(c);
                    }
                    Write(">");
                }
                Write("\n");
            }
            if (counter == 0)
            {
                counter++;
                //graph.ClearGraph();
                //graph.Start();
            }
        }