public void I_Want_To_See_The_Machine()
        {
            var machine = new GumballMachineWorkflow();
            var generator = new StateMachineGraphGenerator();

            string filename = Path.Combine(@"c:\temp\", string.Format("{0}.png", machine.GetType().Name)); //Path.Combine(Environment.SpecialFolder.ApplicationData.ToString(), "graph.png");
            generator.SaveGraphToFile(machine.GetGraphData(), 2560, 1920, filename);
        }
        public void I_Want_To_See_The_Machine()
        {
            var machine = new TrafficLightMachine();
            machine.RaiseEvent(TrafficLightMachine.SwitchedOn);
            var generator = new StateMachineGraphGenerator();

            string directoryPath = @"C:\Users\Barry Forrest\Documents\Visual Studio 2010\Projects\GumballStateMachine\";
            string filename = Path.Combine(directoryPath, string.Format("{0}.png", machine.GetType().Name));

            //Path.Combine(Environment.SpecialFolder.ApplicationData.ToString(), "graph.png");
            generator.SaveGraphToFile(machine.GetGraphData(), 2560, 1920, filename);
            generator.SaveGraphToFile(machine.LightState.GetGraphData(), 2560, 1920,
                Path.Combine(directoryPath, string.Format("{0}.png", machine.LightState.GetType().Name)));
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                var data = (StateMachineGraphData)objectProvider.GetObject();

                Graph graph = new StateMachineGraphGenerator().CreateGraph(data);

                using (var form = new GraphVisualizerForm(graph, "StateMachine Visualizer"))
                    windowService.ShowDialog(form);
            }
            catch (InvalidCastException)
            {
                MessageBox.Show("The selected data is not of a type compatible with this visualizer.",
                                GetType().ToString());
            }
        }
示例#4
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                var data = (StateMachineGraphData)objectProvider.GetObject();

                Graph graph = new StateMachineGraphGenerator().CreateGraph(data);

                using (var form = new GraphVisualizerForm(graph, "StateMachine Visualizer"))
                    windowService.ShowDialog(form);
            }
            catch (InvalidCastException)
            {
                MessageBox.Show("The selected data is not of a type compatible with this visualizer.",
                                GetType().ToString());
            }
        }