Esempio n. 1
0
        private void Checkbutton_Click(object sender, EventArgs e)
        {
            Intent itent = new Android.Content.Intent((this), typeof(MainActivity));
            var    temp  = radioGroup.CheckedRadioButtonId;

            if (temp == radioButton1.Id)
            {
                Toast.MakeText(this, "English", ToastLength.Short).Show();
                templish[0] = "English";
                itent.PutStringArrayListExtra("settings", templish);
            }
            else if (temp == radioButton2.Id)
            {
                Toast.MakeText(this, "Russian", ToastLength.Short).Show();
                templish[0] = "Russian";
                itent.PutStringArrayListExtra("settings", templish);
            }
            else
            {
                Toast.MakeText(this, "Ukraine", ToastLength.Short).Show();
                templish[0] = "Ukraine";
                itent.PutStringArrayListExtra("settings", templish);
            }


            // itent.PutStringArrayListExtra("settings", list);

            StartActivity(itent);
        }
Esempio n. 2
0
 private void AddReply_Click(object sender, EventArgs e)
 {
     Intent myIntent = new Intent(this, typeof(AddReply));
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     myIntent.PutStringArrayListExtra("post id", postID);
     myIntent.PutStringArrayListExtra("query text", query);
     StartActivity(myIntent);
 }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            if (bundle == null)
            {
                bundle = new Bundle();
            }
            base.OnCreate(bundle);
            OnSaveInstanceState(bundle);

            var lang = Intent.GetStringArrayListExtra("settings");

            if (lang != null)
            {
                // Intent.PutStringArrayListExtra("settings", temp1);
                list = lang;
            }

            helperlanguage = new Helperlanguage(list[0], this);
            // Set our view from the "main" layout resource
            // SetContentView (Resource.Layout.Main);
            SetContentView(Resource.Layout.Main);
            button1         = FindViewById <Button>(Resource.Id.button1);
            ButtonLang      = FindViewById <Button>(Resource.Id.buttonLang);
            button1.Text    = helperlanguage.StartGame;
            ButtonLang.Text = helperlanguage.ChooseLanguage;

            //  button1.Background = new ColorStateList()
            Helperlanguage g = new Helperlanguage("English", this);



            button1.Click += delegate(object sender, EventArgs e)
            {
                var itent = new Android.Content.Intent((this), typeof(StartGame));
                var temp  = Intent.GetStringArrayListExtra("settings");
                if (temp != null)
                {
                    itent.PutStringArrayListExtra("settings", temp);
                    list = temp;
                }
                else
                {
                    itent.PutStringArrayListExtra("settings", list);
                }
                StartActivity(itent);
            };

            ButtonLang.Click += delegate(object sender, EventArgs e)
            {
                Intent itent = new Android.Content.Intent((this), typeof(ChooseLanguage));
                itent.PutStringArrayListExtra("settings", list);
                StartActivity(itent);
            };
        }
Esempio n. 4
0
 private void SchedAppt_Click(object sender, EventArgs e)
 {
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("04");
     recieved = myCore.messageHandler(data);
     Intent myIntent = new Intent(this, typeof(ScheduleAppointment));
     myIntent.PutStringArrayListExtra("doctor list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     StartActivity(myIntent);
 }
Esempio n. 5
0
 private void ViewPosts_Click(object sender, EventArgs e)
 {
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("08");
     recieved = myCore.messageHandler(data);
     Intent myIntent = new Intent(this, typeof(ViewForumPosts));
     myIntent.PutStringArrayListExtra("posts list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     StartActivity(myIntent);
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource.
            SetContentView (Resource.Layout.Main);

            // Get our UI controls from the loaded layout:
            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button> (Resource.Id.CallHistoryButton);

            // Disable the "Call" button.
            callButton.Enabled = false;

            // Add code to translate number.
            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) => {
                // Translate user's alphanumeric phone number to numeric.
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);

                if (String.IsNullOrWhiteSpace(translatedNumber)) {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                } else {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) => {
                // On "Call" button click, try to dial phone number.
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate {
                    // Add dialed number to list of called numbers.
                    phoneNumbers.Add(translatedNumber);

                    // Enable the Call History button.
                    callHistoryButton.Enabled = true;

                    // Create intent to dial phone.
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate {});

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) => {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
Esempio n. 7
0
 private void Login_Click(object sender, EventArgs e)
 {
     //declare variables for getting text from UI
     EditText usernameText = FindViewById<EditText>(Resource.Id.usernameText);
     EditText passwordText = FindViewById<EditText>(Resource.Id.passwordText);
     //EditText ipText = FindViewById<EditText>(Resource.Id.ipText);
     List<string> persistentData = new List<string>();
     persistentData.Add(ip);
     persistentData.Add(usernameText.Text);
     /*if (usernameText.Text == null)
         LoginFailedAlert("Username cannot be blank");
     if (usernameText.Text == null)
         LoginFailedAlert("Password cannot be blank");*/
     Core myCore = new Core(persistentData);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     data.Add("01");
     data.Add(usernameText.Text);
     data.Add(passwordText.Text);
     recieved = myCore.messageHandler(data);
     persistentData.Add(recieved[2]);
     //create new intent to start profile activity
     Intent myIntent = new Intent(this, typeof(ProfileActivity));
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     //Start profile activity is correct login data otherwise display incorrect username/password alert
     if (recieved[1] == "1")
     {
         StartActivity(myIntent);
     }
     else
     {
         LoginFailedAlert("Incorrect username or password. Please try again");
     }
 }
Esempio n. 8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton);

            // "Call" を Disable にします
            callButton.Enabled = false;
            // 番号を変換するコードを追加します。
            string translatedNumber = string.Empty;
            translateButton.Click += (object sender, EventArgs e) =>
            {
                // ユーザーのアルファベットの電話番号を電話番号に変換します。
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) =>
            {
                // "Call" ボタンがクリックされたら電話番号へのダイヤルを試みます。
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate
                {
                    // 掛けた番号のリストに番号を追加します。
                    phoneNumbers.Add(translatedNumber);
                    // Call History ボタンを有効にします。
                    callHistoryButton.Enabled = true;
                    // 電話への intent を作成します。
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate { });
                // アラートダイアログを表示し、ユーザーのレスポンスを待ちます。
                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
Esempio n. 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton);

            callButton.Enabled = false;

            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) =>
                {
                    translatedNumber = Phoneword.PhoneTranslator.ToNumber(phoneNumberText.Text);
                    if (string.IsNullOrWhiteSpace(translatedNumber))
                    {
                        callButton.Text = "Call";
                        callButton.Enabled = false;
                    }
                    else
                    {
                        callButton.Text = "Call " + translatedNumber;
                        callButton.Enabled = true;
                    }
                };

            callButton.Click += (object sender, EventArgs e) =>
                {
                    var callDialog = new AlertDialog.Builder(this);
                    callDialog.SetMessage("Call " + translatedNumber + "?");
                    callDialog.SetNeutralButton("Call", delegate
                    {
                        //Ajoute le numéro à la liste des numéros appelés
                        phoneNumbers.Add(translatedNumber);
                        //Active le bouton
                        callHistoryButton.Enabled = true;
                        //Crée un Intent pour lancer un appel
                        var callIntent = new Intent(Intent.ActionCall);
                        callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                        StartActivity(callIntent);
                    });
                    callDialog.SetNegativeButton("Cancel", delegate { });
                    callDialog.Show();
                };

            callHistoryButton.Click += (object sender, EventArgs e) =>
                {
                    var intent = new Intent(this, typeof(CallHistoryActivity));
                    intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                    StartActivity(intent);
                };
        }
Esempio n. 10
0
 protected override void OnListItemClick(ListView l, View v, int position, long id)
 {
     base.OnListItemClick(l, v, position, id);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     List<string> queryText = new List<string>();
     queryText.Add(contentDate[position].Split(',').First());
     Core myCore = new Core(persistentData);
     data.Add("09");
     data.Add(postID[position]);
     recieved = myCore.messageHandler(data);
     postID.Add(postID[position]);
     Intent myIntent = new Intent(this, typeof(ViewPostDetail));
     myIntent.PutStringArrayListExtra("replies list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     myIntent.PutStringArrayListExtra("post id", postID);
     myIntent.PutStringArrayListExtra("query text", queryText);
     StartActivity(myIntent);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.drukujRaport);
            // Create your application here

            var dataPoczatekButton = FindViewById<Button>(Resource.Id.dataPoczatekButton);
            dataPoczatekText = FindViewById<TextView>(Resource.Id.dataPoczatkowaText);
            var dataKoniecButton = FindViewById<Button>(Resource.Id.dataKoniecButton);
            dataKoniecText = FindViewById<TextView>(Resource.Id.dataKoniecText);
            var drukujButton = FindViewById<Button>(Resource.Id.drukujButton);
            var raportErrorText = FindViewById<TextView>(Resource.Id.reportErrorText);
            dataPoczatekText.Text = date[0].ToShortDateString();
            dataKoniecText.Text = date[1].ToShortDateString();
            var kategoriaSpinner = FindViewById<Spinner>(Resource.Id.kategoriaRaportSpinner);

            var data = PortfelBazaDanych.PobierzKategorie().ToArray();
            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, data);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            kategoriaSpinner.Adapter = adapter;

            dataPoczatekButton.Click += (sender, args) =>
            {
                raportErrorText.Text = "";
                ShowDialog(0);
            };

            dataKoniecButton.Click += (sender, args) =>
            {
                ShowDialog(1);
            };

            drukujButton.Click += (sender, e) =>
            {
                raportErrorText.Text = "";
                if (DateTime.Compare(date[1], date[0]) < 0)
                {
                    raportErrorText.Text = "Data poczatkowa musi byæ wczeœniej ni¿ data koñcowa";
                    return;
                }
                if (DateTime.Compare(DateTime.Now, date[0]) < 0 || DateTime.Compare(DateTime.Now, date[1]) < 0)
                {
                    raportErrorText.Text = "Daty nie moga byæ przysz³e";
                    return;
                }
                var wydatki = PortfelBazaDanych.PobierzWydatki(date[0], date[1], (string)kategoriaSpinner.SelectedItem);
                var raport = RaportBuilder.ZbudujRaport(wydatki);
                var intent = new Intent(this, typeof(RaportActivity));
                intent.PutStringArrayListExtra("wydatki", raport as IList<string>);
                StartActivity(intent);
            };
        }
Esempio n. 12
0
 private void replyQueryMessage(string message)
 {
     AlertDialog.Builder alert = new AlertDialog.Builder(this);
     alert.SetTitle(message);
     alert.SetPositiveButton("Ok", (senderAlert, args) =>
     {
         Intent intent = new Intent(this, typeof(ForumActivity));
         intent.PutStringArrayListExtra("persistent data", persistentData);
         StartActivity(intent);
     });
     RunOnUiThread(() =>
     {
         alert.Show();
     });
 }
Esempio n. 13
0
		/*
		 * setting for looping through words
		 * setting for language of words (later)
		 * setting for difficultly/level of words (by grade maybe?)
		 * setting for length of words
		*/
		protected override void OnCreate (Bundle bundle)
		{
			// TODO: rotating the screen restarts the app!

			base.OnCreate (bundle);

			Window.SetBackgroundDrawable (Resources.GetDrawable (Resource.Color.wordswipe_background));

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.ViewManager);
			// set the splash screen to visible first (default)

			SetActionBar (FindViewById<Toolbar> (Resource.Id.toolbar));
			ActionBar.SetHomeButtonEnabled (true);

			// get the TextViews from the UI
			currentWordView = FindViewById<TextView> (Resource.Id.currentWord);
			currentDefinitionView = FindViewById<TextView> (Resource.Id.definition);
			swipeYesView = FindViewById<TextView> (Resource.Id.swipeYes);
			swipeNoView = FindViewById<TextView> (Resource.Id.swipeNo);
			viewWordsButton = FindViewById<Button> (Resource.Id.viewWordsButton);

			generator = new WordGenerator (Assets.Open, GetFileStreamPath ("dict.txt").AbsolutePath);
			InitializeWordSet ();

			//FIXME: need to store this so it doesn't reset each time the user restarts the app
			List<string> learnedWords = new List<string> ();

			swipeYesView.Click += delegate {
				UpdateCurrentWord ();
			};

			swipeNoView.Click += delegate {
				learnedWords.Add (currentWord);
				UpdateCurrentWord ();
			};

			viewWordsButton.Click += (sender, e) =>
			{
				var intent = new Intent(this, typeof(WordsLearnedActivity));
				intent.PutStringArrayListExtra("learned_words", learnedWords);
				StartActivity(intent);
			};
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            JsonServiceClient client = new JsonServiceClient ("http://techstacks.io/");

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.myButton);

            button.Click += delegate {
                var auth = new ServiceStackAuthenticator("http://techstacks.io","twitter",(jsonServiceClient) => {
                    //Custom get user details function, usually your user profile/session info exposed via a ServiceStack Service.
                    //The provided jsonServiceClient is authenticated, so can call auth services to get user details directly.
                    //'Account' also has a Dictionary<string,string> for user details values if required, these are then available in 'Completed'.
                    var userSessionInfo = jsonServiceClient.Get<UserSessionInfo>("/my-session");
                    return new Account(userSessionInfo.UserName,jsonServiceClient.CookieContainer);
                });
                StartActivity(auth.GetUI(this));
                auth.Completed += (sender, eventArgs) => {
                    if(eventArgs.IsAuthenticated) {
                        GetUserFeedResponse response = null;
                        try {
                            //Grab auth cookies for app JsonServiceClient
                            client.CookieContainer = eventArgs.Account.Cookies;
                            response = client.Get(new GetUserFeed());

                            var intent = new Intent(this, typeof(UserFeed));
                            intent.PutStringArrayListExtra("techstackfeed", response.Results.Select(x => x.Name).ToList());
                            StartActivity(intent);
                        } catch(Exception) {
                            //Failed to get user feed.
                            //Show error message.
                        }
                    }
                };
            };
        }
Esempio n. 15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Our code will go here

            //Get our UI Controls from the loaded layout
            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button> (Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button> (Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button> (Resource.Id.CallHistoryButton);
            Button progressButton = FindViewById<Button> (Resource.Id.ProgressButton);
            ProgressBar progressBar = FindViewById<ProgressBar> (Resource.Id.ProgressBar);
            ImageView imageView = FindViewById<ImageView> (Resource.Id.IconView);

            //Disable call button
            callButton.Enabled=false;

            //add code to translate number
            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) => {
                //Translate user's alphanumberic phone number to numeric
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if(String.IsNullOrWhiteSpace(translatedNumber)){
                    callButton.Text="Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " +  translatedNumber;
                    callButton.Enabled = true;
                }
            };

            progressButton.Click += (object sender, EventArgs e) =>
            {
                if(progressBar.Progress<10){
                    progressBar.Progress++;}
                else{
                    progressBar.Progress=0;}

            };

            callButton.Click += (object sender, EventArgs e) => {
                var callDialog = new AlertDialog.Builder (this);
                callDialog.SetMessage ("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton ("Call", delegate {

                    //add number to list of called numbers.
                    phoneNumbers.Add(translatedNumber);

                    //Enable call history button
                    callHistoryButton.Enabled = true;

                    //Create intent to call
                    var callIntent = new Intent (Intent.ActionCall);
                    callIntent.SetData (Android.Net.Uri.Parse ("tel:" + translatedNumber));
                    StartActivity (callIntent);
                });
                callDialog.SetNegativeButton ("Cancel", delegate {
                });

                callDialog.Show ();
            };

            callHistoryButton.Click += (object sender, EventArgs e) => {
                var intent = new Intent (this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra ("phone_numbers", phoneNumbers);
                StartActivity (intent);
            };
        }
Esempio n. 16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);


            var phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            var translateButton = FindViewById<Button>(Resource.Id.TransllateButton);
            var callButton = FindViewById<Button>(Resource.Id.CallButton);
            var callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton);
            callButton.Enabled = false;


            var translatedNumber = string.Empty;
            translateButton.Click += (sender, args) =>
            {
                translatedNumber = PhoneTranslator.ToNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += delegate
            {
                var callDialog = new AlertDialog.Builder(this);

                callDialog.SetMessage("Call " + translatedNumber);

                callDialog.SetNeutralButton("Call", delegate
                {
                    // 将电话加入到历史记录列表中
                    PhoneNumbers.Add(translatedNumber);
                    callHistoryButton.Enabled = true;

                    var callIntent = new Intent(Intent.ActionCall);

                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));

                    StartActivity(callIntent);
                });

                callDialog.SetNegativeButton("Cancel", delegate { });

                callDialog.Show();
            };

            callHistoryButton.Click += delegate
            {

                var intent = new Intent(this, typeof (CallHistoryActivity));

                intent.PutStringArrayListExtra("phone_numbers", PhoneNumbers);
                StartActivity(intent);
            };
        }
        public void OnItemClick (RecyclerView parent, View clickedView, int position)
        {
            var intent = new Intent (Activity, typeof (EditTimeEntryActivity));

            IList<string> guids = ((TimeEntryHolder)logAdapter.GetEntry (position)).TimeEntryGuids;
            intent.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, guids);
            intent.PutExtra (EditTimeEntryActivity.IsGrouped, guids.Count > 1);

            StartActivity (intent);
        }
        private void OnProjectSelected (object sender, EventArgs e)
        {
            if (TimeEntry == null) {
                return;
            }

            var intent = new Intent (Activity, typeof (ProjectListActivity));
            intent.PutStringArrayListExtra (ProjectListActivity.ExtraTimeEntriesIds, new List<string> {TimeEntry.Id.ToString ()});
            StartActivity (intent);
        }
Esempio n. 19
0
        // OnCreate called when device creates the Activity but BEFORE screen presented on user-end
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            /*
             * Set our view from the "main" layout resource.
             * To load the UI, call SetContentView and pass in Main.axml
             *
             */
            SetContentView (Resource.Layout.Main);

            /*
             * Anything above is boilerplate starter for MainActivity code.
             * Additional setup code below:
             *
             */

            // Get our UI controls from the loaded layout:
            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button> (Resource.Id.CallHistoryButton);

            // Disable call and text buttons to start app
            callButton.Enabled = false;

            // Add code to translate number
            string translatedNumber = string.Empty;

            // Button functionality to translate alphanumeric to numeric #
            // Click event = user touching phone
            translateButton.Click += (object sender, EventArgs e) =>
            {
                // Translate user's alphanumeric phone number to numeric
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            // Button functionality to call translated tel number
            callButton.Click += (object sender, EventArgs e) =>
            {
                /*
                 * On "Call" button click, try to dial phone number.
                 *
                 * Display an Alert Dialog:
                 *      Neutral button = places a call
                 * 		Negative button = cancels a call
                 *
                 */

                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");

                callDialog.SetNeutralButton("Call", delegate {
                    // add dialed number to list of called numbers.
                    phoneNumbers.Add(translatedNumber);
                    // enable the Call History button
                    callHistoryButton.Enabled = true;
                    /*
                     * Intents in Android apps:
                     *      App blocks send asynchronous messages
                     *      Contain info ~ receiving Block/sometimes data
                     */
                    // intent #1: to place a phone call
                    var callIntent = new Intent(Intent.ActionCall);
                    // Intent.ActionCall = special intent that launches the phone app and passes in tel num to dial
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate { });

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();
            };

            // Button functionality to go to Call History
            callHistoryButton.Click += (sender, e) =>
            {
                // intent #2: to navigate between two screens/activity (MainActivity - CallHistoryActivity)
                // Definition: public Intent (Context packageContext, Type type);
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
Esempio n. 20
0
		//		public LifeStyle()
		//		{
		//			//_User = ((ControllClass)Application)._oUser;
		//
		//		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.LifeStyle);
			var UserData = Intent.Extras.GetStringArrayList ("Data") ?? new string[0];
			//	CPersonPassable oPass = (CPersonPassable)Intent.GetParcelableExtra ("ParceableObject");
			//	_User = oPass.User;
			//Button btnCalculate = FindViewById<Button> (Resource.Id.);
			EditText txtSleep = FindViewById<EditText> (Resource.Id.txtSleep);
			EditText txtCigarettes = FindViewById<EditText> (Resource.Id.txtCigarettes);
			Button btnCalculate = FindViewById<Button> (Resource.Id.btnCalculate);
			ImageView imgLifeStyle = FindViewById<ImageView> (Resource.Id.imgLifeStyle); 
			//TextView lblinput = FindViewById<TextView> (Resource.Id.lblinput);
			//Button btngo = FindViewById<Button> (Resource.Id.btngo);
			imgLifeStyle.SetImageResource (Resource.Drawable.life);
			//			imgLogo.Image = UIImage.FromBundle ("Images/clock.png");
			btnCalculate.Click += delegate(object sender, EventArgs e) {
				double dSleep = -1;
				double dCigarettes = -1;
				if (double.TryParse (txtSleep.Text, out dSleep)) {
					if (double.TryParse (txtCigarettes.Text, out dCigarettes)) {
						//((ControllClass)Application)._oUser.HrsSleep = dSleep;
						//((ControllClass)Application)._oUser.CigPerDay = dCigarettes;
						_User.HrsSleep = dSleep;
						_User.CigPerDay = dCigarettes;
						//_User.HrsSleep = dSleep;
						//_User.CigPerDay = dCigarettes;
						//((ControllClass)Application)._oUser = _User;
						//var _UserP = new CPersonPassable ();
						//	lblinput.Text = _User.HrsSleep.ToString () + " " + _User.CigPerDay.ToString ();
						//	var userData = UserData;
						UserData.Add (_User.HrsSleep.ToString ());
						UserData.Add (_User.CigPerDay.ToString ());

						var intent = new Intent (this, typeof(Results));
						intent.PutStringArrayListExtra ("Data", UserData);
						StartActivity (intent);
						//_UserP.User = _User;
						//UserData.Add (_User.HrsSleep.ToString ());
						//UserData.Add (_User.CigPerDay.ToString ());
						//Intent.PutExtra ("_User", _User);
						//	var intent = new Intent (this, typeof(Results));
						//	intent.PutStringArrayListExtra ("Data", UserData);
						//StartActivity (intent);
						//var result = new Intent (this, typeof(Results));
						//	result.PutExtra ("lifstyle", _UserP);
						//	StartActivity (result);
						//NavigationController.PushViewController(_cResultsVC,true);
					}
				}
//				if ((dSleep == -1)||(dCigarettes == -1))
//				{
//					//	UIAlertView alert = new  UIAlertView("Error", "Please input a number into all fields", "OK", null);
//					//	alert.Show(); 
//				}
			
			};
		
			//txtSleep.ShouldReturn = delegate {
			//	txtSleep.ResignFirstResponder();
			//	return true;
			//	};
//		txtCigarettes.ShouldReturn = delegate {
//			txtCigarettes.ResignFirstResponder();
//			return true;
//		};
		
		}
        public void OnItemClick (RecyclerView parent, View clickedView, int position)
        {
            var intent = new Intent (Activity, typeof (EditTimeEntryActivity));
            IList<string> guids = ((ITimeEntryHolder)ViewModel.Collection.Data.ElementAt (position)).Guids;
            intent.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, guids);
            intent.PutExtra (EditTimeEntryActivity.IsGrouped, guids.Count > 1);

            StartActivity (intent);
        }
        public async void StartStopClick (object sender, EventArgs e)
        {
            var timeEntryData = await ViewModel.StartStopTimeEntry ();

            if (ViewModel.HasMoreItems) {
                OBMExperimentManager.Send (OBMExperimentManager.HomeEmptyState, "startButton", "click");
            }

            if (ViewModel.IsTimeEntryRunning) {

                NewTimeEntryStartedByFAB = true;

                var ids = new List<string> { timeEntryData.Id.ToString () };
                var intent = new Intent (Activity, typeof (EditTimeEntryActivity));
                intent.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, ids);
                intent.PutExtra (EditTimeEntryActivity.IsGrouped,  false);
                StartActivity (intent);
            }
        }
        public override bool OnOptionsItemSelected (IMenuItem item)
        {
            var i = new Intent (Activity, typeof (EditTimeEntryActivity));
            i.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, new List<string> { ViewModel.GetActiveTimeEntry ().Id.ToString ()});
            Activity.StartActivity (i);

            return base.OnOptionsItemSelected (item);
        }
        public void GenerateComponent(string componentType, string parameters, LinearLayout layout)
        {
            string paramString = parameters;

            if (componentType=="BUTTON")
            {

                const string sSeparatori2 = "#";

                string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray());
                string caption = sAtomi1[0];
                string idNod = sAtomi1[1];

                var aButton = new Button(_secondActivity);
                aButton.Text = caption;
                aButton.Click += delegate(object sender, EventArgs e)
                                     {
                                         string result = "";
                                         var ws = new webService.WebService1();
                                         ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy();
                                         //ws.Proxy = System.Net.WebRequest.DefaultWebProxy =
                                         int paramID = Convert.ToInt32(idNod);

                                         var wsIntent = new Intent(layout.Context, typeof(SecondActivity));
                                         //wsIntent.PutExtra("FirstData", "LABEL^Nodul test@LABEL^Maria@LABEL^are@LABEL^mere@LIST^Lunile anului#Ianuarie#Februarie#Martie#Aprilie#Mai#Iunie#Iulie#August#Septembrie#Octombrie#Noiembrie#Decembrie3@LABEL^Ce@LABEL^are@LABEL^Ana ?@LABEL^pere@BUTTON^WsNod 1#1@BUTTON^WsNod 2#2");
                                         result = ws.GetNod(paramID);

                                         wsIntent.PutExtra("FirstData", result);

                                         layout.Context.StartActivity(wsIntent);
                                     };
                layout.AddView(aButton);
            }
            else if (componentType == "LABEL")
            {

                string caption = paramString;

                var label = new TextView(_secondActivity);
                label.Text = caption;
                label.Click += delegate(object sender, EventArgs e)
                                   {
                                       Toast.MakeText(layout.Context, caption, ToastLength.Short).Show();
                                   };
                layout.AddView(label);
            }
            else if (componentType == "SPINNER")
            {
                Spinner spinner = new Spinner(_secondActivity);
                const string sSeparatori2 = "#";
                string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray());
                String []spinnerArray=new string[sAtomi1.Length];

                int index1;
                for (index1 = 0; index1 < sAtomi1.Length; index1 = index1 + 1)
                {
                    if (sAtomi1[index1].Length <= 0) continue;
                    spinnerArray[index1] = sAtomi1[index1];
                }
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(_linearLayout.Context, Android.Resource.Layout.SimpleSpinnerItem, spinnerArray);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spinner.Adapter = adapter;

                layout.AddView(spinner);
            }
            else if (componentType == "LIST")
            {
                IList<String> stringList = new List<string>();
                const string sSeparatori2 = "#";
                string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray());
                String[] stringArray = new string[sAtomi1.Length];

                int index1;
                for (index1 = 0; index1 < sAtomi1.Length; index1 = index1 + 1)
                {
                    if (sAtomi1[index1].Length <= 0) continue;
                    stringArray[index1] = sAtomi1[index1];
                    stringList.Add(sAtomi1[index1]);
                }

                var label = new TextView(_secondActivity);
                label.Text = stringArray[0];
                label.Typeface = Typeface.DefaultBold;
                label.TextSize = 20;

                label.Click += delegate(object sender, EventArgs e)
                {
                    var intent = new Intent(layout.Context, typeof(SimpleListItem1));
                    intent.PutStringArrayListExtra("FirstData", stringList);
                    intent.AddFlags(ActivityFlags.NoHistory);
                    layout.Context.StartActivity(intent);
                };
                layout.AddView(label);
            }
        }
Esempio n. 25
0
 private void NewPost_Click(object sender, EventArgs e)
 {
     Intent myIntent = new Intent(this, typeof(CreatePostActivity));
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     StartActivity(myIntent);
 }
Esempio n. 26
0
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);	

			//Get controls for UI
			Button   translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
			EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
			Button   callButton      = FindViewById<Button>(Resource.Id.CallButton);
			Button   callHistoryButton      = FindViewById<Button>(Resource.Id.CallHistoryButton);

			List<string> _phoneNumbers = new List<string>();

			// Disable the "Call" button
			callButton.Enabled = false;

			// Add code to translate number
			string translatedNumber = string.Empty;

			translateButton.Click += delegate
				{
					var imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(phoneNumberText.WindowToken, 0);

					translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);

					if (string.IsNullOrWhiteSpace(translatedNumber))
					{
						callButton.Text    = "Call";
						callButton.Enabled = false;
					}
					else
					{
						callButton.Text    = "Call " + translatedNumber;
						callButton.Enabled = true;
					}
				};

			// Add code to make the phone call
			callButton.Click += delegate
				{
					// On "Call" button click, try to dial phone number.
					var callDialog = new AlertDialog.Builder(this);

				

					callDialog.SetMessage("Call " + translatedNumber + "?");

					callDialog.SetNeutralButton("Call", 
						delegate
						{
							_phoneNumbers.Add(translatedNumber);
							callHistoryButton.Enabled = true;

							// Create intent to dial phone
							var callIntent = new Intent(Intent.ActionCall);
							callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
							StartActivity(callIntent);
						});

					callDialog.SetNegativeButton("Cancel", 
						delegate
						{
							// nothing to do
						});

					// Show the alert dialog to the user and wait for response.
					callDialog.Show();
				};

			callHistoryButton.Click += delegate
			{
					var intent = new Intent(this, typeof(CallHistoryActivity));
					intent.PutStringArrayListExtra("phone_numbers", _phoneNumbers);
					StartActivity(intent);
			};

		}
Esempio n. 27
0
 private void OpenTimeEntryEdit (ITimeEntryModel model)
 {
     var i = new Intent (activity, typeof (EditTimeEntryActivity));
     i.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, new List<string> {model.Id.ToString ()});
     activity.StartActivity (i);
 }
 private void HandleTimeEntryClick (TimeEntryData timeEntry)
 {
     var intent = new Intent (Activity, typeof (EditTimeEntryActivity));
     intent.PutStringArrayListExtra (EditTimeEntryActivity.ExtraGroupedTimeEntriesGuids, new List<string> {timeEntry.Id.ToString()});
     StartActivity (intent);
 }
Esempio n. 29
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            //Get our UI controls from the loaded layout
            var phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            var translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            var callButton = FindViewById<Button>(Resource.Id.CallButton);
            var callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton);

            //Disable the "CALL" button
            callButton.Enabled = false;

            var translateNumber = string.Empty;

            translateButton.Click += (sender, args) =>
            {
                translateNumber = PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if (string.IsNullOrWhiteSpace(translateNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = $"CALL {translateNumber}";
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (sender, e) =>
            {
                //On "CALL" button click, try to dial phone number
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage($"Call {translateNumber}?");
                callDialog.SetNeutralButton("Call", delegate
                {
                    phoneNumbers.Add(translateNumber);

                    callHistoryButton.Enabled = true;

                    //Create intent to dial  phone
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse($"tel:{translateNumber}"));
                    //StartActivity(callIntent);
                });

                callDialog.SetNegativeButton("Cancel", delegate { });

                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
        private void OnProjectSelected (object sender, EventArgs e)
        {
            if (viewModel.Model == null) {
                return;
            }

            var intent = new Intent (Activity, typeof (ProjectListActivity));
            intent.PutStringArrayListExtra (ProjectListActivity.ExtraTimeEntriesIds, TimeEntryIds);
            StartActivity (intent);
        }
Esempio n. 31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            EditText phoneNumberText = this.FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = this.FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = this.FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = this.FindViewById<Button>(Resource.Id.CallHistoryButton);

            // Disable the "Call" button
            callButton.Enabled = false;

            // Add code to translate number
            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) =>
            {
                // Translate user's alphanumeric phone number to numeric
                translatedNumber = PhoneTranslator.toNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) =>
            {
                // On "Call" button click, try to dial phone number.
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate
                {
                    phoneNumbers.Add(translatedNumber);
                    callHistoryButton.Enabled = true;
                    // Create intent to dial phone
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate { });

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();
            };

            callHistoryButton.Click += (object sender, EventArgs e) =>
            {
                Toast t = Toast.MakeText(this, "Hola amigo", ToastLength.Long);
                t.Show();
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
                //coomentario para anatole mattei
            };
        }
Esempio n. 32
0
 public void ToIntent(Intent i)
 {
     i.PutStringArrayListExtra(Key, Value);
 }