public bool IsButtonInOriginPos(Menu_Sort_Button button) { double w = STATICS.MENU_BAR_SIZE.Width; double h = STATICS.MENU_BAR_SIZE.Height; double x0 = (STATICS.SCREEN_WIDTH - w) / 2; double y0 = STATICS.SCREEN_HEIGHT - h; double x1 = (STATICS.SCREEN_WIDTH - w) / 2; double y1 = 0; double x2 = 0; double y2 = (STATICS.SCREEN_HEIGHT - w) / 2; double x3 = STATICS.SCREEN_WIDTH - h; double y3 = (STATICS.SCREEN_HEIGHT - w) / 2; Rect rec0 = new Rect(x0, y0, w, h); Rect rec1 = new Rect(x1, y1, w, h); Rect rec2 = new Rect(x2, y2, h, w); Rect rec3 = new Rect(x3, y3, h, w); if (rec0.Contains(button.CurrentPosition) || rec1.Contains(button.CurrentPosition) || rec2.Contains(button.CurrentPosition) || rec3.Contains(button.CurrentPosition)) { return true; } else return false; }
public void AddGroupButton(Menu_Sort_Button button) { Dispatcher.BeginInvoke(new Action(() => { this.Children.Add(button); })); }