public MyDockPanel(int identifier) { this.identifier = identifier; Background = new SolidColorBrush(Colors.White); ColumnDefinition s0 = new ColumnDefinition(); ColumnDefinition s1 = new ColumnDefinition(); ColumnDefinition s2 = new ColumnDefinition(); ColumnDefinition s3 = new ColumnDefinition(); ColumnDefinition s4 = new ColumnDefinition(); s0.Width = GridLength.Auto; s1.Width = new GridLength(1f, GridUnitType.Star); s2.Width = new GridLength(3f, GridUnitType.Star); s3.Width = new GridLength(2f, GridUnitType.Star); s4.Width = new GridLength(2f, GridUnitType.Star); Grid g = new Grid(); g.ColumnDefinitions.Add(s0); g.ColumnDefinitions.Add(s1); g.ColumnDefinitions.Add(s2); g.ColumnDefinitions.Add(s3); g.ColumnDefinitions.Add(s4); MyTextBlock id = new MyTextBlock(identifier, identifier.ToString()); MyTextBlock pid = new MyTextBlock(identifier, "PID: "); MyTextBlock title = new MyTextBlock(identifier, "Title: "); MyButton restore = new MyButton(identifier, "Restore"); MyButton reset = new MyButton(identifier, "Reset"); Grid.SetColumn(id, 0); g.Children.Add(id); Grid.SetColumn(pid, 1); g.Children.Add(pid); Grid.SetColumn(title, 2); g.Children.Add(title); Grid.SetColumn(restore, 3); g.Children.Add(restore); Grid.SetColumn(reset, 4); g.Children.Add(reset); Children.Add(g); }
// Call when a MenuIten is selected private void MenuItemSelected(int identifier, string processTitle, int processId) { DockPanel dp = MyGrid.Children[identifier] as DockPanel; Grid g = dp.Children[0] as Grid; MyTextBlock tb = g.Children[1] as MyTextBlock; tb.Value(processId.ToString()); tb = g.Children[2] as MyTextBlock; tb.Value(processTitle); }
// Call when a MenuIten is selected private void MenuItemSelected(int identifier, string processTitle, int processId) { this.pids[identifier] = processId; this.titles[identifier] = processTitle; DockPanel dp = MyGrid.Children[identifier] as DockPanel; Grid g = dp.Children[0] as Grid; MyTextBlock tb = g.Children[TB_PID] as MyTextBlock; tb.Text = "PID: " + processId.ToString(); tb = g.Children[TB_TITLE] as MyTextBlock; tb.Text = "Title: " + processTitle; }
private void Reset_Click(object sender, RoutedEventArgs e) { MyButton b = sender as MyButton; int id = b.Identifier(); this.pids[id] = 0; this.titles[id] = String.Empty; DockPanel dp = MyGrid.Children[id] as DockPanel; Grid g = dp.Children[0] as Grid; MyTextBlock tb = g.Children[TB_PID] as MyTextBlock; tb.Text = "PID: "; tb = g.Children[TB_TITLE] as MyTextBlock; tb.Text = "Title: "; }