void Convert_to_Squad_Click(object sender, RoutedEventArgs e) { VirtualSheet.ClearSquad(); foreach (var name in GetNames()) { VirtualSheet.AddSquadMember(name); } VirtualSheet.ShowSquad(); }
void MoveChildren(UIElementCollection origin, int row, string saveKey) { while (origin.Count > 0) { var child = origin[0]; origin.RemoveAt(0); Grid.SetRow(child, row); Button b = child as Button; if (b != null && b.Content is String) { if (b.Content.ToString() == "Clear") { Style redButton = MainWindow.mainWindow.FindResource("RedButton") as Style; b.VerticalAlignment = VerticalAlignment.Center; b.HorizontalAlignment = HorizontalAlignment.Left; b.Margin = new Thickness(5, 0, 15, 0); b.Content = "x"; b.Height = 15; b.Width = 15; b.LayoutTransform = new ScaleTransform(.75, .75); b.Style = redButton; b.Tag = saveKey; } if (b.Content.ToString() == "Roll") { b.Click += new RoutedEventHandler( (x, y) => { Style redButton = MainWindow.mainWindow.FindResource("RedButton") as Style; b.Style = redButton; }); } } var t = child as TextBlock; if (t != null && saveKey != "" && Grid.GetColumn(t) == 2) { var helpKey = saveKey.Replace("\\", "/").Substring(1); var iSlash = helpKey.IndexOf('/'); if (iSlash > 0) { var name = helpKey.Substring(0, iSlash); VirtualSheet.MakeHelpRightKey(t, helpKey, name); } } mainGrid.Children.Add(child); var cb = child as ComboBox; if (cb == null) { continue; } SetComboDefaultLoc(cb); } if (saveKey != null && saveKey != "") { var b = new Button(); Grid.SetRow(b, row); Grid.SetColumn(b, 10); b.VerticalAlignment = VerticalAlignment.Center; b.HorizontalAlignment = HorizontalAlignment.Left; b.Margin = new Thickness(5, 0, 5, 0); b.Content = "Check"; b.Click += new RoutedEventHandler( (object o, RoutedEventArgs args) => { var chk = saveKey.Substring(1).Replace("\\", "/"); string name, key; MainWindow.Parse2Ex(chk, out name, out key, '/'); string cmd = "!check " + name + " /" + key + "/"; MainWindow.mainWindow.SendChat(cmd); MainWindow.mainWindow.SendHost(cmd); }); mainGrid.Children.Add(b); } }