public void typeClicked(int id) { TypeRow myTypeUC = null; TypeRowDetail myTypeDUC = null; foreach (TypeRow tb in FindVisualChildren <TypeRow>(RootWoot)) { tb.Visibility = Visibility.Visible; if (tb.Tag.Equals(id)) { myTypeUC = tb; } else { this.EnlargenedTypes.Remove(tb.Id); } } foreach (TypeRowDetail tb in FindVisualChildren <TypeRowDetail>(RootWoot)) { tb.Visibility = Visibility.Collapsed; if (tb.Tag.Equals(id)) { myTypeDUC = tb; } else { this.EnlargenedTypes.Remove(tb.Id); } } if (this.EnlargenedTypes.IndexOf(id) == -1) { myTypeUC.Visibility = Visibility.Collapsed; myTypeDUC.Visibility = Visibility.Visible; this.EnlargenedTypes.Add(id); } else { myTypeDUC.Visibility = Visibility.Collapsed; myTypeUC.Visibility = Visibility.Visible; this.EnlargenedTypes.Remove(id); } }
public static void TypeSectionDemon(TypeSection typeSection) { System.Windows.Point absolutePos = new System.Windows.Point(0, 0); absolutePos = getElementPos(typeSection.AddTypeButton); absolutePos.X += 30; absolutePos.Y += 10; MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y); MouseEvent(MouseEventFlags.LeftDown); Thread.Sleep(200); MouseEvent(MouseEventFlags.LeftUp); Thread.Sleep(1000); bool done = false; AddType addType = null; typeSection.Dispatcher.Invoke(() => { addType = typeSection.AddTypeDemonDialog; done = true; }); while (!done) { } AddTypeDemon(addType); Thread.Sleep(1000); //Finds the edit button TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot); List <TypeRowDetail> myList = new List <TypeRowDetail>(); done = false; TypeRowDetail rowDetail = null; typeSection.Dispatcher.Invoke(() => { foreach (TypeRowDetail m in TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot)) { if (m.Tag.Equals(typeSection.EnlargenedTypes.SingleOrDefault())) { rowDetail = m; absolutePos = getElementPos(m.EditTagButton); done = true; } } }); while (!done) { } MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y); MouseEvent(MouseEventFlags.LeftDown); Thread.Sleep(200); MouseEvent(MouseEventFlags.LeftUp); Thread.Sleep(1000); EditTypeDemon(typeSection.EditTypeDemonDialog); //Finds the delete button myList = new List <TypeRowDetail>(); done = false; rowDetail = null; typeSection.Dispatcher.Invoke(() => { foreach (TypeRowDetail m in TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot)) { if (m.Tag.Equals(typeSection.EnlargenedTypes.SingleOrDefault())) { rowDetail = m; absolutePos = getElementPos(m.DeleteTagButton); done = true; } } }); while (!done) { } MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y); MouseEvent(MouseEventFlags.LeftDown); Thread.Sleep(200); MouseEvent(MouseEventFlags.LeftUp); Thread.Sleep(1000); System.Windows.Forms.SendKeys.SendWait("{ENTER}"); absolutePos = getElementPos(typeSection.CloseButton); absolutePos.X += 30; absolutePos.Y += 10; MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y); MouseEvent(MouseEventFlags.LeftDown); Thread.Sleep(200); MouseEvent(MouseEventFlags.LeftUp); }