private async void GetMyMarkers() { AllRequestResult result = null; await Task.Run(() => { result = new MarkerService().GetMyMarkerList(); }); if (result.IsSuccess) { MyMarkers myMarkers = (MyMarkers)result.Result; MKPointAnnotation annotation; foreach (MyMarker myMarker in myMarkers.MarkerList) { annotation = new MKPointAnnotation() { Title = myMarker.Title, Subtitle = myMarker.Content.Replace("\\n", "\n"), Coordinate = new CLLocationCoordinate2D(myMarker.Latitude, myMarker.Longitude) }; this.map.AddAnnotation(annotation); } } else { SharedService.WebExceptionHandler((WebException)result.Result, this); } }
private void MouseHover(object sender, System.Windows.Input.MouseEventArgs e) { var pos = m_textEditor.GetPositionFromPoint(e.GetPosition(m_textEditor)); if (pos.HasValue) { var markersAtOffset = MarkerService.GetMarkersAtOffset(m_textEditor.Document, m_textEditor.Document.GetOffset(new TextLocation(pos.Value.Line, pos.Value.Column))); if (markersAtOffset == null) { return; } ITextMarker markerWithToolTip = markersAtOffset.FirstOrDefault(marker => marker.ToolTip != null); if (markerWithToolTip != null && markerWithToolTip.ToolTip != null) { if (toolTip == null) { toolTip = new System.Windows.Controls.ToolTip(); toolTip.Closed += ToolTipClosed; } toolTip.PlacementTarget = m_textEditor; // required for property inheritance toolTip.Content = markerWithToolTip.ToolTip; toolTip.IsOpen = true; e.Handled = true; } } }
public List <Marker> GetMarkersList() { MarkerService markersArr = new MarkerService(); markersArr.CreateMarkersList(); return(markersArr.MarkersList); }
private void AddTask(Task task) { if (!CheckTask(task)) { return; } ISourceEditor editor = Document as ISourceEditor; if (task.Line >= 1 && task.Line <= editor.TextEditor.LineCount) { int offset = editor.TextEditor.Document.GetOffset(new TextLocation(task.Line, task.Column)); int length = task.Length == 0 ? EditorHelper.GetWordAt(editor.TextEditor.Document, offset).Length : task.Length; if (length < 2) { // marker should be at least 2 characters long, but take care that we don't make // it longer than the document length = Math.Min(2, editor.TextEditor.Document.TextLength - offset); } ITextMarker marker = MarkerService.Create(editor, offset, length); marker.PropertyChanged += (sender, args) => { ITextMarker m = sender as ITextMarker; editor.TextEditor.TextArea.TextView.Redraw(m, DispatcherPriority.Normal); }; Color markerColor = Colors.Transparent; switch (task.TaskType) { case TaskType.Error: markerColor = Colors.Red; break; case TaskType.Message: markerColor = Colors.Blue; break; case TaskType.Warning: markerColor = Colors.Orange; break; } marker.MarkerColor = markerColor; marker.MarkerType = task.Underline ? TextMarkerType.SquigglyUnderline : TextMarkerType.None; marker.ToolTip = task.Description; marker.Tag = task; } }
private static void Foo() { var markerService = new MarkerService(); var viewModel = new MainViewModel(); markerService.Register(viewModel); var mainView = new MainWindow { DataContext = viewModel }; System.Windows.Application app = new System.Windows.Application(); app.Run(mainView); }
private static void Foo() { var markerService = new MarkerService(); var viewModel = new MainViewModel(); markerService.Register(viewModel); var mainView = new MainWindow { DataContext = viewModel }; mainView.Show(); Dispatcher.Run(); }
private void OnDoubleClick(object sender, RoutedEventArgs e) { DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } object[] item = (object[])m_ListView.ItemContainerGenerator.ItemFromContainer(dep); FileName fileName = (FileName)item[3]; int line = (int)item[4]; int column = (int)item[5]; OpenedFile file = FileService.GetOpenedFile(fileName); if (file != null) { if (file.Document is ISourceEditor) { ISourceEditor sourceEditor = file.Document as ISourceEditor; var markersAtOffset = MarkerService.GetMarkersAtOffset(sourceEditor.TextEditor.Document, sourceEditor.TextEditor.Document.GetOffset(new TextLocation(line, column))); if (markersAtOffset == null) { return; } ITextMarker marker = markersAtOffset.FirstOrDefault(); if (marker == null) { return; } TextArea area = sourceEditor.TextEditor.TextArea; layoutManager.Value.ShowDocument(sourceEditor, true); area.Selection = Selection.Create(area, marker.Offset, marker.EndOffset); area.Caret.Line = line; area.Caret.Column = column; sourceEditor.TextEditor.ScrollTo(line, column); sourceEditor.TextEditor.Focus(); } } }
public void ClearResults() { MarkerService.RemoveAll(m => true); InterpretedSymbols.Clear(); WrongLine.Clear(); }
/// <summary> /// Clears all TextMarkers representing errors. /// </summary> void ClearErrors() { MarkerService.RemoveAll(marker => marker.Tag is Task); }
private void OnRemoved(object sender, TaskEventArgs e) { MarkerService.RemoveAll(marker => marker.Tag == e.Task); }