Example #1
0
 public void DeletePreset(string name)
 {
     repo.DeletePreset(name);
     using (var mn = new MasterNetworker(mc.GetCurrentModule().Module.Name, logger))
     {
         mn.PresetDeleted(name);
     }
 }
Example #2
0
 public void SavePreset(string name, IEnumerable <LedValue> leds)
 {
     repo.SavePreset(name, leds, DateTime.UtcNow);
     using (var mn = new MasterNetworker(mc.GetCurrentModule().Module.Name, logger))
     {
         mn.PresetChanges(name);
     }
 }
Example #3
0
 public LanCommunicationService(ILogger logger)
 {
     this.logger = logger;
     mc          = new ModuleController(logger);
     mod         = mc.GetCurrentModule();
     canceller   = new CancellationTokenSource();
     networker   = new MasterNetworker(mod?.Module?.Name, logger);
     lc          = new LedController(logger);
 }
Example #4
0
        public void AddFeature(int featureId, string interval)
        {
            var ts = TimeSpan.Parse(interval);

            mf.AddFeature(Module.Id, featureId, ts);
            using (var mn = new MasterNetworker(Module.Name, logger))
            {
                mn.ModuleChanges();
            }
        }
Example #5
0
        public void AddLedValues(int startIndex, double startX, double startY, int endIndex, double endX, double endY)
        {
            var ledValues = new List <LedValue>();
            var numValues = endIndex - startIndex + 1;
            var xdiff     = (endX - startX) / numValues;
            var ydiff     = (endY - startY) / numValues;

            for (int i = 0; i < numValues; i++)
            {
                ledValues.Add(new LedValue
                {
                    Index      = startIndex + i,
                    ModuleId   = Module.Id,
                    ModuleName = Module.Name,
                    X          = startX + xdiff * i,
                    Y          = startY + ydiff * i
                });
            }
            mf.AddLedValues(ledValues);
            using (var mn = new MasterNetworker(Module.Name, logger))
            {
                mn.ModuleChanges();
            }
        }