public CursorViewer(WaveformUserControl wuc, WaveformCore core) { this.wuc = wuc; this.core = core; GridMain = wuc.GridMain; line = wuc.LineCursor; scaleManager = core.ScaleManager; mouseHandler = new MouseEventHandler(GridMain_PreviewMouseMove); GridMain.PreviewMouseMove += mouseHandler; }
private void UpdateSelection() { if ((CursorViewer.Selection != null) && (CursorViewer.Selection.Variable == Variable)) { RectangleSelection.Visibility = System.Windows.Visibility.Visible; double x1 = ScaleManager.GetOffset(CursorViewer.Selection.Start); double x2 = ScaleManager.GetOffset(CursorViewer.Selection.End); RectangleSelection.Width = x2 - x1; RectangleSelection.Height = CanvasWaveform.ActualHeight; if (CanvasWaveform.Children.Contains(RectangleSelection) == false) { CanvasWaveform.Children.Add(RectangleSelection); } Canvas.SetLeft(RectangleSelection, x1); Canvas.SetTop(RectangleSelection, 0); } else { RectangleSelection.Visibility = System.Windows.Visibility.Collapsed; } }
/// <summary> /// Добавление заметки на долновую диаграмму /// </summary> /// <param name="bookMark"></param> private void AddBookmark(BookMark bookMark) { Uri bookmarkUri = new Uri("pack://application:,,,/Schematix.Waveform;component/icons/BookMark.jpg", UriKind.RelativeOrAbsolute); Image img = new Image(); JpegBitmapDecoder iconDecoder = new JpegBitmapDecoder(bookmarkUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); ImageSource bitmapSource2 = iconDecoder.Frames[0]; img.Source = bitmapSource2; img.Stretch = Stretch.Fill; img.Margin = new Thickness(0); img.Width = 24; img.Height = 24; img.Tag = bookMark; img.ContextMenu = Resources["BookmarkMenu"] as ContextMenu; img.MouseEnter += new MouseEventHandler(img_MouseEnter); img.MouseLeave += new MouseEventHandler(img_MouseLeave); CanvasWaveform.Children.Add(img); Canvas.SetLeft(img, ScaleManager.GetOffset(bookMark.Time)); Canvas.SetTop(img, 2); }
/// <summary> /// Обновление заметок /// </summary> private void UpdateBookmarks() { List <object> images = new List <object>(); foreach (var child in CanvasWaveform.Children) { if (child is Image) { images.Add(child); } } foreach (var child in images) { CanvasWaveform.Children.Remove(child as UIElement); } foreach (BookMark bm in Core.BookMarks) { if ((bm.VariableName.Equals(Variable.FullName) == true) && (ScaleManager.IsContainsTime(bm.Time))) { AddBookmark(bm); } } }
public ResizeDiagram(ScaleManager scaleManager) { this.scaleManager = scaleManager; InitializeComponent(); }
public CorrectSelectedTime(Selection selection, ScaleManager scaleManager) { this.scaleManager = scaleManager; this.selection = selection; InitializeComponent(); }