private void Start(object sender, EventArgs eventArgs) { try { var DevTree = XDocument.Load(Assets.Open(configFile)); var mbnetOPSConfig = XDocument.Load(Assets.Open(opsConfigFile)); if (PollTask.Start(configFolder, serverIp, password, DevTree, mbnetOPSConfig, chLog, chShowDevStates)) { //tbStart.Enabled = false; //tbStop.Enabled = true; //miInit.Enabled = true; //tbClear.Enabled = true; //LoadListsForControl(DevTree, mbnetOPSConfig); aDevTree = DevTree; } else { PollTask = null; } } catch (Exception) { //MessageBox.Show("Не удалось открыть файл конфигурации!"); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); PollTask = new TPollTask(Assets); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FindViewById <Button>(Resource.Id.start_button).Click += Start; FindViewById <Button>(Resource.Id.impulse_button).Click += Impulse; }