private void UpdateJobPanel(QueueManagerJob job, StackPanel stack) { foreach (object child in stack.Children) { if (child is Label myObjRef) { switch ((string)myObjRef.Tag) { case "1": myObjRef.Content = job.ID; break; case "2": myObjRef.Content = job.Status.ToString(); break; case "3": myObjRef.Content = job.SubStatus.ToString(); break; default: break; } } } }
private StackPanel GetJobPanel(QueueManagerJob job) { StackPanel stk = new StackPanel() { Orientation = Orientation.Horizontal, Tag = job.ID }; stk.Children.Add(new Label() { Content = job.ID, Tag = 1 }); stk.Children.Add(new Label() { Content = job.Status.ToString(), Tag = 2 }); stk.Children.Add(new Label() { Content = job.SubStatus.ToString(), Tag = 3 }); Button btn = new Button() { Content = "Cancel", Tag = job.ID, }; stk.Children.Add(btn); btn.Click += BtnCancelJob_Click; return(stk); }