public void Dispose() { GC.Collect (); plotView = null; masterLayout = null; subTitleBar = null; mainTitleBar = null; region1DownArrow = null; region2DownArrow = null;; region3DownArrow = null;; region4DownArrow = null;; region1ButtonStack = null;; region2ButtonStack = null;; region3ButtonStack = null;; region4ButtonStack = null;; region1WarmLabel = null; region2AssertiveLabel = null; region3PatientLabel = null; region4DetailedLabel = null; emotionList = null; graphAndEmotionListContainer = null; BottomStackContainer = null; }
async void OnGraphPageAppearing(object sender, System.EventArgs e) { bool isValueReceied = false; try { progressBar.ShowProgressbar ("Analysing your emotions."); User user = App.Settings.GetUser(); if(user == null) { return; } AllEmotions getEmotionsResult = await PurposeColor.Service.ServiceHelper.GetEmotionsDetailsForGraph (user.UserId); // user id for testing only.. in actual get it from app.settings. if (getEmotionsResult != null) { //if(getEmotionsResult.resultarray != null) { if(getEmotionsResult.resultarray == null) { emotionList = new List<EmotionValues>(); emotionList.Add(new EmotionValues()); } else { emotionList = getEmotionsResult.resultarray; } isValueReceied = true; #region OXYPLOT VIEW plotView = new OxyPlotView(); plotView.HeightRequest = App.screenWidth * .80; plotView.WidthRequest = App.screenWidth * .80; // H & W same to keep it square. plotView.BackgroundColor = Color.Transparent; graphModel = new CustomeGraphModel(emotionList); plotView.Model = graphModel.plotModel; plotView.VerticalOptions = LayoutOptions.Center; plotView.HorizontalOptions = LayoutOptions.Center; graphAndEmotionListContainer.Children.Add(plotView); #endregion } int warmCount = 0; int assertiveCount = 0; int patientCount = 0; int detailedCount = 0; if(emotionList != null && emotionList.Count > 0) { warmCount = emotionList.Where (ee => ee.emotion_value == "-2").ToList ().Count; assertiveCount = emotionList.Where (ee => ee.emotion_value == "-1").ToList ().Count; patientCount = emotionList.Where (ee => ee.emotion_value == "1").ToList ().Count; detailedCount = emotionList.Where (ee => ee.emotion_value == "2").ToList ().Count; } region1WarmLabel.Text = "Warm (" + warmCount + ") "+getEmotionsResult.warm_percent + "%"; region2AssertiveLabel.Text = "Assertive (" + assertiveCount + ") " +getEmotionsResult.assertive_percent + "%"; region3PatientLabel.Text = "Patient (" + patientCount + ") " +getEmotionsResult.patient_percent + "%"; region4DetailedLabel.Text = "Detailed (" + detailedCount + ") " + getEmotionsResult.detailed_percent + "%"; graphAndEmotionListContainer.Children.Add(BottomStackContainer); StackLayout emptySpacingAtBottom = new StackLayout { HeightRequest = 50, BackgroundColor = Color.Transparent }; graphAndEmotionListContainer.Children.Add(emptySpacingAtBottom); isValueReceied = true; } else { isValueReceied = false; emotionList = null; } } catch (System.Exception ex) { } progressBar.HideProgressbar (); if(!isValueReceied) { await DisplayAlert (Constants.ALERT_TITLE, "Network error, please try again later.", Constants.ALERT_OK); } }