protected override void OnDestroy() { base.OnDestroy(); DateTime time = DateTime.Now; string logName = string.Format("{0}{1:D2}{2:D2}_{3:D2}{4:D2}{5:D2}_log", time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second); var writer = new Java.IO.FileWriter(new Java.IO.File(mStorageDirPath, logName + ".csv")); writer.Write(DataTransfer.DEBUG); ConnectedThread.Cancel(); writer.Close(); }
/// <summary> /// Initializes and modifies the members /// </summary> public void Init() { // Initializing objects m_ViewName = FindViewById <TextView>(Resource.Id.DeviceName); m_ViewAddress = FindViewById <TextView>(Resource.Id.DeviceAdresse); m_BtControl = FindViewById <Button>(Resource.Id.btSteueren); m_BtDisconnect = FindViewById <Button>(Resource.Id.btDisconnect); m_Linear = FindViewById <LinearLayout>(Resource.Id.linear4); // Setting text color of buttons m_BtControl.SetBackgroundColor(Android.Graphics.Color.DeepSkyBlue); m_BtDisconnect.SetBackgroundColor(Android.Graphics.Color.DeepSkyBlue); m_BtControl.SetTextColor(Android.Graphics.Color.White); m_BtDisconnect.SetTextColor(Android.Graphics.Color.White); // Setting activity background m_Linear.SetBackgroundColor(Android.Graphics.Color.White); // Receiving data from other activities IList <String> text = Intent.GetStringArrayListExtra("MyData"); m_ViewName.Text = text.ElementAt(0); m_ViewAddress.Text = text.ElementAt(1); // Setting text color of textviews m_ViewName.SetTextColor(Android.Graphics.Color.Black); m_ViewAddress.SetTextColor(Android.Graphics.Color.Black); // Handling button contact m_BtControl.Click += delegate { if (ConnectedThread.m_Socket.IsConnected) { StartActivity(typeof(ControllerActivity)); } }; m_BtDisconnect.Click += delegate { ConnectedThread.Cancel(); StartActivity(typeof(MainActivity)); }; }
protected override void OnDestroy() { base.OnDestroy(); ConnectedThread.Cancel(); }
protected override void OnStop() { base.OnStop(); ConnectedThread.Cancel(); }