Exemple #1
0
        void SearchItemPicker_SelectedIndexChanged(object sender, EventArgs e)
        {
            ToggleSearchBtn();
            SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext;
            // change colour of old entry
            Entry oldEntry = CurrentEntriesOnGraph.Where(p => p.Value == SGObj.SearchItemValue)
                             .FirstOrDefault();

            if (!(oldEntry is null))
            {
                oldEntry.Color = SKColor.Parse("#FF1493");
            }

            SGObj.SearchItemValue = searchItemPicker.SelectedIndex;
            Entry searchItemEntry = CurrentEntriesOnGraph.Where(p => p.Value == SGObj.SearchItemValue)
                                    .FirstOrDefault();

            int index = CurrentEntriesOnGraph.ToList().IndexOf(searchItemEntry);

            if (SGObj.SearchItemValue > 0)
            {
                CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse("#0000FF");
            }
            DisplayGraph(CurrentEntriesOnGraph);
        }
Exemple #2
0
 private async void ClearMarkersOnGraph(IEnumerable <Entry> markers)
 {
     if (markers != null &&
         markers.Count() != 0)
     {
         SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext;
         // change colour of current markers back
         foreach (Entry marker in markers)
         {
             if (marker.Value != SGObj.SearchItemValue)
             {
                 int index = CurrentEntriesOnGraph.ToList().IndexOf(marker);
                 CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(App.GraphColour);
                 DisplayGraph(CurrentEntriesOnGraph);
                 await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]);
             }
         }
         CurrentMarkers.Clear();
     }
 }
Exemple #3
0
        private async Task ChangeOperationEntry <T>(T operation) where T : ISearchOperation
        {
            if (operation.Entry != null)
            {
                SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext;
                int index = CurrentEntriesOnGraph.ToList().IndexOf(operation.Entry);
                if (operation.IsSearchItem is false)
                {
                    Console.WriteLine(index);
                    CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(operation.ChangeToColour);
                    DisplayGraph(CurrentEntriesOnGraph);
                    await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]);

                    // change back to original colour
                    CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(App.GraphColour);
                }
                else if (operation.IsSearchItem is true)
                {
                    CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(operation.ChangeToColour);
                }
                DisplayGraph(CurrentEntriesOnGraph);
            }
        }
Exemple #4
0
        private async Task HandleMarkers(InterpolationOperation operation)
        {
            if (operation.Markers != null &&
                operation.Markers.Length != 0)
            {
                SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext;
                if (CurrentMarkers.Count() != 0)
                {
                    // change colour of current markers on graph
                    ClearMarkersOnGraph(CurrentMarkers);
                    await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]);
                }

                // add new markers
                foreach (Entry entry in operation.Markers)
                {
                    int index = CurrentEntriesOnGraph.ToList().IndexOf(entry);
                    CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(operation.ChangeToColour);
                    CurrentMarkers.Add(entry);
                }
                DisplayGraph(CurrentEntriesOnGraph);
                await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]);
            }
        }