Пример #1
0
        UIElement CreateTabItemHeader(AnalysisPanel analysisPanel, string fileNameIn)
        {
            string     fileName   = string.IsNullOrEmpty(analysisPanel.SaveFileName) ? fileNameIn : analysisPanel.SaveFileName;
            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Horizontal;
            stackPanel.Margin      = new Thickness(2, 1, 0, 0);

            Image image = new Image();

            image.Style = (Style)FindResource("ImageStyle");

            image.Source = TwGui.GetImage("trace.png");
            image.Margin = new Thickness(0);
            stackPanel.Children.Add(image);

            TextBlock textBlock = new TextBlock();

            textBlock.Margin = new Thickness(4, 0, 0, 0);
            textBlock.Text   = System.IO.Path.GetFileNameWithoutExtension(fileName);
            stackPanel.Children.Add(textBlock);

            stackPanel.ToolTip = fileName;

            return(stackPanel);
        }
Пример #2
0
        public static Grid FixtureWithNoLabel(FixtureClass fixtureClass)
        {
            Grid grid = new Grid();

            grid.Margin = new Thickness(1, 1, 1, 1);

            RowDefinition rowdef = new RowDefinition();

            rowdef.Height = new GridLength(1, GridUnitType.Star);
            grid.RowDefinitions.Add(rowdef);

            rowdef        = new RowDefinition();
            rowdef.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowdef);

            Image image = new Image();

            image.Style  = (Style)ResourceLocator.FindResource("ImageStyle");
            image.Source = TwGui.GetImage(fixtureClass.ImageFilename);

            Border border = new Border();

            border.Style      = (Style)ResourceLocator.FindResource("FixtureBorderStyle");
            border.Background = TwBrushes.FrozenSolidColorBrush(fixtureClass.Color);
            border.Child      = image;

            Grid.SetRow(border, 1);
            grid.Children.Add(border);

            grid.ToolTip = fixtureClass.FriendlyName;

            return(grid);
        }
Пример #3
0
        void CompareAnalysesExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            string fileNameAnalysisLower = TwFile.GetAnalysisFile();

            if (fileNameAnalysisLower == null || fileNameAnalysisLower == string.Empty)
            {
                return;
            }

            string fileNameAnalysisUpper = TwFile.GetAnalysisFile();

            if (fileNameAnalysisUpper == null || fileNameAnalysisUpper == string.Empty)
            {
                return;
            }

            UpdateAnalysisFolder(fileNameAnalysisUpper);

            Mouse.OverrideCursor = Cursors.Wait;

            var analysisLower = TwServices.CreateAnalysis(fileNameAnalysisLower);
            var analysisUpper = TwServices.CreateAnalysis(fileNameAnalysisUpper);

            var compareAnalysesPanel = new CompareAnalysesPanel();

            compareAnalysesPanel.AnalysisLower = analysisLower;
            compareAnalysesPanel.AnalysisUpper = analysisUpper;
            compareAnalysesPanel.Initialize();

            AddTab(CreateTabItemHeader("Compare", TwGui.GetImage("traces2.png"), CreateCompareAnalysesHeaderToolTip(fileNameAnalysisUpper, fileNameAnalysisLower)), compareAnalysesPanel, compareAnalysesPanel.StyledEventsViewerUpper.EventsViewer.ScrollViewer, false);

            Mouse.OverrideCursor = null;
        }
Пример #4
0
 public void Initialize()
 {
     Image.Source          = TwGui.GetImage(FixtureClass.ImageFilename);
     this.Content          = Image;
     this.Tag              = FixtureClass;
     this.Background       = TwBrushes.FrozenSolidColorBrush(FixtureClass.Color);
     this.Style            = (Style)ResourceLocator.FindResource(FixtureClass.LowFrequency ? "ToolBarFixtureLowFrequencyButtonStyle" : "ToolBarFixtureButtonStyle");
     this.ToolTip          = "Classify as " + FixtureClass.FriendlyName + " (" + FixtureClass.Character + ")";
     this.ContextMenu      = FixtureButtonContextMenu();
     this.CommandParameter = FixtureClass;
 }
Пример #5
0
        void ExecuteConfusionMatrix(List <Classifier> classifiers, Adopter adopter)
        {
            List <string> files = TwFile.GetAnalysisFilesIncludingZipped();

            if (files.Count > 0)
            {
                foreach (var classifier in classifiers)
                {
                    var panel = LoadConfusionMatrix(files, classifier, adopter);
                    AddTab(CreateTabItemHeader("Confusion Matrix: " + classifier.Name,
                                               TwGui.GetImage("confusionmatrix.png")), panel, null, true);
                }
            }
        }
Пример #6
0
        public static Border FixtureImage(FixtureClass fixtureClass)
        {
            Image image = new Image();

            image.Style  = (Style)ResourceLocator.FindResource("ImageStyle");
            image.Source = TwGui.GetImage(fixtureClass.ImageFilename);

            Border border = new Border();

            border.Style      = (Style)ResourceLocator.FindResource("FixtureBorderStyle");
            border.Background = TwSingletonBrushes.Instance.FrozenSolidColorBrush(fixtureClass.Color);
            border.Child      = image;

            return(border);
        }
Пример #7
0
        public static Grid FixtureWithImageLeftMenu(FixtureClass fixtureClass)
        {
            Grid grid = new Grid();

            grid.Margin = new Thickness(1, 0, 1, 0);

            grid.Tag = fixtureClass;

            ColumnDefinition columnDefinition = new ColumnDefinition();

            columnDefinition.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(columnDefinition);

            columnDefinition       = new ColumnDefinition();
            columnDefinition.Width = new GridLength(1, GridUnitType.Star);
            grid.ColumnDefinitions.Add(columnDefinition);

            Image image = new Image();

            image.Style  = (Style)ResourceLocator.FindResource("ImageStyle");
            image.Source = TwGui.GetImage(fixtureClass.ImageFilename);

            Border border = new Border();

            border.Style      = (Style)ResourceLocator.FindResource("FixtureBorderStyle");
            border.Background = TwBrushes.FrozenSolidColorBrush(fixtureClass.Color);
            border.Child      = image;

            Grid.SetColumn(border, 0);
            grid.Children.Add(border);

            var label = new Label();

            label.Content             = fixtureClass.LabelName;
            label.FontWeight          = FontWeights.Normal;
            label.HorizontalAlignment = HorizontalAlignment.Left;
            label.VerticalAlignment   = VerticalAlignment.Top;
            label.Padding             = new Thickness(1, 0, 1, 0);
            label.Margin = new Thickness(5, 0, 5, 0);

            Grid.SetColumn(label, 1);
            grid.Children.Add(label);

            return(grid);
        }
Пример #8
0
        void ButtonMoreFixtures_Click(object sender, RoutedEventArgs e)
        {
            if (showingMoreFixtures)
            {
//                AnalysisPanel.SetVisibility(panelFixturesLowFrequency, Visibility.Collapsed);
                panelFixturesLowFrequency.Visibility = Visibility.Collapsed;
                ButtonMoreFixtures.ToolTip           = "Show More Fixtures";
                ImageMoreFixtures.Source             = TwGui.GetImage("arrowright.png");
            }
            else
            {
                panelFixturesLowFrequency.Visibility = Visibility.Visible;
                ButtonMoreFixtures.ToolTip           = "Hide More Fixtures";
                ImageMoreFixtures.Source             = TwGui.GetImage("arrowleft.png");
            }

            showingMoreFixtures = !showingMoreFixtures;
        }
Пример #9
0
        public static Grid FixtureWithImageRight(FixtureClass fixtureClass)
        {
            Grid grid = new Grid();

            grid.Margin = new Thickness(1, 1, 1, 1);

            var coldefImage = new ColumnDefinition();

            coldefImage.Width = new GridLength(1, GridUnitType.Star);
            grid.ColumnDefinitions.Add(coldefImage);

            var coldefText = new ColumnDefinition();

            coldefText.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(coldefText);

            Image image = new Image();

            image.Style  = (Style)ResourceLocator.FindResource("ImageStyle");
            image.Source = TwGui.GetImage(fixtureClass.ImageFilename);

            Border border = new Border();

            border.Style      = (Style)ResourceLocator.FindResource("FixtureBorderStyle");
            border.Background = TwBrushes.FrozenSolidColorBrush(fixtureClass.Color);
            border.Child      = image;

            Grid.SetColumn(border, 1);
            grid.Children.Add(border);

            TextBlock textBlock = new TextBlock();

            textBlock.Text                = fixtureClass.FriendlyName;
            textBlock.Margin              = new Thickness(0, 0, 6, 0);
            textBlock.TextAlignment       = TextAlignment.Right;
            textBlock.HorizontalAlignment = HorizontalAlignment.Right;
            textBlock.VerticalAlignment   = VerticalAlignment.Center;

            Grid.SetColumn(textBlock, 0);
            grid.Children.Add(textBlock);

            return(grid);
        }
Пример #10
0
        MenuItem FixtureButtonContextMenuItem(string label, RoutedUICommand command)
        {
            var menuItem = new MenuItem();

            menuItem.Header = label + " " + FixtureClass.FriendlyName;
            var image = new Image();

            image.Source = TwGui.GetImage(FixtureClass.ImageFilename);
            var border = new Border();

            border.Padding            = new Thickness(2);
            border.Background         = TwBrushes.FrozenSolidColorBrush(FixtureClass.Color);
            border.Child              = image;
            menuItem.Icon             = border;
            menuItem.Command          = command;
            menuItem.CommandParameter = FixtureClass;

            return(menuItem);
        }
Пример #11
0
        void Initialize()
        {
            if (FixtureClass != null)
            {
                if (CanDrag)
                {
                    this.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(previewMouseLeftButtonDown);
                    this.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(previewMouseLeftButtonUp);
                    this.PreviewMouseMove           += new MouseEventHandler(previewMouseMove);
                }

                Image.Source      = TwGui.GetImage(FixtureClass.ImageFilename);
                Border.Background = TwBrushes.FrozenSolidColorBrush(FixtureClass.Color);
                Tag = FixtureClass;
                LabelFixtureName.Text = FixtureClass.ShortName;

                if (manuallyClassified)
                {
                    LabelFixtureName.Text   += "*";
                    LabelFixtureName.ToolTip = "* Manually classified as " + fixtureClass.FriendlyName + " by user. Will not be overridden by machine classification.";
                }

                LabelFirstCycle.ToolTip = "Manually classified as 1st Cycle";

                if (firstCycleManuallyClassified)
                {
                    LabelFirstCycle.Text   += "*";
                    LabelFirstCycle.ToolTip = "* Manually classified as 1st Cycle by user. Will not be overridden by machine classification.";
                }
            }
            else if (!string.IsNullOrEmpty(Label))
            {
                LabelFixtureName.Text = Label;
            }
            LabelFirstCycle.Visibility           = firstCycle ? Visibility.Visible : Visibility.Collapsed;
            Border.HorizontalAlignment           = HorizontalImageAlignment;
            LabelFixtureName.HorizontalAlignment = HorizontalImageAlignment;
        }
Пример #12
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(TwGui.GetImage(((FixtureClass)value).ImageFilename));
 }
Пример #13
0
        public StyledFixtureLabel(FixtureClass fixtureClass, FontWeight fontWeight, bool showKey, bool manuallyClassified, bool firstCycle, bool firstCycleManuallyClassified, bool showFriendlyName, bool singleRow, bool showHasNotes)
        {
            this.Focusable = false;
            this.IsTabStop = false;

            this.InputBindings.Add(new MouseBinding(AnalysisPanel.BringSelectedEventIntoViewCommand, new MouseGesture(MouseAction.LeftDoubleClick, ModifierKeys.None)));

            FixtureClass = fixtureClass;

            Grid grid = new Grid();

            ColumnDefinition coldefText = new ColumnDefinition();

            coldefText.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(coldefText);

            ColumnDefinition coldefImage = new ColumnDefinition();

            coldefImage.Width = new GridLength(1, GridUnitType.Star);
            grid.ColumnDefinitions.Add(coldefImage);

            Image image = new Image();

            image.Style  = (Style)ResourceLocator.FindResource("ImageStyle");
            image.Source = TwGui.GetImage(fixtureClass.ImageFilename);

            Border border = new Border();

            border.Style             = (Style)ResourceLocator.FindResource("FixtureBorderStyle");
            border.Background        = TwBrushes.FrozenSolidColorBrush(fixtureClass.Color);
            border.VerticalAlignment = VerticalAlignment.Top;
            border.Child             = image;

            Grid.SetColumn(border, 0);
            grid.Children.Add(border);

            var stackPanel = new StackPanel();

            var label = new TextBlock();

            var name = showFriendlyName ? fixtureClass.FriendlyName : fixtureClass.ShortName;

            if (showKey)
            {
                label.Text = name + " (" + fixtureClass.Character + ")";
            }
            else
            {
                label.Text = name;
            }

            if (singleRow)
            {
                grid.ToolTip = "Selected Event is " + fixtureClass.FriendlyName;
            }

            if (manuallyClassified)
            {
                label.Text += "*";
                if (singleRow)
                {
                    grid.ToolTip += "\r\n* = Manually classified";
                }
            }

            label.Margin              = new Thickness(6, 0, 0, 0);
            label.FontWeight          = fontWeight;
            label.HorizontalAlignment = HorizontalAlignment.Left;
            label.VerticalAlignment   = VerticalAlignment.Center;

            stackPanel.Children.Add(label);

            if (firstCycle)
            {
                label                     = new TextBlock();
                label.Text                = "(1st Cycle)";
                label.Margin              = new Thickness(6, 0, 0, 0);
                label.FontWeight          = fontWeight;
                label.HorizontalAlignment = HorizontalAlignment.Left;
                label.VerticalAlignment   = VerticalAlignment.Center;
                stackPanel.Children.Add(label);

                if (singleRow)
                {
                    stackPanel.Orientation = Orientation.Horizontal;
                    label.Text             = "1";
                    if (singleRow)
                    {
                        grid.ToolTip += "\r\n1 = 1st Cycle";
                    }
                }

                if (firstCycleManuallyClassified)
                {
                    label.Text += "*";
                }
            }

            if (showHasNotes)
            {
                label                     = new TextBlock();
                label.Text                = "Notes";
                label.Margin              = new Thickness(6, 0, 0, 0);
                label.FontWeight          = fontWeight;
                label.HorizontalAlignment = HorizontalAlignment.Left;
                label.VerticalAlignment   = VerticalAlignment.Center;
                stackPanel.Children.Add(label);

                if (singleRow)
                {
                    stackPanel.Orientation = Orientation.Horizontal;
                    label.Text             = "N";
                    grid.ToolTip          += "\r\nN = Has User Notes";
                }
            }

            Grid.SetColumn(stackPanel, 1);
            grid.Children.Add(stackPanel);

            this.Content = grid;
        }
Пример #14
0
        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;
        }
Пример #15
0
 public void AddTab(UIElement content, string iconFile, string keyCode)
 {
     AddTab(CreateTabItemHeader(keyCode, TwGui.GetImage(iconFile)), content, content, true);
 }
Пример #16
0
 void Update()
 {
     Image.Source      = TwGui.GetImage(Event.FixtureClass.ImageFilename);
     Border.Background = TwSingletonBrushes.Instance.FrozenSolidColorBrush(Event.FixtureClass.Color);
 }