private void OnVisteon() { List<string> arrays = new List<string>(); arrays.Add(StaticString.beforeBlank + Database.GetText("Read Trouble Code", "System")); arrays.Add(StaticString.beforeBlank + Database.GetText("Clear Trouble Code", "System")); arrays.Add(StaticString.beforeBlank + Database.GetText("Read Data Stream", "System")); //arrays.Add(StaticString.beforeBlank + Database.GetText("Static Data Stream", "System")); arrays.Add(StaticString.beforeBlank + Database.GetText("Read Freeze Frame", "System")); //arrays.Add(Database.GetText("Activity Test")); //arrays.Add(Database.GetText("ECU Version")); funcs = new Dictionary<string, ProtocolFunc>(); funcs.Add(Database.GetText("Read Trouble Code", "System"), () => { Intent intent = new Intent(this, typeof(TroubleCodeActivity) ); intent.PutExtra("Model", model); StartActivity(intent); } ); funcs.Add(Database.GetText("Clear Trouble Code", "System"), () => { ProgressDialog status = DialogManager.ShowStatus(this, Database.GetText("Clearing Trouble Code, Please Wait", "System")); AlertDialog fatal; Task task = Task.Factory.StartNew(() => { if (!Manager.Commbox.Close() || !Manager.Commbox.Open()) { throw new IOException(Database.GetText("Open Commbox Fail", "System")); } Visteon protocol = new Visteon(Diag.BoxFactory.Instance.Commbox); protocol.ClearTroubleCode(); }); task.ContinueWith((t) => { RunOnUiThread(() => { status.Dismiss(); if (t.IsFaulted) { fatal = DialogManager.ShowFatal(this, t.Exception.InnerException.Message, null); } else { fatal = DialogManager.ShowFatal(this, Database.GetText("Clear Trouble Code Finish", "System"), null); } }); }); }); funcs.Add(Database.GetText("Read Data Stream", "System"), () => { //Intent intent = new Intent(this, typeof(DataStreamSelectedActivity)); Intent intent = new Intent(this, typeof(DataStreamActivity)); intent.PutExtra("Model", model); StartActivity(intent); } ); // Read Data Stream //funcs.Add(StaticString.beforeBlank + Database.GetText("Static Data Stream", "System"), () => //{ // Manager.LiveDataVector = Database.GetLiveData("Visteon"); // Intent intent = new Intent(this, typeof(StaticDataStreamActivity)); // intent.PutExtra("Model", model); // StartActivity(intent); //}); funcs.Add(Database.GetText("Read Freeze Frame", "System"), () => { Intent intent = new Intent(this, typeof(DataStreamActivity)); intent.PutExtra("Model", model + "Freeze"); StartActivity(intent); } ); // Freeze Frame //funcs.Add(Database.GetText("ECU Version"), () => //{ // try // { // RunOnUiThread(() => DialogManager.Instance.StatusDialogShow(this, Database.GetText("Reading ECU Version, Please Wait"))); // string version = ""; // Synerject protocol = new Synerject(Database, Diag.BoxFactory.Instance.Commbox); // version = protocol.ReadECUVersion(); // RunOnUiThread(() => DialogManager.Instance.FatalDialogShow(this, version, null)); // } // catch (System.IO.IOException ex) // { // RunOnUiThread(() => DialogManager.Instance.FatalDialogShow(this, ex.Message, null)); // } //} //); // ECU Version ListAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, arrays); ListView.ItemClick += OnItemClick; }
private void OnVisteonProtocol() { status = DialogManager.ShowStatus(this, Database.GetText("Communicating", "System")); Manager.LiveDataVector = Database.GetLiveData("Visteon"); Core.LiveDataVector vec = Manager.LiveDataVector; task = Task.Factory.StartNew(() => { if (!Manager.Commbox.Close() || !Manager.Commbox.Open()) { throw new IOException(Database.GetText("Open Commbox Fail", "System")); } Visteon protocol = new Visteon(Manager.Commbox); protocol.StaticDataStream(vec); }); task.ContinueWith((t) => { ShowResult(t); }); }
private void OnVisteonProtocol() { status = DialogManager.ShowStatus(this, Database.GetText("Communicating", "System")); Task task = Task.Factory.StartNew(() => { if (!Manager.Commbox.Close() || !Manager.Commbox.Open()) { throw new IOException(Database.GetText("Open Commbox Fail", "System")); } Visteon protocol = new Visteon(Manager.Commbox); codes = protocol.ReadTroubleCode(); }); task.ContinueWith((t) => {ShowResult(t, (sender, e) => this.Finish());}); }
private void OnVisteonFreezeProtocol() { status = DialogManager.ShowStatus(this, Database.GetText("Communicating", "System")); task = Task.Factory.StartNew(() => { Manager.LiveDataVector = Database.GetLiveData("Visteon Freeze"); PreparePage(); if (!Manager.Commbox.Close() || !Manager.Commbox.Open()) { throw new IOException(Database.GetText("Open Commbox Fail", "System")); } visteon = new Visteon(Diag.BoxFactory.Instance.Commbox); visteon.ReadFreezeFrame(Manager.LiveDataVector); }); task.ContinueWith(ShowFault); }