示例#1
0
        // Add an event to the database and collections.
        public void AddScreenObscurtionEvent(ScreenObscurtionEvent newEvent)
        {
            // Add an event to the data context.
            eventsDB.ScreenObscurtionEvents.InsertOnSubmit(newEvent);

            // Save changes to the database.
            eventsDB.SubmitChanges();

            // Add an event to the observable collection.
            Events.Add(newEvent);
        }
示例#2
0
        // Obscured correspond à un appui sur le bouton lock screen, donc il représente également Unobscured quand l'écran était éteint.
        void OnObscured(Object sender, ObscuredEventArgs e)
        {
            ScreenObscurtionEvent ob = new ScreenObscurtionEvent { Type = Database.EventType.Obscurtion, Date = DateTime.Now };
            list.Add(ob);
            System.Diagnostics.Debug.WriteLine("ob");
            ScreenObscurtionEvent screenEvent;

            if (_isScreenObscured)
            {
                screenEvent = new ScreenObscurtionEvent { Type = Database.EventType.Obscurtion, Date = DateTime.Now };
                _isScreenObscured = false;
                txtUnobs.Text = "Unobscured at " + DateTime.Now.ToString();
                System.Diagnostics.Debug.WriteLine("Unobscured.");
            }
            else
            {
                screenEvent = new ScreenObscurtionEvent { Type = Database.EventType.Unobscurtion, Date = DateTime.Now };
                _isScreenObscured = true;
                txtObs.Text = "Obscured at " + DateTime.Now.ToString();
                System.Diagnostics.Debug.WriteLine("Obscured.");
            }

            App.DatabaseAccess.AddScreenObscurtionEvent(screenEvent);
        }