static void AddToStack(NotifierViewBase notifier) { using (var helper = PersistentMemoryMapping.GetHelper()) { var list = helper.Read <List <MyRectangular> >(); if (list == null) { list = new List <MyRectangular>(); } list.Add(notifier.myRectangular); helper.Write(list); } }
static double GetStackHeight() { using (var helper = PersistentMemoryMapping.GetHelper()) { var list = helper.Read <List <MyRectangular> >(); if (list != null) { list = list.Where(t => WindowsList.IsWindowExisted(t.Handle)).ToList(); double topExisted = list.Select(t => t.Height).Sum() + list.Select(t => t.Space).Sum(); return(topExisted); } return(0); } }
static void RemoveFromStack(string id) { using (var helper = PersistentMemoryMapping.GetHelper()) { var list = helper.Read <List <MyRectangular> >(); if (list != null) { var rec = list.FirstOrDefault(t => t.ID.Equals(id)); if (rec != null) { rec.IsEmpty = true; if (list.All(t => t.IsEmpty)) { list.Clear(); } helper.Write(list); } } } }