Esempio n. 1
0
        public void InvokeAfterBootComplete()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(DataSource))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                var i = MyDataTable;

                MyDataTable.BootCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterBootComplete", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                // reset timer if needed
                if (MyDataTable.StartEarlier == 1)
                {
                    var that = this;
                    that.StartPendingAlarm(NotifyServiceFromTimer.Class, 1000 * 8, 1000 * 41);
                }

                c.Close();
            }
        }
Esempio n. 2
0
        public void Invoke(MyDataTable MyDataTable)
        {
            var InternalVersionCounter = MyDataTable.InternalVersionCounter;

            var LiteralVersion       = 101;
            var LiteralVersionString = "T-201";

            #region increment InternalVersionCounter in case literal version changes
            if (MyDataTable.InternalVersion != LiteralVersion)
            {
                MyDataTable.InternalVersion = LiteralVersion;
                MyDataTable.InternalVersionCounter++;
            }

            if (!MyDataTable.InternalVersionString.StringEquals(LiteralVersionString))
            {
                MyDataTable.InternalVersionString = LiteralVersionString;
                MyDataTable.InternalVersionCounter++;
            }

            #endregion



            if (MyDataTable.InternalVersionCounter != InternalVersionCounter)
            {
                Notify("New Version Trigger", "InternalVersionCounter has changed!");
            }
        }
Esempio n. 3
0
            public void onCheckedChanged(CompoundButton cb, bool value)
            {
                that.ShowToast("cb_onchanged");

                using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
                {
                    c.Open();

                    var MyDataTable = new MyDataTable(c);

                    if (value)
                    {
                        MyDataTable.StartEarlier = 1;

                        that.StartPendingAlarm(NotifyServiceFromTimer.Class, 1000 * 8, 1000 * 41);

                        that.startservice.setEnabled(false);
                        that.stopservice.setEnabled(true);
                    }
                    else
                    {
                        MyDataTable.StartEarlier = 0;

                        that.CancelPendingAlarm(NotifyServiceFromTimer.Class);

                        that.startservice.setEnabled(true);
                        that.stopservice.setEnabled(false);
                    }

                    c.Close();
                }
            }
Esempio n. 4
0
        public void InvokeAfterTimer()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                MyDataTable.TimerCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterTimer", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                c.Close();
            }
        }
Esempio n. 5
0
        public void InvokeAfterActivity()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(DataSource))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                var i = MyDataTable;

                MyDataTable.ActivityCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterActivity", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                c.Close();
            }
        }
        public void InvokeAfterBootComplete()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(DataSource))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                var i = MyDataTable;

                MyDataTable.BootCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterBootComplete", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                // reset timer if needed
                if (MyDataTable.StartEarlier == 1)
                {
                    var that = this;
                    that.StartPendingAlarm(NotifyServiceFromTimer.Class, 1000 * 8, 1000 * 41);
                }

                c.Close();

            }

        }
        public void InvokeAfterActivity()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(DataSource))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                var i = MyDataTable;

                MyDataTable.ActivityCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterActivity", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                c.Close();

            }



        }
        public void InvokeAfterTimer()
        {
            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                MyDataTable.TimerCounter++;
                MyDataTable.InvokeCounter++;

                Invoke(MyDataTable);

                Notify("InvokeAfterTimer", MyDataTable.ToString(), MyDataTable.InvokeCounter);

                c.Close();

            }



        }
        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // this activity 
            // check for db table
            // 
            //  shall resume on boot
            //  shall recheck every n seconds
            //  shall remember the last result
            //  shall remember how many iterations
            //  shall remember how many boots

            base.onCreate(savedInstanceState);

            #region setContentView
            ScrollView sv = new ScrollView(this);
            LinearLayout ll = new LinearLayout(this);
            ll.setOrientation(LinearLayout.VERTICAL);
            sv.addView(ll);

            var that = (Context)this;

            this.CancelPendingAlarm(NotifyServiceFromTimer.Class);


            #region startservice
            startservice = new Button(this);
            startservice.setText("Start Timer");
            startservice.setOnClickListener(
                new startservice_onclick { that = this }
            );
            ll.addView(startservice);
            #endregion

            #region stopservice
            stopservice = new Button(this);
            stopservice.setText("Stop Timer");
            stopservice.setEnabled(false);
            stopservice.setOnClickListener(
                new stopservice_onclick { that = this }
            );
            ll.addView(stopservice);
            #endregion


            CheckBox cb = new CheckBox(this);

            cb.setText("Start the timer earlier!");
            cb.setOnCheckedChangeListener(new cb_onchanged { that = this });

            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                cb.setChecked(MyDataTable.StartEarlier == 1);

                c.Close();


            }

            ll.addView(cb);

            this.setContentView(sv);
            #endregion



            var intent = new Intent(this, NotifyServiceFromActivity.Class);
            this.startService(intent);

        }
        public void Invoke(MyDataTable MyDataTable)
        {
            var InternalVersionCounter = MyDataTable.InternalVersionCounter;

            var LiteralVersion = 101;
            var LiteralVersionString = "T-201";

            #region increment InternalVersionCounter in case literal version changes
            if (MyDataTable.InternalVersion != LiteralVersion)
            {
                MyDataTable.InternalVersion = LiteralVersion;
                MyDataTable.InternalVersionCounter++;
            }

            if (!MyDataTable.InternalVersionString.StringEquals(LiteralVersionString))
            {
                MyDataTable.InternalVersionString = LiteralVersionString;
                MyDataTable.InternalVersionCounter++;
            }

            #endregion



            if (MyDataTable.InternalVersionCounter != InternalVersionCounter)
            {
                Notify("New Version Trigger", "InternalVersionCounter has changed!");
            }
        }
            public void onCheckedChanged(CompoundButton cb, bool value)
            {
                that.ShowToast("cb_onchanged");

                using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
                {
                    c.Open();

                    var MyDataTable = new MyDataTable(c);

                    if (value)
                    {
                        MyDataTable.StartEarlier = 1;

                        that.StartPendingAlarm(NotifyServiceFromTimer.Class, 1000 * 8, 1000 * 41);

                        that.startservice.setEnabled(false);
                        that.stopservice.setEnabled(true);
                    }
                    else
                    {
                        MyDataTable.StartEarlier = 0;

                        that.CancelPendingAlarm(NotifyServiceFromTimer.Class);

                        that.startservice.setEnabled(true);
                        that.stopservice.setEnabled(false);
                    }

                    c.Close();


                }
            }
Esempio n. 12
0
        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // this activity
            // check for db table
            //
            //  shall resume on boot
            //  shall recheck every n seconds
            //  shall remember the last result
            //  shall remember how many iterations
            //  shall remember how many boots

            base.onCreate(savedInstanceState);

            #region setContentView
            ScrollView   sv = new ScrollView(this);
            LinearLayout ll = new LinearLayout(this);
            ll.setOrientation(LinearLayout.VERTICAL);
            sv.addView(ll);

            var that = (Context)this;

            this.CancelPendingAlarm(NotifyServiceFromTimer.Class);


            #region startservice
            startservice = new Button(this);
            startservice.setText("Start Timer");
            startservice.setOnClickListener(
                new startservice_onclick {
                that = this
            }
                );
            ll.addView(startservice);
            #endregion

            #region stopservice
            stopservice = new Button(this);
            stopservice.setText("Stop Timer");
            stopservice.setEnabled(false);
            stopservice.setOnClickListener(
                new stopservice_onclick {
                that = this
            }
                );
            ll.addView(stopservice);
            #endregion


            CheckBox cb = new CheckBox(this);

            cb.setText("Start the timer earlier!");
            cb.setOnCheckedChangeListener(new cb_onchanged {
                that = this
            });

            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                cb.setChecked(MyDataTable.StartEarlier == 1);

                c.Close();
            }

            ll.addView(cb);

            this.setContentView(sv);
            #endregion



            var intent = new Intent(this, NotifyServiceFromActivity.Class);
            this.startService(intent);
        }