Esempio n. 1
0
 public Document()
 {
     Flash = new FlashSettings();
     _cont = new ObservableCollection <Controller>();
     _root = UndoRedo.UndoService.Current[this];
     _cont.CollectionChanged += Controllers_CollectionChanged;
 }
Esempio n. 2
0
		public static void Flash(List<Controller> con, FlashSettings sets) {
			SetupPort(sets.Port, sets.Speed);
			double synLen = GetSyncLength(con, sets.IsSync);
			foreach (Controller c in con) {
				if (c.Frames.Count == 0) {
					Worker.ReportProgress(0, "Контроллер " + c.Number + ':' + c.Button + " не содержит фреймов и пропущен.");
					continue;
				}
				EnterModeProgramming(c.Number, c.Button);
				Logging.Log.Write("Включен режим программирования");
				bool wErr = false;
				try {
					double frLen = 0;
					foreach (Frame f in c.Frames) {
						frLen += f.Length;
						if (!SendFrame(c.Number, f))
							wErr = true;
					}
					if (frLen < synLen) {
						Frame fr = new Frame { BegColor = Colors.Black, EndColor = Colors.Black, Length = synLen - frLen };
						SendFrame(c.Number, fr);
					}
					Logging.Log.Write("Фреймы отправлены");
				} catch (Exception e) {
					Logging.Log.Write(e.Message);
					Logging.Log.Write(e.StackTrace);
				} finally {
					ExitModeProgramming(c.Number);
					Logging.Log.Write("Выключен режим программирования");
				}
				if (wErr)
					Worker.ReportProgress(0, "Контроллер " + c.Number + ':' + c.Button + " прошит с ошибками.");
			}
		}
Esempio n. 3
0
		public static void Enable(FlashSettings sets) {
			if (!IsConfigured)
				SetupColorPort(sets.Port, sets.Speed);
			EnDis();
		}
Esempio n. 4
0
		public Document() {
			Flash = new FlashSettings();
			_cont = new ObservableCollection<Controller>();
			_root = UndoRedo.UndoService.Current[this];
			_cont.CollectionChanged += Controllers_CollectionChanged;
		}