void Add(Event @event) { var tick = new ClassificationTick(); tick.Event = @event; tick.OnRemove = Remove; tick.OnChangePosition = ChangePosition; tick.Initialize(); const int widthOfTick = 6; Canvas.SetBottom(tick, 0); double offset = (@event.StartTime.Subtract(Events.StartTime).TotalSeconds *WidthMultiplier) - widthOfTick / 2; Canvas.SetLeft(tick, offset); Canvas.Children.Add(tick); eventsInRuler.Add(@event); }
void ChangePosition(ClassificationTick tick) { double offset = tick.Event.StartTime.Subtract(Events.StartTime).TotalSeconds *WidthMultiplier; Canvas.SetLeft(tick, offset); }
void Remove(ClassificationTick tick) { eventsInRuler.Remove(tick.Event); Canvas.Children.Remove(tick); }
public StyledFixtureLabel(Event @event, bool showFriendlyName, bool activateCommand) { this.Focusable = false; this.IsTabStop = false; if (activateCommand) { this.InputBindings.Add(new MouseBinding(AnalysisPanel.BringSelectedEventIntoViewCommand, new MouseGesture(MouseAction.LeftDoubleClick, ModifierKeys.None))); } FixtureClass = @event.FixtureClass; this.ToolTip = BuildToolTip(@event); var panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; var panelTicks = new StackPanel(); { var tick = new ClassificationTick(); tick.Padding = new Thickness(0, 1, 4, 1); tick.VerticalAlignment = VerticalAlignment.Center; if (@event.ManuallyClassified) { tick.TickClassifiedUsingFixtureList.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingMachineLearning.Visibility = Visibility.Collapsed; } else if (@event.ClassifiedUsingFixtureList) { tick.TickManuallyClassified.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingMachineLearning.Visibility = Visibility.Collapsed; } else { tick.TickManuallyClassified.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingFixtureList.Visibility = Visibility.Collapsed; } panelTicks.Children.Add(tick); } if (@event.ManuallyApproved) { var tick = new ApprovalTick(); tick.Padding = new Thickness(0, 1, 4, 1); tick.VerticalAlignment = VerticalAlignment.Center; panelTicks.Children.Add(tick); } panel.Children.Add(panelTicks); Image image = new Image(); image.Style = (Style)ResourceLocator.FindResource("ImageStyle"); image.Source = TwGui.GetImage(@event.FixtureClass.ImageFilename); Border border = new Border(); border.Margin = new Thickness(3, 0, 0, 0); border.Style = (Style)ResourceLocator.FindResource("FixtureBorderStyle"); border.Background = TwBrushes.FrozenSolidColorBrush(@event.FixtureClass.Color); border.VerticalAlignment = VerticalAlignment.Top; border.Child = image; panel.Children.Add(border); var label = new TextBlock(); label.Text = showFriendlyName ? @event.FixtureClass.FriendlyName : @event.FixtureClass.ShortName; label.Padding = new Thickness(3, 0, 0, 0); panel.Children.Add(label); if (@event.FirstCycle) { label = new TextBlock(); label.FontSize = 8; label.BaselineOffset = 10; label.Text = "1"; if ([email protected]) { label.FontStyle = FontStyles.Italic; } label.Padding = new Thickness(3, 0, 0, 0); panel.Children.Add(label); } else if (@event.ManuallyClassifiedFirstCycle) { label = new TextBlock(); label.FontSize = 8; label.BaselineOffset = 10; label.Text = "0"; label.Padding = new Thickness(3, 0, 0, 0); panel.Children.Add(label); } //if (!string.IsNullOrEmpty(@event.UserNotes)) { // label = new TextBlock(); // label.Padding = new Thickness(3, 0, 0, 0); // label.Text = "N"; // panel.Children.Add(label); //} this.Content = panel; }
UIElement BuildToolTip(Event @event) { var panel = new StackPanel(); var text = new TextBlock(); text.Text = "Selected Event is " + @event.FixtureClass.FriendlyName; panel.Children.Add(text); { text = new TextBlock(); var tick = new ClassificationTick(); tick.VerticalAlignment = VerticalAlignment.Center; tick.Padding = new Thickness(0, 0, 3, 0); if (@event.ManuallyClassified) { tick.TickClassifiedUsingFixtureList.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingMachineLearning.Visibility = Visibility.Collapsed; text.Text = "Manually Classified"; } else if (@event.ClassifiedUsingFixtureList) { tick.TickManuallyClassified.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingMachineLearning.Visibility = Visibility.Collapsed; text.Text = "Classified Using Fixture List"; } else { tick.TickManuallyClassified.Visibility = Visibility.Collapsed; tick.TickClassifiedUsingFixtureList.Visibility = Visibility.Collapsed; text.Text = "Classified Using Machine Learning"; } var panelInner = new StackPanel(); panelInner.Orientation = Orientation.Horizontal; panelInner.Children.Add(tick); panelInner.Children.Add(text); panel.Children.Add(panelInner); } if (@event.ManuallyApproved) { var panelInner = new StackPanel(); panelInner.Orientation = Orientation.Horizontal; var tick = new ApprovalTick(); tick.VerticalAlignment = VerticalAlignment.Center; tick.Padding = new Thickness(0, 0, 3, 0); panelInner.Children.Add(tick); text = new TextBlock(); text.Text = "Manually Approved"; panelInner.Children.Add(text); panel.Children.Add(panelInner); } if (@event.FirstCycle) { text = new TextBlock(); if (@event.ManuallyClassifiedFirstCycle) { text.Text = "Manually Classified As 1st Cycle"; } else { text.Text = "Classified As 1st Cycle Using Machine Learning"; } panel.Children.Add(text); } else if (@event.ManuallyClassifiedFirstCycle) { text = new TextBlock(); text.Text = "Manually Classified As Not 1st Cycle"; panel.Children.Add(text); } return(panel); }