public GestionePreferitiView() { _db = new DbSQLite(); Title = "Corsi Preferiti"; Icon = null; Content = getView(); }
public SelectGiornaliero() { _db = new DbSQLite(); Title = "Giornaliero"; Content = getView(); }
public MieiCorsiCell() { _db = new DbSQLite(); _service = new AzureDataService(); setUpContextAction(); View = getView(); }
public OrarioGiornaliero() { _db = new DbSQLite(); this.SetBinding(ContentPage.TitleProperty, "FacoltaString"); Content = getView(); }
public OrarioGiornCell() { _db = new DbSQLite(); _service = new AzureDataService(); setUpContextAction(); View = getView(); }
public ImpostazioniView() { Title = "Impostazioni"; Icon = null; _db = new DbSQLite(); Content = getView(); }
public OrarioComplCellGroup() { _db = new DbSQLite(); _service = new AzureDataService(); setUpContextAction(); View = getView(); }
public ListaCorsi(List <CorsoCompleto> lista_completo) { Title = "Corsi"; _db = new DbSQLite(); //BackgroundColor = ColorHelper.White; _listSource = lista_completo; Content = getView(); }
public TabbedDayView() { _db = new DbSQLite(); this.SetBinding(ContentPage.TitleProperty, "Day"); Logcat.Write(string.Format("{0}: {1}", "TABBEDDAYVIEW", "before content")); //Content = getView(); Content = getPullToRefreshView(); }
//private ToolbarItem tbiSync; #endregion #region Constructor public TabbedHomeView() { _db = new DbSQLite(); _service = new AzureDataService(); Logcat.Write("COUNT: " + _db.GetAllMieiCorsi().Count()); this.Title = "Home"; //IdentifyingUser (); //IDENTIFYING USER DISABLE!! //BackgroundColor = ColorHelper.White; Logcat.Write(string.Format("{0}: {1}", "TabbedHomeView", "costruttore")); checkDays(); //controllo che giorni sono necessari nelle tab //RIMOSSO PER DEBUG!! //loadListCorsiGiorno(); //carico la lista dei giorni this.ItemTemplate = new DataTemplate(() => { return(new TabbedDayView()); }); //tbiSync = new ToolbarItem("Sync", "ic_sync.png", sync, 0, 0); //ToolbarItems.Add(tbiSync); MessagingCenter.Subscribe <TabbedDayView>(this, "delete_corso", (sender) => { loadListCorsiGiorno(); }); MessagingCenter.Subscribe <OrarioFavCell> (this, "delete_corso_fav", (sender) => { loadListCorsiGiorno(); }); MessagingCenter.Subscribe <OrarioFavCell> (this, "delete_corso_fav_impostazioni", (sender) => { loadListCorsiGiorno(); }); MessagingCenter.Subscribe <TabbedDayView, int>(this, "pullToRefresh", (sender, x) => { //serve per refreshare i corsi nella tabbed day view //this.SelectedItem = null; loadListCorsiGiorno(); }); //MessagingCenter.Subscribe<OrarioGiornCell>(this, "delete_corso_context", deleteMioCorsoContext); //MessagingCenter.Subscribe<TabbedDayView>(this, "delete_corso", loadListCorsiGiorno()); }
protected override async void OnHandleIntent(Android.Content.Intent intent) { db = new DbSQLite(); System.Diagnostics.Debug.WriteLine("START SERVICE"); _intent = intent; DateTime date; if (DateTime.Now.Hour > 18) { date = DateTime.Now.AddDays(1); } else { date = DateTime.Now; } string s = await Web.GetOrarioGiornaliero("IN", 1, 19, date.ToString("dd'/'MM'/'yyyy")); List <CorsoGiornaliero> lista = Web.GetSingleOrarioGiornaliero(s, 0); /* * lista dei corsi salvati. Scandisco ogni elemento della lista con la lista di tutti i corsi di giornata * se insegnamento+ora sono uguali, verifico se le Note cambiano. Se cambiano, la salvo nel database e invio la notifica * */ foreach (var l in lista) { foreach (var x in db.GetItems()) { if (l.Insegnamento == x.Insegnamento) { x. SendNotification(l); } } } // Release the wake lock provided by the BroadcastReceiver. SampleAlarmReceiver.CompleteWakefulIntent(intent); }
// public SampleSchedulingService() : base("SchedulingIntentService") // { } protected async override void OnHandleIntent(Android.Content.Intent intent) { Logcat.Write("ALARM: " + DateTime.Now.ToLongTimeString()); _db = App.Database; if (_db == null) { App.Init(new DbSQLite(new SQLite_Android().GetConnection())); _db = App.Database; // if (_db == null) // Logcat.Write ("_db ancora NULL dopo INIT"); // else // Logcat.Write ("_db NOT NULL dopo INIT"); } else { Logcat.Write("_db NOT NULL"); } Logcat.WriteDB(_db, "Allarme attivato"); Logcat.Write("NUMERO MIEI CORSI: " + _db.GetAllMieiCorsi().Count()); _intent = intent; //_listOrariGiorno = _db.GetAllOrari(); Logcat.Write("Updating Date Time"); if (DateTime.Now.Hour > Settings.UpdateHour) // && DateTime.Now.Minute > Settings.UpdateMinute) { _oggi = new DayViewModel() { Data = DateTime.Today.AddDays(1) }; _domani = new DayViewModel() { Data = _oggi.Data.AddDays(1) }; _dopodomani = new DayViewModel() { Data = _domani.Data.AddDays(1) }; } else { _oggi = new DayViewModel() { Data = DateTime.Today }; _domani = new DayViewModel() { Data = _oggi.Data.AddDays(1) }; _dopodomani = new DayViewModel() { Data = _domani.Data.AddDays(1) }; } if (!CrossConnectivity.Current.IsConnected) { //non connesso a internet Logcat.WriteDB(_db, "*************ERRORE"); Logcat.WriteDB(_db, "AGGIORNAMENTO NON RIUSCITO, nessun accesso a internet"); Logcat.Write("AGGIORNAMENTO NON RIUSCITO, nessun accesso a internet"); //var toast = DependencyService.Get<IToastNotificator>(); //await toast.Notify (ToastNotificationType.Error, "Errore", "Nessun accesso a internet", TimeSpan.FromSeconds (3)); return; } /*SYNCRONIZZAZIONE BACKGROUND * lista dei corsi salvati. Scandisco ogni elemento della lista con la lista di tutti i corsi di giornata * se insegnamento+ora sono uguali, verifico se le Note cambiano. Se cambiano, la salvo nel database e invio la notifica * */ try { for (int i = 0; i < 3; i++) { Logcat.WriteDB(_db, string.Format("Tentativo {0} - SyncAzure", i + 1)); var success = await _db.SynchronizeAzureDb(); if (!success) { Logcat.WriteDB(_db, "*************ERRORE"); Logcat.WriteDB(_db, "SINCRONIZZAZIONE AZURE NON RIUSCITA, nessun accesso a internet"); //RETRYING?? continue; //riprovo //return; } Logcat.WriteDB(_db, "---Autenticazione avvenuta con succeso!"); await updateDbOrariUtenza(); break; //se autenticazione avvenuta con successo, esco dal ciclo } } catch (Exception ex) { Logcat.WriteDB(_db, ex.Message); Logcat.Write(ex.Message); } // Release the wake lock provided by the BroadcastReceiver. SampleAlarmReceiver.CompleteWakefulIntent(intent); }
public static void WriteDB(DbSQLite db, string log) { db.InsertLog(log); }
private async void _btnAccedi_Clicked(object sender, EventArgs e) { await _service.Initialize(); _btnAccedi.IsVisible = false; _lblSalta.IsVisible = false; _lblAlert.IsVisible = true; _activityIndicator.IsVisible = true; _lblAlert.Text = string.Format("Accesso in corso"); var user = await DependencyService.Get <IAuthentication>().LoginAsync(_service.MobileService, MobileServiceAuthenticationProvider.Google); _lblAlert.Text = string.Format("Sto ottenendo le tue informazioni"); //aggiunge utente alla tabella var isNewUser = await addUser(); //**NELL'IMPLEMENTAZIONE Dell'authentication //Settings.Email = user.Message.Email; //Settings.Username = Settings.Email.Split('@')[0]; //Settings.Name = user.Message.Name; //Settings.SocialId = user.Message.SocialId; var name = Settings.Name; NavigationPage nav; //if informazioni facoltà, laurea, anno NON sono già presenti -> è il primo accesso -> information view //if (true) ///*********************************SOLO PER PROVA DEBUG TEST AZURE if (isNewUser || !checkUniversityInformation()) { nav = new NavigationPage(new InformationView() { Service = _service }) { BarBackgroundColor = ColorHelper.Blue700, BarTextColor = ColorHelper.White, }; Settings.SuccessLogin = true; await Navigation.PushModalAsync(nav); } else //altrimenti accedo direttamente { _lblAlert.Text = string.Format("Sto sincronizzando i tuoi dati"); _db = new DbSQLite(); var toast = DependencyService.Get <IToastNotificator>(); if (!CrossConnectivity.Current.IsConnected) { //non connesso a internet await toast.Notify(ToastNotificationType.Error, "Errore", "Nessun accesso a internet", TimeSpan.FromSeconds(3)); return; } var success = await _db.SynchronizeAzureDb(); if (!success) { await toast.Notify(ToastNotificationType.Error, "Errore", "Sincronizzazione fallita!", TimeSpan.FromSeconds(3)); } Settings.SuccessLogin = true; Settings.ToUpdate = true; if (Settings.BackgroundSync) { DependencyService.Get <INotification>().BackgroundSync(); } await Navigation.PushModalAsync(new MasterDetailView()); } }
/** * Aggiorna il singolo corso, verificando se appartiene ai corsi e in caso, aggiorna, aggiunge o notifica * */ public static void updateSingleCorso(DbSQLite _db, List <CorsoGiornaliero> listaCorsi) { foreach (var c in listaCorsi) { var corso = c; Logcat.Write("ORARI_UNIBG: prima di Check"); if (_db.CheckAppartieneMieiCorsi(c)) { //_db.InsertUpdate(l); var orario = new Orari() { Insegnamento = corso.Insegnamento, Codice = corso.Codice, AulaOra = corso.AulaOra, Note = corso.Note, Date = corso.Date, Docente = corso.Docente, }; if (_db.AppartieneOrari(orario)) //l'orario è già presente { Logcat.Write("Orario già PRESENTE nel DB: " + orario.Insegnamento); var o = _db.GetAllOrari().FirstOrDefault(y => y.Insegnamento == orario.Insegnamento && y.Date.Date == orario.Date.Date && orario.AulaOra == y.AulaOra); if ((string.Compare(o.Note, corso.Note) != 0) || !o.Notify) { o.Note = corso.Note; o.AulaOra = corso.AulaOra; if (o.Note != null && o.Note != "" && !o.Notify) { DependencyService.Get <INotification>().SendNotification(corso); o.Notify = true; } _db.Update(o); } } else // l'orario non è presente nel mio db { orario.Notify = false; Logcat.Write("Orario NUOVO" + orario.Insegnamento); if (orario.Note != null && orario.Note != "" && !orario.Notify) { DependencyService.Get <INotification>().SendNotification(corso); //SendNotification(corso); orario.Notify = true; } _db.Insert(orario); } } else if (corso.Insegnamento.Contains("UTENZA")) //verifico se è un utenza { Utenze ut = new Utenze() { Data = corso.Date, AulaOra = corso.AulaOra }; if (!_db.AppartieneUtenze(ut)) { _db.Insert(ut); } } } }
public LogView() { Title = "Log"; _db = new DbSQLite(); Content = getView(); }
public static void Init(DbSQLite sqlite) { Database = sqlite; }