protected override void Dispose(bool disposing) { NSNotificationCenter.DefaultCenter.RemoveObserver(this); if (this.globalMoodMapView != null) { this.globalMoodMapView.Dispose(); this.globalMoodMapView = null; } if (this.supportBtn != null) { this.supportBtn.Dispose(); this.supportBtn = null; } if (this.refreshBtn != null) { this.refreshBtn.Dispose(); this.refreshBtn = null; } if (this.syncStatusBtnView != null) { this.syncStatusBtnView.Dispose(); this.syncStatusBtnView = null; } this.currentReport = null; base.Dispose(disposing); }
public override void ViewDidLoad() { Console.WriteLine("Our mood ViewDidLoad"); base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. //MoodReport report = MoodReport.List().FirstOrDefault(); // GlobalMoodMap map = new GlobalMoodMap(){ // Width = (int)ChartContainer.Bounds.Width, // Height = (int)ChartContainer.Bounds.Height, // ReportStart = report.StartsOn, // ReportEnd = report.EndsOn, // Tension = 0.7f, // ShowDataPoints = false // }; NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("NewReportReceived"), "NewReportReceived", null); NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("SyncingWithServer:"), "SyncingWithServer", null); NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("SyncWithServerComplete:"), "SyncWithServerComplete", null); NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("HideSupportScreen:"), "HideSupportScreen", null); NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("ShowSupportScreen:"), "ShowSupportScreen", null); //globalMoodMap = new GlobalMoodMapView(new RectangleF(0, 0, this.ChartContainer.Frame.Width, this.ChartContainer.Frame.Height), null, false, true, 0.7f); globalMoodMapView = new GlobalMoodMapView(this.ChartLayer.Bounds); this.ChartLayer.Add(globalMoodMapView); syncStatusBtnView = new SyncStatusButtonView(new RectangleF(10, 12, 25, 22)); this.Add(syncStatusBtnView); //syncStatusBtnView.Hidden = true; refreshBtn = new RefreshDataButtonView(); refreshBtn.Center = new PointF(this.View.Center.X, -20); refreshBtn.Refresh += (object sender, EventArgs e) => { RefreshImages(); }; this.Add(refreshBtn); supportBtn = new UIButton(UIButtonType.RoundedRect); supportBtn.Frame = new RectangleF(300, 60, 70, 30); supportBtn.SetTitle("Support", UIControlState.Normal); supportBtn.TouchUpInside += (object sender, EventArgs e) => { ShowSupportScreen(); }; supportBtn.Hidden = true; this.Add(supportBtn); this.currentReport = MoodReport.LatestGeneratedReport; globalMoodMapView.Refresh(this.currentReport); Console.WriteLine("Snapshot count: {0}", Snapshot.Count()); Console.WriteLine("MoodSnapshot count: {0}", MoodSnapshot.Count()); Console.WriteLine("Report count: {0}", MoodReport.Count()); Console.WriteLine("Log count: {0}", Log.Count()); //this.Refresh(); // // // var reports = MoodReport.All().ToList(); // var snapshots = MoodSnapshot.Count(); // var currenSnapshots = MoodReport.CurrentReport.Snapshots.Count(); }