示例#1
0
 public MyPhoneStateListener(Context _context)
 {
     context         = _context;
     isBound         = false;
     Binder          = null;
     _last_CallState = CallState.Idle;
     seviceConection = new DetectorServiceConnection(this);
     context.BindService(new Intent(context, typeof(DetectorService)), seviceConection, Bind.None);
 }
示例#2
0
        protected override void OnResume()
        {
            base.OnResume();

            connector = new DetectorServiceConnection(this);
            BindService(new Intent(this.BaseContext, typeof(DetectorService)), connector, Bind.None);
            connector.BindComplete += (s, e) => {
                var service = Binder.GetService();
                service.NewKey   += OnKey;
                service.NewToken += OnToken;
                isBound           = true;
            };
        }
示例#3
0
        protected override void OnResume()
        {
            base.OnResume();
            connector = new DetectorServiceConnection(this);
            ToggleButton bt = FindViewById <ToggleButton> (Resource.Id.toggleButton1);

            BindService(new Intent(this.BaseContext, typeof(DetectorService)), connector, Bind.None);
            connector.BindComplete += OnBindComplete;
            //bt.Checked = Global.GetAppPreferences(this).Ready;

            DAL dal        = new DAL();
            var partitions = dal.GetAllPartitions();

            if (partitions.Find((part) => part.Activated) == null)
            {
                bt.Checked = false;
            }
            else
            {
                bt.Checked = true;
            }

            bt.CheckedChange += OnCheckedChange;
            //service.ToneDetected += OnToneDetected;

            lv_history = FindViewById <ListView> (Resource.Id.lv_history);

            history_adapter    = new HistoryGridAdapter(this, dal.GetTop10Events());
            lv_history.Adapter = history_adapter;

            lv_history.ItemClick += HistoryItemClicked;
            //bt.CheckedChange += OnToggleChecked;
            ISharedPreferences pref = Global.GetSharedPreferences(this);

            prefs_model = new PreferencesModel(pref);
            pref.RegisterOnSharedPreferenceChangeListener(this);
        }