/***** * Memory care function */ private void WatchDog() { System.Diagnostics.Process currentProc = System.Diagnostics.Process.GetCurrentProcess(); int kbTaken = (int)(currentProc.PrivateMemorySize64 / 1024); // app size in KB int playingCount = 0; //_srcs[0].Log(kbTaken.ToString()); foreach (SourcePresenter s in _srcs) { if (s.IsPlaying) { playingCount = playingCount + 1; } } if (watchdogCountMax < playingCount) { watchdogCountMax = playingCount; watchdogKbTaken = kbTaken; } else if (watchdogCountMax > 0 && kbTaken > watchdogKbTaken * 1.2) { int restartNow = watchdogRestartedLast + 1; if (restartNow >= _srcs.Count) { restartNow = 0; } for (int i = restartNow; i < _srcs.Count; i++) { SourcePresenter s = _srcs[i]; if (s != null && s.IsPlaying) { s.IsPlaying = false; s.IsPlaying = true; restartNow = i; break; } } watchdogRestartedLast = restartNow; } View.WatchDogTimerEnabled = true; }
public void SourceDoneDragDrop() { _settings.hint.Hide(); SourcePresenter fp = null, tp = null; foreach (SourcePresenter s in _srcs) { if (_draggedSource != null && s.Source == _draggedSource || s.DragDropInitiator) { fp = s; } if (s.DragDropAcceptor) { tp = s; } s.DragDropEnd(); } if (tp != null) { if (fp != null) { int p = fp.Position; fp.Position = tp.Position; tp.Position = p; View.SwapItems(fp.Control, tp.Control); if (_draggedSource != null) { tp.Source = null; } } else if (_draggedSource != null) { tp.Source = _draggedSource; } } _draggedSource = null; }