public EventCreateViewModel(IMyNavigationService navigationService)
        {
            var database = new NoteDatabase();

            SaveNoteCommand = new Command(() => {
                Event.Attendees = "";
                foreach (Person p in people)
                {
                    Event.Attendees += p.NoteId + ",";
                }
                Event.Attendees = Event.Attendees.Trim(',');
                var cal         = new MyCalendar();

                if (!(Event.CalId <= 0))
                {
                    cal.removeSystemCal(Event.CalId);
                }
                //Debug.WriteLine(Event.TimeStamp);
                long newid  = cal.addToSystemCal(Event.TimeStamp, Event.titleText, Event.NoteDetail, Event.LocationText);
                Event.CalId = newid;
                //Debug.WriteLine(Event.TimeStamp);
                Event.TimeStamp = Event.TimeStamp.AddHours(10);                //stop the database messing up dates
                database.InsertOrUpdateNote(Event);
                //Debug.WriteLine(database.GetNote(id).TimeStamp);
                navigationService.GoBack();
            });
        }
        public EventCreateViewModel(IMyNavigationService navigationService)
        {
            var database = new NoteDatabase();
            SaveNoteCommand = new Command (() => {
                Event.Attendees = "";
                foreach(Person p in people){
                    Event.Attendees += p.NoteId + ",";
                }
                Event.Attendees = Event.Attendees.Trim(',');
                var cal = new MyCalendar ();

                if(! (Event.CalId <= 0)){
                    cal.removeSystemCal(Event.CalId);
                }
                //Debug.WriteLine(Event.TimeStamp);
                long newid = cal.addToSystemCal(Event.TimeStamp, Event.titleText, Event.NoteDetail, Event.LocationText);
                Event.CalId = newid;
                //Debug.WriteLine(Event.TimeStamp);
                Event.TimeStamp = Event.TimeStamp.AddHours(10);//stop the database messing up dates
                database.InsertOrUpdateNote(Event);
                //Debug.WriteLine(database.GetNote(id).TimeStamp);
                navigationService.GoBack();
            });
        }
Ejemplo n.º 3
0
        public static void SaveToken(string token)
        {
            _Token = token;
            var database = new NoteDatabase ();
            database.InsertOrUpdateToken(new Tconnect.Data.Token("Yammer",token));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("Calendar","1"));
            MyCalendar.ImportCalendar ();
            MyCalendar.ImportContacts ();

            MyCalendar cal = new MyCalendar ();
            Debug.WriteLine ("ruight herjelkfjsd tohooooooooooooo");
            String[] s = cal.getUserDeets (token);

            database.InsertOrUpdateToken(new Tconnect.Data.Token("fname",s[0]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("lname",s[1]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("email",s[2]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("phone",s[3]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("org",s[4]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("uid",s[5]));
            database.InsertOrUpdateToken(new Tconnect.Data.Token("profilepicture",s[6]));

            // { fname, lname, email, phone, org, uid, profilepicture };
            Debug.WriteLine ("oi we got here m8");
            //Person p = new Person (s [0], s [1], s [2], s [3], s [4], s [5], s [6]);
            //p.NoteId = 0;
            //database.InsertOrUpdatePerson (p);
            //Debug.WriteLine ("afftaahh:: " + database.GetPerson(0).Name);
        }
Ejemplo n.º 4
0
 private void dochecks()
 {
     //Login
     if (!IsLoggedIn) {
         var database = new NoteDatabase ();
         if (database.HasToken ("Yammer")) {
             var t = database.GetToken ("Yammer");
             if (t != null) {
                 _Token = t.Value;
             }
             Debug.WriteLine (_Token);
         }
     }
     if (IsLoggedIn) {
         MyCalendar.ImportCalendar ();
     }
 }
 public void OnAppearing()
 {
     if (id > 0) {
         var database = new NoteDatabase ();
         Event = database.GetNote (id);
         //Debug.WriteLine (Event.TimeStamp);
         people = new List<Person> ();
         if (Event.Attendees.Contains (",")) {
             var p = Event.Attendees.Split (',');
             foreach (string me in p) {
                 var who = database.GetPerson (int.Parse (me));
                 people.Add (who);
             }
         } else {
             int p;
             if (int.TryParse (Event.Attendees,out p)) {
                 var who = database.GetPerson (p);
                 people.Add (who);
             }
         }
         RaisePropertyChanged(() => People);
         RaisePropertyChanged (() => Event);
     }
     //RaisePropertyChanged (() => Event);
 }
Ejemplo n.º 6
0
		public MyCalendar ()
		{
			calendar = DependencyService.Get<ICalendarInterface> ();
			database = new NoteDatabase();
		}
Ejemplo n.º 7
0
 public MyCalendar()
 {
     calendar = DependencyService.Get <ICalendarInterface> ();
     database = new NoteDatabase();
 }