Example #1
0
        /// <summary>
        /// Load annotations for a photo.
        /// </summary>
        private async Task ShowAnnotations()
        {
            try
            {
                var photoWithAnnotations = _photo;

                // Avoid making the service call again if it's already been made.
                if (!_isPhotoLoadedFromService)
                {
                    photoWithAnnotations = await _petCareService.GetPhotoDetails(Photo.Id);

                    // Update photo gold count.
                    Photo.GoldCount = photoWithAnnotations.GoldCount;
                }

                // Some views will pass the photo without a corresponding
                // category instance, so we need to update it here.
                if (Category == null)
                {
                    Category = photoWithAnnotations.ExtractCategoryPreview();
                }

                var annotations = photoWithAnnotations.Annotations.OrderByDescending(p => p.CreatedTime);

                Annotations.Clear();
                foreach (var annotation in annotations)
                {
                    Annotations.Add(annotation);
                }
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
        }
Example #2
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }

            if (Declarations != null)
            {
                Declarations.Clear();
            }

            if (Comments != null)
            {
                Comments.Clear();
            }

            if (Annotations != null)
            {
                Annotations.Clear();
            }

            if (ModuleAttributes != null)
            {
                ModuleAttributes.Clear();
            }

            _isDisposed = true;
        }
Example #3
0
        internal void Dispose()
        {
            if (chart != null)
            {
                foreach (ChartAxis axis in chart.Axes)
                {
                    axis.AxisBoundsChanged   -= OnAxisBoundsChanged;
                    axis.VisibleRangeChanged -= OnAxisVisibleRangeChanged;
                }
            }

            Chart = null;

            previouseSelectedAnnotation = null;
            selectedAnnotation          = null;
            previousAnnotation          = null;
            TextAnnotation    = null;
            EditAnnotation    = null;
            CurrentAnnotation = null;
            AnnotationResizer = null;

            if (Annotations != null)
            {
                Annotations.Clear();
                Annotations = null;
            }
        }
 public void Clear()
 {
     DigestProtease = null;
     ClusterNode    = "";
     ClearPeptides();
     Annotations.Clear();
 }
Example #5
0
        protected void AddNonSportEntries(string areaName = "")
        {
            var index = areaName.Equals("") ? 0  : ChartAreas.IndexOf(areaName);

            if (double.IsNaN(ChartAreas[index].AxisX.ScaleView.ViewMinimum) &&
                double.IsNaN(ChartAreas[index].AxisX.ScaleView.ViewMaximum) &&
                Series.First(s => s.Name != NonSportSeriesString).Points.Count == 0)
            {
                return;
            }

            Annotations.Clear();
            Series[NonSportSeriesString].Points.Clear();

            var min = ChartAreas[index].AxisX.ScaleView.ViewMinimum;
            var max = ChartAreas[index].AxisX.ScaleView.ViewMaximum;

            var minX = double.MaxValue;
            var maxX = double.MinValue;

            foreach (var s in Series.Where(s => s.Points.Count > 0 && s.Name != NonSportSeriesString))
            {
                if (s.Points[index].XValue < minX)
                {
                    minX = s.Points[index].XValue;
                }
                if (s.Points[s.Points.Count - 1].XValue > maxX)
                {
                    maxX = s.Points[s.Points.Count - 1].XValue;
                }
            }

            // "prefer" values from datapoints if the chart is not zoomed in
            DateTime minDate;
            DateTime maxDate;

            if (ChartAreas[index].AxisX.ScaleView.IsZoomed)
            {
                minDate = DateTime.FromOADate(min); //.AddDays(1);
                maxDate = DateTime.FromOADate(max); //.AddDays(-1);
            }
            else
            {
                minDate = DateTime.FromOADate(minX).AddDays(1);
                maxDate = DateTime.FromOADate(maxX).AddDays(-1);
            }

            if (NonSportEntries != null)
            {
                foreach (var e in NonSportEntries(minDate, maxDate))
                {
                    e.AddEntryToChart(ChartAreas[index], Series[NonSportSeriesString], Annotations);
                }
            }
        }
Example #6
0
        private void UpdateAnnotations()
        {
            Annotations.Clear();

            foreach (ReferenceLine refLine in ReferenceLines)
            {
                Annotations.Add(CreateReferenceLine(refLine));
            }

            Annotations.Add(CreateStatsText());
        }
Example #7
0
 /// <summary>
 /// Clears all settings configured on the graph and resets all properties
 /// to default values (<see cref="CellSize"/>, <see cref="ScrollOffset"/> etc)
 /// </summary>
 public void Reset()
 {
     ScrollOffset = new PointF(0, 0);
     CellSize     = new PointF(1, 1);
     AxisX.Reset();
     AxisY.Reset();
     Series.Clear();
     Annotations.Clear();
     GraphColor = null;
     SetNeedsDisplay();
 }
Example #8
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }

            Declarations?.Clear();
            Comments?.Clear();
            Annotations?.Clear();
            ModuleAttributes?.Clear();

            _isDisposed = true;
        }
Example #9
0
 public void ClearAnnotations()
 {
     Annotations.Clear();
 }
Example #10
0
 private void Model_AnnotationsCleared()
 {
     Annotations.Clear();
 }
Example #11
0
        public void SetProperties(Tree node, Tree root, Bitmap wholeScreenshot, string ptypeLib,
                                  PrefabInterpretationLogic interpLogic, Bitmap image = null,
                                  IEnumerable <string> annotationLibs = null)
        {
            Annotations.Clear();
            AnnotationLibraries.Clear();

            List <string> keys = new List <string>(node.GetTags().Select(kvp => kvp.Key));

            foreach (string key in keys)
            {
                if (!key.Equals("ptype") && !key.Equals("invalidated"))
                {
                    object attribute = node[key];
                    if (attribute == null)
                    {
                        attribute = "";
                    }

                    AnnotationKeyValuePair annotation = new AnnotationKeyValuePair(key, attribute.ToString());
                    annotation.IsEditingChanged += new DependencyPropertyChangedEventHandler(annotation_IsEditingChanged);
                    Annotations.Add(annotation);
                }
            }



            Node = node;

            if (node.HasTag("type"))
            {
                switch (node["type"].ToString())
                {
                case "ptype":

                    Ptype ptype = (Ptype)node["ptype"];
                    var   exs   = PtypeSerializationUtility.GetTrainingExamples(ptypeLib, ptype.Id);
                    Prototype = new ViewablePrototypeItem(ptype, ptypeLib, exs.Positives, exs.Negatives, image);
                    break;

                case "content":
                case "feature":
                    Prototype = new ViewablePrototypeItem(null, ptypeLib, new List <ImageAnnotation>(), new List <ImageAnnotation>(), image);
                    break;

                default:
                    break;
                }
            }

            SetAnnotationLibraries(annotationLibs);

            StaticMetadata = "x=" + node.Left + ", y=" + node.Top + ", width=" + node.Width + ", height=" + node.Height;

            NodePath = PathDescriptor.GetPath(node, root);

            if (image != null)
            {
                //string bitmapid = wholeScreenshot.GetHashCode().ToString();


                //var annotations = interpLogic.GetAnnotationsMatchingNode(node, root, bitmapid);

                //string annotationsStr = "[\n";

                //foreach (string lib in annotations.Keys)
                //{
                //    foreach (IAnnotation ia in annotations[lib])
                //    {
                //        annotationsStr += "{\"library\" : \"" + lib + "\"\n";
                //        annotationsStr += "\"id\" : \"" + ia.Id + "\"\n";
                //        annotationsStr += ", \"data\"" + JsonConvert.SerializeObject(ia.Data) + "\n";
                //        annotationsStr += "}";
                //        annotationsStr += ",";
                //    }
                //}

                //annotationsStr.Remove(annotationsStr.Length - 1);
                //annotationsStr += "\n]";
                //AnnotationValueBox.Text = annotationsStr;
            }
        }
Example #12
0
 public void Reset()
 {
     Series.Clear();
     Axes.Clear();
     Annotations.Clear();
 }