Beispiel #1
0
        public static void RenderText(string displayId, string text)
        {
            // TODO: Take font and colors as arguments
            var display = AllDisplays[displayId];

            if (display == null)
            {
                throw new ArgumentNullException($"No display setup for '{displayId}'");
            }
            var textToRender = BitmapSerializer.Serialize(display.TextRenderer.Render(text));

            display.Queue.Enqueue(textToRender);
        }
        private void LoadSnapShots()
        {
            var directoryPath = FileNameConstants.SNAPSHOTS_DIRECTORY_PATH();

            try
            {
                AppDataContext.SnapShots.Clear();

                var directory = new DirectoryInfo(directoryPath);
                if (directory.Exists)
                {
                    IEnumerable <FileInfo> snapShotFiles =
                        directory.GetFiles(string.Format("*.{0}", FileNameConstants.SNAPSHOT_FILE_EXTENSION),
                                           SearchOption.TopDirectoryOnly).OrderByDescending(x => x.CreationTime);

                    foreach (var snapShotFile in snapShotFiles)
                    {
                        var snapShotFilePath = snapShotFile.FullName;
                        var snapShotImage    = BitmapSerializer.LoadFile(snapShotFilePath);

                        if (snapShotImage != null)
                        {
                            var splitName = snapShotFile.Name.Split(new char[] { '@' });
                            if (splitName.Count() > 2)
                            {
                                var percentage = splitName[0];
                                var dateTime   = splitName[1];
                                AppDataContext.SnapShots.Add(new SnapShotDetails()
                                {
                                    DateTime   = Convert.ToDateTime(dateTime),
                                    Percentage = Convert.ToDouble(percentage),
                                    Image      = snapShotImage,
                                });
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }