public ContactsDetailsPage(SurveyQuestion tap) { var fullName = new Label { Text = tap.Question }; // var sharedText = new Label { Text = tap.SharedText }; Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(20), Children = { fullName // , sharedText } }; }
//NEW add a new survey question - do this here...and on the "AddTapPage.cs" public async Task DeleteSurveyQuestionAsync(SurveyQuestion question) { await InitializeAsync(); // throw new NotImplementedException (); //if (string.IsNullOrEmpty (question.Id)) { // await questionsTable.InsertAsync (question); //} await questionsTable.DeleteAsync(question); System.Diagnostics.Debug.WriteLine("Pending operations in the sync context queue: {0}", client.SyncContext.PendingOperations); //var localItems = await questionsTable.Select (i => i.Answers).ToListAsync(); //System.Diagnostics.Debug.WriteLine ("Local table): { 0}", string.Join (", ", localItems)); // await client.SyncContext.PushAsync (); await SynchronizeQuestionsAsync(question.Id); //(response.SurveyQuestionId); System.Diagnostics.Debug.WriteLine("Pending operations in the sync context queue: {0}", client.SyncContext.PendingOperations); }
public ThoughtAndPrayerDetailPageTwo(SurveyQuestion tap) { publicTap = tap; var sharedText = new Label { Text = tap.SharedText }; //var fullName = new Label { Text = tap.Question }; // var sharedText = new Label { Text = tap.SharedText }; //System.Random random = new Random (); //string randomNumber = string.Join (string.Empty, Enumerable.Range (0, 10).Select (number => random.Next (0, 5).ToString ())); //// int x = Convert.ToInt32 (randomNumber); //int theX; //Int32.TryParse (randomNumber, out theX);// (randomNumber); //int y = theX + 5; //string biggerRandomNumberString = y.ToString (); //DateTime dt = DateTime.Now; //CultureInfo ci = new CultureInfo ("en-US"); //string sampleDateTimeString = dt.ToString ("MMM d h:mm tt", ci); //thinkingOfYousList = new List<ThinkingOfYou> () //{ // new ThinkingOfYou () // { // //id = randomNumber, // id = "24", // FirstName = "First", // LastName = "Last", // SharedText = "Jimmy is thinking of you!", // NewText = "New Text", // FBProfileUrl = "http://graph.facebook.com/450/picture?type=small", // theFBID = "1", // thePrayerRequestId = "1", // CreateDateString = sampleDateTimeString// "http://graph.facebook.com/450/picture?type=small" //// string URLSmall = String.Format ("http://graph.facebook.com/{0}/picture?type=small", _profileId); //// string URLLarge = String.Format ("http://graph.facebook.com/{0}/picture?type=large", _profileId); ////string URLNormal = String.Format ("http://graph.facebook.com/{0}/picture?type=normal", _profileId); ////string URLSquare = String.Format ("http://graph.facebook.com/{0}/picture?type=square", _profileId); ////string URLSmall = String.Format ("http://graph.facebook.com/{0}/picture?type=small", _profileId); // }, // new ThinkingOfYou () // { // //id = biggerRandomNumberString, // id = "25", // FirstName = "First", // LastName = "Last", // SharedText = "Sally is praying for you :)", // NewText = "New Text", // FBProfileUrl = "http://graph.facebook.com/450/picture?type=small", // theFBID = "1", // thePrayerRequestId = "1", // CreateDateString = sampleDateTimeString // } //}; thinkingOfYouListView = new ListView() { BackgroundColor = Color.Transparent, HasUnevenRows = true //ItemTemplate = new DataTemplate (() => { // var tapNativeCell = new tapNativeCell (); // return tapNativeCell; //}) }; // thinkingOfYouListView.ItemTemplate = new DataTemplate (typeof (ImageCell)); // has context actions defined //// thinkingOfYouListView.ItemTemplate = new DataTemplate (typeof (TextCell)); // has context actions defined // //var template = new DataTemplate (typeof (TextCell)); // has context actions defined var template = new DataTemplate(typeof(tapNativeCell)); thinkingOfYouListView.ItemTemplate = template; // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.ImageSourceProperty, "FBProfileUrl"); // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.TextProperty, "SharedText"); // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.DetailProperty, "CreateDateString"); // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.ImageSourceProperty, "FBProfileUrl"); // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.TextProperty, "SharedText"); // thinkingOfYouListView.ItemTemplate.SetBinding (ImageCell.DetailProperty, "CreateDateString"); // //template.SetBinding (ImageCell.TextProperty, "FullName"); // //template.SetBinding (ImageCell.DetailProperty, "FirstName"); //thinkingOfYouListView.ItemsSource = thinkingOfYousList; Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(20), Children = { sharedText, //, sharedText thinkingOfYouListView } }; //this.SetBinding (ContentPage.TitleProperty, "Name"); //NavigationPage.SetHasNavigationBar (this, true); //var nameLabel = new Label { Text = "Name" }; //var nameEntry = new Entry (); //nameEntry.SetBinding (Entry.TextProperty, "Name"); //var notesLabel = new Label { Text = "Notes" }; //var notesEntry = new Entry (); //notesEntry.SetBinding (Entry.TextProperty, "Notes"); //var doneLabel = new Label { Text = "Done" }; //var doneEntry = new Switch (); //doneEntry.SetBinding (Switch.IsToggledProperty, "Done"); //var saveButton = new Button { Text = "Save" }; //saveButton.Clicked += (sender, e) => { // var todoItem = (TodoItem)BindingContext; // App.Database.SaveItem (todoItem); // this.Navigation.PopAsync (); //}; //var deleteButton = new Button { Text = "Delete" }; //deleteButton.Clicked += (sender, e) => { // var todoItem = (TodoItem)BindingContext; // App.Database.DeleteItem (todoItem.ID); // this.Navigation.PopAsync (); //}; //var cancelButton = new Button { Text = "Cancel" }; //cancelButton.Clicked += (sender, e) => { // var todoItem = (TodoItem)BindingContext; // this.Navigation.PopAsync (); //}; //var speakButton = new Button { Text = "Speak" }; //speakButton.Clicked += (sender, e) => { // var todoItem = (TodoItem)BindingContext; // DependencyService.Get<ITextToSpeech> ().Speak (todoItem.Name + " " + todoItem.Notes); //}; //Content = new StackLayout { // VerticalOptions = LayoutOptions.StartAndExpand, // Padding = new Thickness (20), // Children = { // nameLabel, nameEntry, // notesLabel, notesEntry, // doneLabel, doneEntry, // saveButton, deleteButton, cancelButton, // speakButton // } //}; }
public AddTapPage() { this.Title = "Add a Prayer Request"; mySharedText.Text = "Hey guys, this is what's going on!"; mySharedText.Focused += myQuestion_Focused; mySharedText.Unfocused += myQuestion_Unfocused; //BUTTON Button submitButton = new StyledButton(StyledButton.Borders.Thin, 1); submitButton.Text = "Submit"; submitButton.HorizontalOptions = LayoutOptions.FillAndExpand; //loginButton.WidthRequest = 50; submitButton.Clicked += (sender, e) => { Device.BeginInvokeOnMainThread(() => { //Navigation.PushAsync (new SamplePage ()); System.Random random = new Random(); string randomNumber = string.Join(string.Empty, Enumerable.Range(0, 10).Select(number => random.Next(0, 5).ToString())); //public class Example // { // public static void Main () // { // DateTime localDate = DateTime.Now; // String [] cultureNames = { "en-US", "en-GB", "fr-FR", // "de-DE", "ru-RU" }; // foreach (var cultureName in cultureNames) { // var culture = new CultureInfo (cultureName); // Console.WriteLine ("{0}: {1}", cultureName, // localDate.ToString (culture)); // } // } // } // // The example displays the following output: // // en-US: 6/19/2015 10:03:06 AM // // en-GB: 19/06/2015 10:03:06 // // fr-FR: 19/06/2015 10:03:06 // // de-DE: 19.06.2015 10:03:06 // // ru-RU: 19.06.2015 10:03:06 //Works with Hi question //String introQuestion = "Question - hi there"; //DateTime timeNow = DateTime.Now; //var culture = new CultureInfo ("en-US"); //String stringTimeNow = timeNow.ToString (culture); //SurveyQuestion oneSurveyQuestion = new SurveyQuestion () //{ // Id = randomNumber, //// Id = "1234567891234", // Question = String.Format("{0} at {1}", introQuestion, stringTimeNow ), // Answers = "Answer - hi there" //}; //Works with a submit button String introQuestion = "Question - hi there"; DateTime dt = DateTime.Now; //var culture = new CultureInfo ("en-US"); //String stringTimeNow = timeNow.ToString (culture); CultureInfo ci = new CultureInfo("en-US"); string sampleDateTimeString = dt.ToString("MMM d h:mm tt", ci); // dt.ToString ("MMM d", ci); SurveyQuestion oneSurveyQuestion = new SurveyQuestion() { Id = randomNumber, // Id = "1234567891234", Question = "My question text", //myQuestion.Text, // String.Format ("{0} at {1}", introQuestion, stringTimeNow), Answers = "Answer - hi there", FirstName = "A", // firstName.Text, LastName = "C", // lastName.Text, FullName = String.Format("{0} {1}", firstName.Text, lastName.Text), SharedText = mySharedText.Text, //this is the field that gets updated in Azure, FBProfileUrl = AppConstants.FullURLPlusFBIdentityID, CreateDateString = sampleDateTimeString }; App.Service.AddOrUpdateSurveyQuestionAsync(oneSurveyQuestion); //App.Service.SynchronizeQuestionsAsync (oneSurveyQuestion.Id); //AppConstants.NeedsUpdating == false; AppConstants.NeedsUpdating = true; Navigation.PopModalAsync(); //Navigation.PushAsync (new NavigationPage (new SamplePage ()) { //BarBackgroundColor = Color.Black } ); //FromHex ("#298555") // //Navigation. }); }; Button cancelButton = new StyledButton(StyledButton.Borders.Thin, 1); cancelButton.Text = "Cancel"; cancelButton.HorizontalOptions = LayoutOptions.FillAndExpand; cancelButton.Clicked += (sender, e) => { Device.BeginInvokeOnMainThread(() => { //Navigation.PushAsync (new SamplePage ()); Navigation.PopModalAsync(); //Navigation.PushAsync (new NavigationPage (new SamplePage ()) { //BarBackgroundColor = Color.Black } ); //FromHex ("#298555") // //Navigation. }); }; StackLayout myEnterTextStacklayout = new StackLayout { //Padding = new Thickness (10, 10, 10, 10), VerticalOptions = LayoutOptions.Start, // HorizontalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { //new Label { Text = "Tell your friends what's on your mind" }, //prompt, myQuestion, fnPrompt, firstName, lnPrompt, lastName, mST, mySharedText, submitButton, cancelButton //prompt, myQuestion, fnPrompt, firstName, lnPrompt, lastName, mST, mySharedText } }; StackLayout myButtonStacklayout = new StackLayout { Padding = new Thickness(10, 10, 10, 10), Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Start, // HorizontalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { cancelButton, submitButton } }; Content = new StackLayout { Padding = new Thickness(10, 50, 10, 10), VerticalOptions = LayoutOptions.Start, // HorizontalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { myEnterTextStacklayout, myButtonStacklayout } }; }