public void DoWork(Card[] cards, ITrello trello, IDisplay display)
 {
     foreach (var card in cards.Select(x => new ReleaseNotesCard(x)))
     {
         display.Write(string.Format("{0} - {1}", card.Labels, card.Name));
     }
 }
        public CellularAutomataCanvas()
        {
            InitializeComponent();

            automataSpace.AllowDrop = true;

            this.DoubleBuffered = true;

            speedControl.Minimum = 1;
            speedControl.Maximum = 500;
            speedControl.LargeChange = 100;
            speedControl.SmallChange = 10;
            speedControl.Value = 200;
            speedControl.AutoToolTip = true;
            speedControl.TrackBar.TickFrequency = 50;
            speedControl.ToolTipText = string.Format("{0}ms", speedControl.Value);
            speedValueLabel.Text = speedControl.ToolTipText;

            _display = new Monitor(10);

            Size trueSize = automataSpace.ClientSize;
            trueSize.Height /= _display.Ratio;
            trueSize.Width /= _display.Ratio;

            //_environment = new CAEnvironment(trueSize, false, "CellularAutomation", "BaseAutomation", new object[] { (byte) 1 });
            _environment = new CAEnvironment(trueSize, false, "GameOfLife", "Moore", null);

            AttachEvents();
        }
Esempio n. 3
0
        public void DrawEditSymbol(IGeometry geometry, IDisplay display)
        {
            IEngineEditProperties engineProperty = new EngineEditorClass();

            ISymbol pointSymbol = engineProperty.SketchVertexSymbol as ISymbol;
            ISymbol sketchSymbol = engineProperty.SketchSymbol as ISymbol;

            ITopologicalOperator pTopo = geometry as ITopologicalOperator;

            sketchSymbol.SetupDC(display.hDC, display.DisplayTransformation);
            sketchSymbol.Draw(pTopo.Boundary);

            IPointCollection pointCol = geometry as IPointCollection;
            for (int i = 0; i < pointCol.PointCount; i++)
            {
                IPoint point = pointCol.get_Point(i);
                pointSymbol.SetupDC(display.hDC, display.DisplayTransformation);
                pointSymbol.Draw(point);
                pointSymbol.ResetDC();
            }

            ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(sketchSymbol);
            ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pointSymbol);
            ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(engineProperty);
        }
Esempio n. 4
0
        public Register(IBasket basket, IDisplay display, IScanner scanner)
        {
            logger = LoggerFactory.GetLogger();

            this.basket = basket;
            this.display = display;
            this.scanner = scanner;

            basket.OnAdd += display.AddProduct;
            basket.AddSuccess += scanner.FlashLed;
            basket.AddFail += scanner.FlashLed;
            basket.OnUpdate += display.UpdateProduct;
            basket.OnRemove += display.RemoveProduct;
            basket.OnUpdateTotalCost += display.UpdateTotalCost;
            basket.OnUpdateProductCount += display.UpdateProductCount;

            display.OnStartScan += scanner.Start;
            display.OnStopScan += scanner.Stop;
            display.OnClear += basket.Clear;

            scanner.OnRead += new OnReadHandler(scanner_OnRead);

            logger.Write("Register", LogLevel.INFO, "Register initialized");

            display.Display();
        }
        public BorrowController(IDisplay display, ICardReader reader, IScanner scanner, IPrinter printer,
                                    IBookDAO bookDAO, ILoanDAO loanDAO, IMemberDAO memberDAO)
        {
            if(display == null) throw new ArgumentException("Display object was not provided to begin the application");
            if (reader == null) throw new ArgumentException("Reader object was not provided to begin the application");
            if (scanner == null) throw new ArgumentException("Scanner object was not provided to begin the application");
            if (printer == null) throw new ArgumentException("Printer object was not provided to begin the application");
            if (bookDAO == null) throw new ArgumentException("BookDAO object was not provided to begin the application");
            if (loanDAO == null) throw new ArgumentException("LoanDAO object was not provided to begin the application");
            if (memberDAO == null) throw new ArgumentException("MemberDAO object was not provided to begin the application");

            _display = display;
            _reader = reader;
            _scanner = scanner;
            _printer = printer;

            _bookDAO = bookDAO;
            _loanDAO = loanDAO;
            _memberDAO = memberDAO;

            _ui = new BorrowControl(this);

            _reader.Listener = this;
            _scanner.Listener = this;

            _bookList = new List<IBook>();
            _loanList = new List<ILoan>();

            _state = EBorrowState.CREATED;
        }
Esempio n. 6
0
 public void render(IDisplay display)
 {
     this.display = display;
     display.imageBegin(imageWidth, imageHeight, 32);
     // set members variables
     bucketCounter = 0;
     // start task
     SunflowSharp.Systems.Timer timer = new SunflowSharp.Systems.Timer();
     timer.start();
     BucketThread[] renderThreads = new BucketThread[scene.getThreads()];
     for (int i = 0; i < renderThreads.Length; i++)
     {
         renderThreads[i] = new BucketThread(this);
         renderThreads[i].setPriority(scene.getThreadPriority());
         renderThreads[i].start();
     }
     for (int i = 0; i < renderThreads.Length; i++)
     {
         try
         {
             renderThreads[i].join();
         }
         catch (Exception e)
         {
             UI.printError(UI.Module.BCKT, "Bucket processing thread {0} of {1} was interrupted", i + 1, renderThreads.Length);
         }
     }
     timer.end();
     UI.printInfo(UI.Module.BCKT, "Render time: {0}", timer.ToString());
     display.imageEnd();
 }
 public DisplayHandler(IDisplay _display)
 {
   this.display = _display;
   this.heightInChars = Settings.Instance.TextHeight;
   if (this.heightInChars == 1)
   {
     this.heightInCharsSim = 2;
   }
   else
   {
     this.heightInCharsSim = this.heightInChars;
   }
   this.widthInChars = Settings.Instance.TextWidth;
   this.pixelsToScroll = Settings.Instance.PixelsToScroll;
   this.widthInPixels = Settings.Instance.GraphicWidth;
   this.heightInPixels = Settings.Instance.GraphicHeight;
   this.charsToScroll = Settings.Instance.CharsToScroll;
   this.forceGraphicText = Settings.Instance.ForceGraphicText;
   this.lines = new Line[this.heightInCharsSim];
   this.prevLines = new string[this.heightInChars];
   this.posSkips = new int[this.heightInChars];
   this.pos = new int[this.heightInChars];
   font = new Font(Settings.Instance.Font, (float)Settings.Instance.FontSize);
   for (int i = 0; i < this.heightInCharsSim; i++)
   {
     this.lines[i] = new Line();
   }
   for (int i = 0; i < this.heightInChars; i++)
   {
     this.pos[i] = 0;
   }
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="AbsoluteLayoutWithDisplayInfoPage" /> class.
		/// </summary>
		/// <param name="display">The display.</param>
		public AbsoluteLayoutWithDisplayInfoPage(IDisplay display)
		{
			this.Title = "Absolute Layout With Display Info";
			var abs = new AbsoluteLayout();
			var inchX = display.WidthRequestInInches(1);
			var inchY = display.HeightRequestInInches(1);
			var originX = display.WidthRequestInInches(display.ScreenWidthInches() / 2);
			var originY = display.HeightRequestInInches(display.ScreenHeightInches() / 2);

			abs.Children.Add(new Label() { Text = "1\"x\"1\" blue frame" });

			abs.Children.Add(new Frame()
				{
					BackgroundColor = Color.Navy,
				},
				new Rectangle(originX - inchX/2, originY - inchY/2, inchX, inchY));

			abs.Children.Add(new Frame()
				{
					BackgroundColor = Color.White
				},
				new Rectangle(originX - inchX/16, originY - inchY/16, inchX/8, inchY/8));

			this.Content = abs;
		}
Esempio n. 9
0
 private static void SetupPlugins()
 {
     _display = PluginLoader.Displays.First(d => d.PluginName == Settings.Default.DisplayPluginName);
     _configurationGenerator = PluginLoader.ConfigurationGenerators.First(g => g.PluginName == Settings.Default.GeneratorPluginName);
     _solver = PluginLoader.Solvers.First(s => s.PluginName == Settings.Default.SolverPluginName);
     _celebrator = PluginLoader.Celebrators.First(c => c.PluginName == Settings.Default.CelebratorPluginName);
 }
Esempio n. 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Clean up previous contents
            clearFormControls();

            // Determine which species the user wants (see code below)
            String speciesName = getCheckedSpecies();

            // Get a List of the relevant Critters from the catalogue
            // YOU WILL NEED TO WRITE THE CRITTERQUERY METHOD
            List<Critter> selectedCritters = mainCatalogue.CritterQuery(speciesName);
            int critterCount = selectedCritters.Count;

            if (critterCount == 0)
            {
                MessageBox.Show("No critters of that species");
            }
            else
            {
                if (critterCount > pictureBoxList.Count)
                    displayMachine = textDisplayMachine;    // Will show images
                else
                    displayMachine = pictureDisplayMachine; // Will print text

                // clear any old contents. Part of IDisplay, so the Form knows it will work
                displayMachine.clearDisplay();

                // Make the call here. Behaviour will depend on which strategy your
                // instance implements.
                displayMachine.displayCritterList(selectedCritters);
            }
        }
Esempio n. 11
0
        public ChatUser(string username, IDisplay display)
        {
            if (username == null) 
                throw new Exception("Username is null");
            Username = username;

            Display = display;
        }
Esempio n. 12
0
 public SolveRun(ICubeConfigurationGenerator generator, ISolver solver, IDisplay display, ICelebrator celebrator, int cubeSize)
 {
     m_display = display;
     m_celebrator = celebrator;
     m_solver = solver;
     m_generator = generator;
     m_cubeSize = cubeSize;
 }
Esempio n. 13
0
File: CPU.cs Progetto: perfp/Chip8
        public CPU(Memory memory, IDisplay display, IKeyboard keyboard)
        {
            this.memory = memory;
            this.display = display;
            this.keyboard = keyboard;
            this.DelayTimer = new SimpleTimer();
            this.SoundTimer = new SimpleTimer();

            this.RandomFunc = this.RandomGenerator;

            InstructionSet[0x0] = SYS;
            InstructionSet[0x1] = JP;
            InstructionSet[0x2] = CALL;
            InstructionSet[0x3] = SE;
            InstructionSet[0x4] = SNE;
            InstructionSet[0x5] = SEV;
            InstructionSet[0x6] = LD;
            InstructionSet[0x7] = ADD;
            InstructionSet[0x8] = REG;
            InstructionSet[0x9] = SNEV;
            InstructionSet[0xA] = LDI;
            InstructionSet[0xB] = JPV;
            InstructionSet[0xC] = RND;
            InstructionSet[0xD] = DRW;
            InstructionSet[0xE] = SKP;
            InstructionSet[0xF] = LDS;

            // used with REG
            RegisterCommands[0x0] = (x, y) => Register[x] = Register[y];
            RegisterCommands[0x1] = (x, y) => Register[x] |= Register[y];
            RegisterCommands[0x2] = (x, y) => Register[x] &= Register[y];
            RegisterCommands[0x3] = (x, y) => Register[x] ^= Register[y];
            RegisterCommands[0x4] = (x, y) =>
                {
                    Register[0xf] = (byte)((Register[x] + Register[y]) > 0xff ? 1 : 0);
                    Register[x] += Register[y];
                };
            RegisterCommands[0x5] = (x, y) =>
                                        {
                                            Register[0xf] = (byte) (Register[x] > Register[y] ? 1 : 0);
                                            Register[x] -= Register[y];
                                        };
            RegisterCommands[0x6] = (x, y) =>
                                        {
                                            Register[0xf] = (byte) (Register[x] & 0x1);
                                            Register[x] = (byte) (Register[x] >> 1);
                                        };
            RegisterCommands[0x7] = (x, y) =>
            {
                Register[0xf] = (byte)(Register[x] < Register[y] ? 1 : 0);
                Register[x] = (byte) (Register[y] - Register[x]);
            };
            RegisterCommands[0xe] = (x, y) =>
            {
                Register[0xf] = (byte)(Register[x] >> 7);
                Register[x] = (byte)(Register[x] << 1);
            };
        }
        public CoinChanger(IDisplay d, CoinStorage changeBox)
        {
            brain = new CircuitBoard();
            coinID = new CoinIdentify();
            storage = new CoinStorage();

            display = d;
            returnChange = changeBox;
        }
 public void Dispose()
 {
     _display = null;
     _reader = null;
     _scanner = null;
     _printer = null;
     _bookDao = null;
     _loanDao = null;
     _memberDao = null;
 }
Esempio n. 16
0
        public void DoWork(Card[] cards, ITrello trello, IDisplay display)
        {
            display.Skip();
            display.Write("Archiving cards...");

            foreach (var card in cards)
            {
                trello.Cards.Archive(card);
            }
        }
 public BorrowControlTests()
 {
     _display = Substitute.For<IDisplay>();
     _reader = Substitute.For<ICardReader>();
     _scanner = Substitute.For<IScanner>();
     _printer = Substitute.For<IPrinter>();
     _bookDao = Substitute.For<IBookDAO>();
     _loanDao = Substitute.For<ILoanDAO>();
     _memberDao = Substitute.For<IMemberDAO>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="FontManagerPage"/> class.
        /// </summary>
        /// <param name="display">The display.</param>
        /// <param name="fontManager">The font manager.</param>
        public FontManagerPage(IDisplay display, IFontManager fontManager)
        {
            var stack = new StackLayout();

            foreach (var namedSize in Enum.GetValues(typeof(NamedSize)))
            {
                var font = Font.SystemFontOfSize((NamedSize)namedSize);

                var height = fontManager.GetHeight(font);

                var heightRequest = display.HeightRequestInInches(height);

                var label = new Label()
                {
                    Font = font,
                    HeightRequest = heightRequest + 10,
                    Text = string.Format("System font {0} is {1:0.000}in tall.", namedSize, height),
                    XAlign = TextAlignment.Center
                };

                stack.Children.Add(label);
            }

            var f = Font.SystemFontOfSize(24);

            var inchFont = fontManager.FindClosest(f.FontFamily, fontSize);

            stack.Children.Add(new Label()
            {
                Text = "The below text should be " + fontSize + "in height from its highest point to lowest.",
                XAlign = TextAlignment.Center
            });


            stack.Children.Add(new Label()
            {
                Text = "FfTtLlGgJjPp",
                TextColor = Color.Lime,
                FontSize = inchFont.FontSize,
//                BackgroundColor = Color.Gray,
//                FontFamily = inchFont.FontFamily,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Start
            });


            stack.Children.Add(new Label()
            {
                Text = fontSize + "in height = SystemFontOfSize(" + inchFont.FontSize + ")",
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.End
            });

            this.Content = stack;
        }
        public Scenario04CompleteScans()
        {
            _bookDao = new BookDao(new BookHelper());
            _loanDao = new LoanDao(new LoanHelper());
            _memberDao = new MemberDao(new MemberHelper());

            _display = new MainWindow();
            _reader = new CardReader();
            _scanner = new Scanner();
            _printer = new Printer();
        }
Esempio n. 20
0
        public ChatRoom(string chatRoomName, ChatUser user)
        {
            if (chatRoomName == null) 
                throw new Exception("Chat room name is null");
            _chatRoomName = chatRoomName;
            _usersList.Add(user.Username, user);

            _newMessages.Add(user.Username, "");

            _display = new RoomDisplay();
        }
Esempio n. 21
0
        public Chip8Cpu(IDisplay display, IRandomizer randomizer, IKeyboard keyboard, IBcdConverter bcdConverter, IInstructionDecoder instructionDecoder, ITimerClock timerClock)
        {
            _display = display;
            _randomizer = randomizer;
            _keyboard = keyboard;
            _bcdConverter = bcdConverter;
            _instructionDecoder = instructionDecoder;
            _timerClock = timerClock;

            State = new CpuState();
        }
Esempio n. 22
0
 public void Run(IGraph g, IDisplay d)
 {
     IVertex v = g.vertexes()[0];
     v.setMark (true);
     foreach (IEdge e in v.edges()) {
         e.setMark (true);
         e.vto().setMark (true);
         d.update();
     }
     System.Console.WriteLine ("I am ok!");
 }
        public Scenario02SwipeBorrowerCard()
        {
            _bookDao = new BookDao(new BookHelper());
            _loanDao = new LoanDao(new LoanHelper());
            _memberDao = new MemberDao(new MemberHelper());

            _display = new MainWindow();
            _reader = new CardReader();
            _scanner = new Scanner();
            _printer = new Printer();
        }
        public BorrowControlIntegration()
        {
            _bookDao = new BookDao(new BookHelper());
            _loanDao = new LoanDao(new LoanHelper());
            _memberDao = new MemberDao(new MemberHelper());

            _display = new MainWindow();
            _reader = new CardReader();
            _scanner = new Scanner();
            _printer = new Printer();
        }
        public void DoWork(Card[] cards, ITrello trello, IDisplay display)
        {
            var cardsGroupedByLabel = cards
                                        .Select(x => new ReleaseNotesCard(x))
                                        .GroupBy(x => x.Labels)
                                        .ToArray();

            File.WriteAllText(_options.Output,
                              Razor.Parse(File.ReadAllText(_options.Template),
                                          new { _options.SoftwareName, _options.SoftwareVersion, Groups = cardsGroupedByLabel }));
        }
Esempio n. 26
0
            protected override void Context()
            {
                base.Context();

                Display = A.Fake<IDisplay>();
                InputMonitor = A.Fake<IInputMonitor>();
                Calculator = A.Fake<IStringCalculator>();

                Sut = new Program(Display, InputMonitor, Calculator);
                Sut.Initialize();
            }
        public DisplayTimingViewModel(IGameBoy gameboy, IDisplay display, IDispatcher dispatcher)
        {
            _gameBoy = gameboy;
              _display = display;
              //_gameBoy.FrameCompleted += OnFrameCompleted;
              _dispatcher = dispatcher;

              var disDef = _display.GetDisplayDefinition();
              _displayTiming = new WriteableBitmap(disDef.TimingPixelCountX, disDef.TimingPixelCountY,
                                           96, 96, PixelFormats.Bgra32, null);
        }
        public BorrowController(IDisplay display, ICardReader reader, IScanner scanner, IPrinter printer,
                                    IBookDAO bookDAO, ILoanDAO loanDAO, IMemberDAO memberDAO)
        {
            _display = display;
            _reader = reader;
            _scanner = scanner;
            _printer = printer;

            _ui = new BorrowControl(this);

            _state = EBorrowState.CREATED;
        }
        public MainMenuController(IDisplay display, ICardReader reader, IScanner scanner, IPrinter printer,
                                    IBookDAO bookDAO, ILoanDAO loanDAO, IMemberDAO memberDAO)
        {
            _display = display;
            _reader = reader;
            _scanner = scanner;
            _printer = printer;

            _bookDAO = bookDAO;
            _loanDAO = loanDAO;
            _memberDAO = memberDAO;
        }
 public RandomDisplay(IDisplay impl) : base(impl)
 {
     ;
 }
Esempio n. 31
0
 public void SetUp()
 {
     _itemFactory = new ItemFactory();
     _receipt     = new Receipt();
     _checkout    = new CheckOut(_receipt);
 }
Esempio n. 32
0
 public static void display(IDisplay display)
 {
     Console.WriteLine("Displaying:" + display.getContent());
 }
Esempio n. 33
0
        public void Draw(IStepProgressor stepProgressor,
                         IActiveView activeView,
                         FileCache fileCache,
                         ITrackCancel trackCancel,
                         ISpatialReference layerSpatialReference,
                         ref string currentLevel, ITileSource tileSource, IDisplay display)
        {
            _tileSource            = tileSource;
            _trackCancel           = trackCancel;
            _layerSpatialReference = layerSpatialReference;
            _currentLevel          = currentLevel;
            _fileCache             = fileCache;
            _tileProvider          = (WebTileProvider)tileSource.Provider;
            var spatialReferences = new SpatialReferences();

            _dataSpatialReference = spatialReferences.GetSpatialReference(tileSource.Schema.Srs);

            //var fetcher = new FileFetcher<Image>(osmTileSource, fileCache);

            _display = display;

            if (!activeView.Extent.IsEmpty)
            {
                _tiles       = GetTiles(activeView);
                currentLevel = _currentLevel;
                Logger.Debug("Number of tiles to draw: " + _tiles.Count);

                if (_tiles.ToList().Count > 0)
                {
                    stepProgressor.MinRange = 0;
                    stepProgressor.MaxRange = _tiles.ToList().Count;
                    stepProgressor.Show();

                    var downloadFinished = new ManualResetEvent(false);

                    // this is a hack, otherwise we get error message...
                    // "WaitAll for multiple handles on a STA thread is not supported. (mscorlib)"
                    // so lets start a thread first...
                    var t = new Thread(DownloadTiles);
                    t.Start(downloadFinished);

                    // wait till finished
                    downloadFinished.WaitOne();

                    // 3. Now draw all tiles...

                    if (layerSpatialReference != null && _dataSpatialReference != null)
                    {
                        _needReproject = (layerSpatialReference.FactoryCode != _dataSpatialReference.FactoryCode);
                    }
                    Logger.Debug("Need reproject tile: " + _needReproject.ToString());

                    foreach (var tile in _tiles)
                    {
                        stepProgressor.Step();

                        if (tile != null)
                        {
                            var name = _fileCache.GetFileName(tile.Index);

                            if (!File.Exists(name))
                            {
                                continue;
                            }
                            DrawRaster(name);
                        }
                    }

                    stepProgressor.Hide();
                }
                else
                {
                    Logger.Debug("No tiles to retrieve or draw");
                }

                Logger.Debug("End drawing tiles: " + _tiles.ToList().Count);
            }
        }
Esempio n. 34
0
 public IEnumElement get_Graphics(IDisplay Display, object Data)
 {
     return(((this.m_pGroupElement as IClone).Clone() as IGroupElement).Elements);
 }
Esempio n. 35
0
 public void Activate(IDisplay Display)
 {
     this.m_pGroupElement.Activate(Display);
 }
 void dynamicMapEvents_AfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay)
 {
     if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers)
     {
         return;
     }
     DrawDynamicLogo(dynamicDisplay);
 }
Esempio n. 37
0
 public void FinishDrawing(IDisplay disp, ICancelTracker cancelTracker)
 {
 }
Esempio n. 38
0
 public void Setup()
 {
     _uut = new Display();
 }
 public MySystem(IForm form, IDisplay display) //Tak się nazywa bo "System" to ogólny namespace i się gubił
 {
     this.Form    = form;
     this.Display = display;
 }
Esempio n. 40
0
 public VisualsTextEditAction(Func <IGraphScene <IVisual, IVisualEdge> > sceneHandler,
                              IDisplay display, ICamera camera,
                              IGraphSceneLayout <IVisual, IVisualEdge> layout) : base(sceneHandler, display, camera, layout)
 {
     this.displayBackend = display.Backend as ContainerControl;
 }
Esempio n. 41
0
 public Clock()
 {
     display = new Display();
 }
Esempio n. 42
0
        public LabelAppendResult TryAppend(IDisplay display, List <IAnnotationPolygonCollision> aPolygons, IGeometry geometry, bool checkForOverlap)
        {
            bool outside = true;
            IAnnotationPolygonCollision labelPolyon = null;
            IEnvelope labelPolyonEnvelope           = null;

            if (aPolygons != null)
            {
                foreach (IAnnotationPolygonCollision polyCollision in aPolygons)
                {
                    AnnotationPolygonEnvelope env = polyCollision.Envelope;

                    int minx = (int)Math.Max(0, env.MinX);
                    int maxx = (int)Math.Min(_bm.Width - 1, env.MaxX);
                    int miny = (int)Math.Max(0, env.MinY);
                    int maxy = (int)Math.Min(_bm.Height, env.MaxY);

                    if (minx > _bm.Width || maxx <= 0 || miny > _bm.Height || maxy <= 0)
                    {
                        continue;                                                                   // liegt außerhalb!!
                    }
                    outside = false;

                    if (!_first && checkForOverlap)
                    {
                        if (_method == OverlapMethod.Pixel)
                        {
                            #region Pixel Methode

                            for (int x = minx; x < maxx; x++)
                            {
                                for (int y = miny; y < maxy; y++)
                                {
                                    //if (x < 0 || x >= _bm.Width || y < 0 || y >= _bm.Height) continue;

                                    if (polyCollision.Contains(x, y))
                                    {
                                        //_bm.SetPixel(x, y, Color.Yellow);
                                        if (_bm.GetPixel(x, y) != _back)
                                        {
                                            return(LabelAppendResult.Overlap);
                                        }
                                    }
                                }
                            }

                            #endregion
                        }
                        else
                        {
                            #region Geometrie Methode
                            labelPolyon = polyCollision;
                            foreach (List <IAnnotationPolygonCollision> indexedPolygons in _gridArrayPolygons.Collect(new Envelope(env.MinX, env.MinY, env.MaxX, env.MaxY)))
                            {
                                foreach (IAnnotationPolygonCollision lp in indexedPolygons)
                                {
                                    if (lp.CheckCollision(polyCollision) == true)
                                    {
                                        return(LabelAppendResult.Overlap);
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                    else
                    {
                        _first = false;

                        if (_method == OverlapMethod.Geometry)
                        {
                            #region Geometrie Methode
                            labelPolyon = polyCollision;
                            #endregion
                        }
                    }
                    labelPolyonEnvelope = new Envelope(env.MinX, env.MinY, env.MaxX, env.MaxY);
                }
                if (outside)
                {
                    return(LabelAppendResult.Outside);
                }
            }


            if (labelPolyon != null)
            {
                List <IAnnotationPolygonCollision> indexedPolygons = _gridArrayPolygons[labelPolyonEnvelope];
                indexedPolygons.Add(labelPolyon);
            }

            return(LabelAppendResult.Succeeded);
        }
Esempio n. 43
0
 public Portfolio(string name, IDisplay display)
 {
     this.name = name;
     _display  = display;
 }
Esempio n. 44
0
 public ChargeControl(IUsbCharger charger, IDisplay display)
 {
     this._charger = charger;
     this._display = display;
     this._charger.CurrentValueEvent += chargerCurrent_CurrentValueEvent;
 }
Esempio n. 45
0
        public Cpu(IMemory memory, IRegisterBank registerBank, IRandomService randomService, IDisplay display)
        {
            _memory        = memory;
            _registerBank  = registerBank;
            _randomService = randomService;
            _display       = display;

            _registerBank.Initialise();
        }
Esempio n. 46
0
 public void Awake()
 {
     //SoundManager.Initialize();
     display = transform.parent.GetComponentInChildren <IDisplay>();
 }
Esempio n. 47
0
 public void Draw(IDisplay Display, ITrackCancel TrackCancel)
 {
     this.m_pGroupElement.Draw(Display, TrackCancel);
 }
Esempio n. 48
0
        public static MathListIndex?IndexForPoint <TFont, TGlyph>
            (this ListDisplay <TFont, TGlyph> self, TypesettingContext <TFont, TGlyph> context, PointF point)
            where TFont : IFont <TGlyph>
        {
            // The origin of for the subelements of a MathList is the current position,
            // so translate the current point to our origin.
            var translatedPoint = new PointF(point.X - self.Position.X, point.Y - self.Position.Y);

            IDisplay <TFont, TGlyph>?closest = null;
            var   xbounds     = new List <IDisplay <TFont, TGlyph> >();
            float minDistance = float.MaxValue;

            foreach (var display in self.Displays)
            {
                var bounds     = display.DisplayBounds();
                var rect       = new RectangleF(display.Position, bounds.Size);
                var maxBoundsX = rect.Right;
                if (rect.X - PixelDelta <= translatedPoint.X && translatedPoint.X <= maxBoundsX + PixelDelta)
                {
                    xbounds.Add(display);
                }
                var distance = DistanceFromPointToRect(translatedPoint, rect);
                if (distance < minDistance)
                {
                    closest     = display;
                    minDistance = distance;
                }
            }
            IDisplay <TFont, TGlyph>?displayWithPoint;

            switch (xbounds.Count)
            {
            case 0:
                if (translatedPoint.X <= -PixelDelta)
                {
                    // All the way to the left
                    return(self.Range.Location < 0
                   ? null
                   : MathListIndex.Level0Index(self.Range.Location));
                }
                else if (translatedPoint.X >= self.Width + PixelDelta)
                {
                    // if closest is a script
                    if (closest is ListDisplay <TFont, TGlyph> ld && ld.LinePosition != LinePosition.Regular)
                    {
                        // then we try to find its parent
                        var parent = self.Displays.FirstOrDefault(d => d.HasScript && d.Range.Contains(ld.IndexInParent));
                        if (parent != null)
                        {
                            return(MathListIndex.Level0Index(parent.Range.End));
                        }
                    }
                    // All the way to the right
                    return
                        (self.Range.End < 0
              ? null
              : self.Displays.Count == 1 &&
                         self.Displays[0] is TextLineDisplay <TFont, TGlyph> {
                        Atoms : var atoms
                    } &&
                         atoms.Count == 1 &&
                         atoms[0] is Atom.Atoms.Placeholder
              ? MathListIndex.Level0Index(self.Range.Location)
                         : MathListIndex.Level0Index(self.Range.End));
                }
Esempio n. 49
0
 public Charger(IUsbCharger usbCharger, IDisplay display)
 {
     _usbCharger = usbCharger;
     _display    = display;
     usbCharger.CurrentValueEvent += HandleCurrentChangedEvent;
 }
Esempio n. 50
0
        public StationControl(IRfidReader RfidReader, IDoor door, IChargeControl charger, IDisplay display, ILogFile logFile)
        {
            _door       = door;
            _charger    = charger;
            _display    = display;
            _rfidReader = RfidReader;
            _logFile    = logFile;

            //this method:HandleRfidDetectedEvent & m.m will be called when new data are ready
            _rfidReader.RfidReaderEvent += HandleRfidDetectedEvent;
            _door.DoorChangedEvent      += HandleDoorStatusEvent;

            _state = LadeskabState.Available;
        }
Esempio n. 51
0
 public KeyValueSystem()
 {
     Form    = new KeyValueForm();
     Display = new KeyValueDisplay();
 }
Esempio n. 52
0
 public DisplayAdapter(IDisplay display)
 {
     _display = display;
 }
Esempio n. 53
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                //Declare variables
                clsSnippet  pSnippet     = new clsSnippet();
                string      strLayerName = cboSourceLayer.Text;
                IActiveView pActiveView  = ArcMap.Document.ActiveView;

                int    intLIndex = pSnippet.GetIndexNumberFromLayerName(pActiveView, strLayerName);
                ILayer pLayer    = pActiveView.FocusMap.get_Layer(intLIndex);

                IFeatureLayer pFLayer = pLayer as IFeatureLayer;
                ESRI.ArcGIS.Geodatabase.IFeatureClass pFClass = pFLayer.FeatureClass;

                string strOriRenderField    = cboValueField.Text;
                string strUncernRenderField = cboUField.Text;
                double dblMinPtSize         = Convert.ToDouble(nudSymbolSize.Value);

                //Create New Layer?
                IGeoFeatureLayer pGeofeatureLayer = null;
                if (chkNewLayer.Checked == true)
                {
                    IFeatureLayer pflOutput = new FeatureLayerClass();
                    pflOutput.FeatureClass = pFClass;
                    pflOutput.Name         = txtNewLayer.Text;
                    pflOutput.Visible      = true;
                    pGeofeatureLayer       = (IGeoFeatureLayer)pflOutput;
                }
                else
                {
                    pGeofeatureLayer = (IGeoFeatureLayer)pFLayer;
                }

                //Find Fields
                ITable pTable       = (ITable)pFClass;
                int    intOriIdx    = pTable.FindField(strOriRenderField);
                int    intUncernIdx = pTable.FindField(strUncernRenderField);

                //Find Min and Max Ori Value
                IField          pOriField = pTable.Fields.get_Field(intOriIdx);
                ICursor         pCursor   = pTable.Search(null, true);
                IDataStatistics pDataStat = new DataStatisticsClass();
                pDataStat.Field  = pOriField.Name;
                pDataStat.Cursor = pCursor;
                IStatisticsResults pStatResults   = pDataStat.Statistics;
                double             dblMinOriValue = pStatResults.Minimum;
                double             dblMaxOriValue = pStatResults.Maximum;
                pCursor.Flush();

                //Find Min and Max Uncern Vale
                IField pUncernField = pTable.Fields.get_Field(intUncernIdx);
                pCursor          = pTable.Search(null, true);
                pDataStat        = new DataStatisticsClass();
                pDataStat.Field  = pUncernField.Name;
                pDataStat.Cursor = pCursor;
                pStatResults     = pDataStat.Statistics;
                double dblMinUncernValue = pStatResults.Minimum;
                double dblMaxUncernValue = pStatResults.Maximum;

                pCursor.Flush();

                //To adjust minn value to 1, if the min value is zero
                double dbladjuctMinvalue = 0;
                if (dblMinOriValue <= 0)
                {
                    dbladjuctMinvalue = (0 - dblMinOriValue) + 1;
                    dblMinOriValue    = dblMinOriValue + dbladjuctMinvalue;
                }

                IDisplay pDisplay = pActiveView.ScreenDisplay;

                IRgbColor pSymbolRgb = new RgbColorClass();
                pSymbolRgb.Red   = picSymbolColor.BackColor.R;
                pSymbolRgb.Green = picSymbolColor.BackColor.G;
                pSymbolRgb.Blue  = picSymbolColor.BackColor.B;

                IRgbColor pLineRgb = new RgbColorClass();
                pLineRgb.Red   = picLineColor.BackColor.R;
                pLineRgb.Green = picLineColor.BackColor.G;
                pLineRgb.Blue  = picLineColor.BackColor.B;

                int intMethods = 0;
                if (cboMethods.Text == "Saturation")
                {
                    intMethods = 1;
                }
                else if (cboMethods.Text == "Value")
                {
                    intMethods = 2;
                }
                else if (cboMethods.Text == "Whiteness")
                {
                    intMethods = 3;
                }

                IColoringProperties pPreUncern = new ColoringPropClass2();
                //IColoringProperties pPreUncern = new ColoringProp();
                pPreUncern.m_intMethods           = intMethods;
                pPreUncern.m_intOriLegendCount    = 3; //Needs to be changed
                pPreUncern.m_intUncernLegendCount = 3; //Needs to be changed


                pPreUncern.m_strOriRenderField    = strOriRenderField;
                pPreUncern.m_strUncernRenderField = strUncernRenderField;

                pPreUncern.m_pSymbolRgb          = pSymbolRgb;
                pPreUncern.m_pLineRgb            = pLineRgb;
                pPreUncern.m_dblOutlineSize      = Convert.ToDouble(nudLinewidth.Value);
                pPreUncern.m_dblAdjustedMinValue = dbladjuctMinvalue;
                pPreUncern.m_dblMinOriValue      = dblMinOriValue;
                pPreUncern.m_dblMaxOriValue      = dblMaxOriValue;
                pPreUncern.m_dblMinUncernValue   = dblMinUncernValue;
                pPreUncern.m_dblMaxUncernValue   = dblMaxUncernValue;
                pPreUncern.m_dblMinPtSize        = dblMinPtSize;

                pPreUncern.CreateLegend();
                pGeofeatureLayer.Renderer = (IFeatureRenderer)pPreUncern;


                if (chkNewLayer.Checked == true)
                {
                    pActiveView.FocusMap.AddLayer(pGeofeatureLayer);
                }
                else
                {
                    pFLayer = (IFeatureLayer)pGeofeatureLayer;
                }

                pActiveView.ContentsChanged();
                pActiveView.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unexpected Error");
                return;
            }
        }
        public void FlashGeometry(ESRI.ArcGIS.Geometry.IGeometry geometry)
        {
            IRgbColor color = Globals.FlashFeatureColor;

            IDisplay display = (IDisplay)mDoc.ActiveView.ScreenDisplay;

            Int32 delay = Globals.FlashFeatureDelay;

            if (geometry == null || color == null || display == null)
            {
                return;
            }
            display.StartDrawing(display.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast

            switch (geometry.GeometryType)
            {
            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
            {
                //Set the flash geometry's symbol.
                ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
                simpleFillSymbol.Color = color;
                ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol;         // Dynamic Cast
                symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
                //Flash the input polygon geometry.
                display.SetSymbol(symbol);
                display.DrawPolygon(geometry);
                System.Threading.Thread.Sleep(delay);
                display.DrawPolygon(geometry);
                break;
            }

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
            {
                //Set the flash geometry's symbol.
                ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
                simpleLineSymbol.Width = 4;
                simpleLineSymbol.Color = color;
                ESRI.ArcGIS.Display.ISymbol symbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol;         // Dynamic Cast
                symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
                //Flash the input polyline geometry.
                display.SetSymbol(symbol);
                display.DrawPolyline(geometry);
                System.Threading.Thread.Sleep(delay);
                display.DrawPolyline(geometry);
                break;
            }

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
            {
                //Set the flash geometry's symbol.
                ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
                simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
                simpleMarkerSymbol.Size  = 12;
                simpleMarkerSymbol.Color = color;
                ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol;         // Dynamic Cast
                symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
                //Flash the input point geometry.
                display.SetSymbol(symbol);
                display.DrawPoint(geometry);
                System.Threading.Thread.Sleep(delay);
                display.DrawPoint(geometry);
                break;
            }

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
            {
                //Set the flash geometry's symbol.
                ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
                simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
                simpleMarkerSymbol.Size  = 12;
                simpleMarkerSymbol.Color = color;
                ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol;         // Dynamic Cast
                symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
                //Flash the input multipoint geometry.
                display.SetSymbol(symbol);
                display.DrawMultipoint(geometry);
                System.Threading.Thread.Sleep(delay);
                display.DrawMultipoint(geometry);
                break;
            }
            }
            display.FinishDrawing();
        }
Esempio n. 55
0
 public void StartDrawing(IDisplay display)
 {
 }
 public void SetUp()
 {
     _output = Substitute.For <IOutput>();
     _uut    = new Display(_output);
 }
Esempio n. 57
0
        /**
         * Render the scene using the specified options, image sampler and display.
         *
         * @param options rendering options object
         * @param sampler image sampler
         * @param display display to send the image to, a default display will
         *            be created if <code>null</code>
         */
        public void render(Options options, ImageSampler sampler, IDisplay display)
        {
            if (display == null)
            {
                display = null;// new FrameDisplay();
            }
            if (bakingInstance != null)
            {
                UI.printDetailed(UI.Module.SCENE, "Creating primitives for lightmapping ...");
                bakingPrimitives = bakingInstance.getBakingPrimitives();
                if (bakingPrimitives == null)
                {
                    UI.printError(UI.Module.SCENE, "Lightmap baking is not supported for the given instance.");
                    return;
                }
                int n = bakingPrimitives.getNumPrimitives();
                UI.printInfo(UI.Module.SCENE, "Building acceleration structure for lightmapping ({0} num primitives) ...", n);
                bakingAccel = AccelerationStructureFactory.create("auto", n, true);
                bakingAccel.build(bakingPrimitives);
            }
            else
            {
                bakingPrimitives = null;
                bakingAccel      = null;
            }
            bakingViewDependent = options.getbool("baking.viewdep", bakingViewDependent);

            if ((bakingInstance != null && bakingViewDependent && camera == null) || (bakingInstance == null && camera == null))
            {
                UI.printError(UI.Module.SCENE, "No camera found");
                return;
            }

            // read from options
            threads     = options.getInt("threads", 0);
            lowPriority = options.getbool("threads.lowPriority", true);
            imageWidth  = options.getInt("resolutionX", 640);
            imageHeight = options.getInt("resolutionY", 480);
            // limit resolution to 16k
            imageWidth  = MathUtils.clamp(imageWidth, 1, 1 << 14);
            imageHeight = MathUtils.clamp(imageHeight, 1, 1 << 14);

            // get acceleration structure info
            // count scene primitives
            long numPrimitives = 0;

            for (int i = 0; i < instanceList.getNumPrimitives(); i++)
            {
                numPrimitives += instanceList.getNumPrimitives(i);
            }
            UI.printInfo(UI.Module.SCENE, "Scene stats:");
            UI.printInfo(UI.Module.SCENE, "  * Infinite instances:  {0}", infiniteInstanceList.getNumPrimitives());
            UI.printInfo(UI.Module.SCENE, "  * Instances:           {0}", instanceList.getNumPrimitives());
            UI.printInfo(UI.Module.SCENE, "  * Primitives:          {0}", numPrimitives);
            string accelName = options.getstring("accel", null);

            if (accelName != null)
            {
                rebuildAccel = rebuildAccel || acceltype != accelName;
                acceltype    = accelName;
            }
            UI.printInfo(UI.Module.SCENE, "  * Instance accel:      {0}", acceltype);
            if (rebuildAccel)
            {
                intAccel = AccelerationStructureFactory.create(acceltype, instanceList.getNumPrimitives(), false);
                intAccel.build(instanceList);
                rebuildAccel = false;
            }
            UI.printInfo(UI.Module.SCENE, "  * Scene bounds:        {0}", getBounds());
            UI.printInfo(UI.Module.SCENE, "  * Scene center:        {0}", getBounds().getCenter());
            UI.printInfo(UI.Module.SCENE, "  * Scene diameter:      {0}", getBounds().getExtents().Length());
            UI.printInfo(UI.Module.SCENE, "  * Lightmap bake:       {0}", bakingInstance != null ? (bakingViewDependent ? "view" : "ortho") : "off");
            if (sampler == null)
            {
                return;
            }
            if (!lightServer.build(options))
            {
                return;
            }
            // render
            UI.printInfo(UI.Module.SCENE, "Rendering ...");
            sampler.prepare(options, this, imageWidth, imageHeight);
            sampler.render(display);
            lightServer.showStats();
            // discard baking tesselation/accel structure
            bakingPrimitives = null;
            bakingAccel      = null;
            UI.printInfo(UI.Module.SCENE, "Done.");
        }
Esempio n. 58
0
        public LabelAppendResult TryAppend(IDisplay display, ITextSymbol symbol, IGeometry geometry, bool checkForOverlap)
        {
            if (symbol == null || !(display is Display))
            {
                return(LabelAppendResult.WrongArguments);
            }

            IAnnotationPolygonCollision labelPolyon = null;

            if (display.GeometricTransformer != null && !(geometry is IDisplayPath))
            {
                geometry = display.GeometricTransformer.Transform2D(geometry) as IGeometry;
                if (geometry == null)
                {
                    return(LabelAppendResult.WrongArguments);
                }
            }
            IEnvelope labelPolyonEnvelope = null;

            if (symbol is ILabel)
            {
                List <IAnnotationPolygonCollision> aPolygons = ((ILabel)symbol).AnnotationPolygon(display, geometry);
                bool outside = true;

                if (aPolygons != null)
                {
                    #region Check Outside

                    foreach (IAnnotationPolygonCollision polyCollision in aPolygons)
                    {
                        AnnotationPolygonEnvelope env = polyCollision.Envelope;
                        if (env.MinX < 0 || env.MinY < 0 || env.MaxX > _bm.Width || env.MaxY > _bm.Height)
                        {
                            return(LabelAppendResult.Outside);
                        }
                    }

                    #endregion

                    foreach (IAnnotationPolygonCollision polyCollision in aPolygons)
                    {
                        AnnotationPolygonEnvelope env = polyCollision.Envelope;

                        //int minx = (int)Math.Max(0, env.MinX);
                        //int maxx = (int)Math.Min(_bm.Width - 1, env.MaxX);
                        //int miny = (int)Math.Max(0, env.MinY);
                        //int maxy = (int)Math.Min(_bm.Height, env.MaxY);

                        //if (minx > _bm.Width || maxx <= 0 || miny > _bm.Height || maxy <= 0) continue;  // liegt außerhalb!!

                        int minx = (int)env.MinX, miny = (int)env.MinX, maxx = (int)env.MaxX, maxy = (int)env.MaxY;

                        outside = false;

                        if (!_first && checkForOverlap)
                        {
                            if (_method == OverlapMethod.Pixel)
                            {
                                #region Pixel Methode

                                for (int x = minx; x < maxx; x++)
                                {
                                    for (int y = miny; y < maxy; y++)
                                    {
                                        //if (x < 0 || x >= _bm.Width || y < 0 || y >= _bm.Height) continue;

                                        if (polyCollision.Contains(x, y))
                                        {
                                            //_bm.SetPixel(x, y, Color.Yellow);
                                            if (_bm.GetPixel(x, y) != _back)
                                            {
                                                return(LabelAppendResult.Overlap);
                                            }
                                        }
                                    }
                                }

                                #endregion
                            }
                            else
                            {
                                #region Geometrie Methode

                                labelPolyon = polyCollision;
                                foreach (List <IAnnotationPolygonCollision> indexedPolygons in _gridArrayPolygons.Collect(new Envelope(env.MinX, env.MinY, env.MaxX, env.MaxY)))
                                {
                                    foreach (IAnnotationPolygonCollision lp in indexedPolygons)
                                    {
                                        if (lp.CheckCollision(polyCollision) == true)
                                        {
                                            return(LabelAppendResult.Overlap);
                                        }
                                    }
                                }

                                #endregion
                            }
                        }
                        else
                        {
                            _first = false;

                            if (_method == OverlapMethod.Geometry)
                            {
                                #region Geometrie Methode
                                labelPolyon = polyCollision;
                                #endregion
                            }
                        }
                        labelPolyonEnvelope = new Envelope(env.MinX, env.MinY, env.MaxX, env.MaxY);
                    }
                }

                if (outside)
                {
                    return(LabelAppendResult.Outside);
                }
            }

            if (labelPolyon != null)
            {
                List <IAnnotationPolygonCollision> indexedPolygons = _gridArrayPolygons[labelPolyonEnvelope];
                indexedPolygons.Add(labelPolyon);

                //using (System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath())
                //{
                //    path.StartFigure();
                //    path.AddLine(labelPolyon[0], labelPolyon[1]);
                //    path.AddLine(labelPolyon[1], labelPolyon[2]);
                //    path.AddLine(labelPolyon[2], labelPolyon[3]);
                //    path.CloseFigure();

                //    _graphics.FillPath(Brushes.Aqua, path);
                //}
            }

            System.Drawing.Graphics original = display.GraphicsContext;
            ((Display)display).GraphicsContext = _graphics;

            symbol.Draw(display, geometry);
            ((Display)display).GraphicsContext = original;
            if (_directDraw)
            {
                symbol.Draw(display, geometry);
            }

            return(LabelAppendResult.Succeeded);
        }
Esempio n. 59
0
 public void Setup()
 {
     output  = new Output();
     display = new Display(output);
 }
        private string RenderInfinite(string content, IDisplay display)
        {
            // append " - "
            content += " - ";

            // update scroll position
            if (_scrollDirection != 0 && _lastPositionChange.Add(Speed) < DateTime.Now)
            {
                _position++;

                // reset position at end and pause
                if (_position >= content.Length)
                {
                    _position = 0;
                    _scrollDirection = 0;
                }

                _lastPositionChange = DateTime.Now;
            }

            // start again after pause
            if (_scrollDirection == 0 && _lastPositionChange.Add(Pause) < DateTime.Now)
            {
                _scrollDirection = 1;
            }

            var partLength = (content.Length - _position > display.Columns 
                ? display.Columns 
                : content.Length - _position);

            return content.Substring(_position, partLength) + content.Substring(0, display.Columns - partLength);
        }