protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

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

            listView = FindViewById<ListView> (Resource.Id.listView);
            textSearch = FindViewById<AutoCompleteTextView> (Resource.Id.textSearch);

            googleApiClient = new GoogleApiClient.Builder (this)
                .EnableAutoManage (this, 0, this)
                .AddApi (PlacesClass.GEO_DATA_API)
                .Build ();

            adapter = new PlacesAutocompleteAdapter (this, googleApiClient, BOUNDS_GREATER_SYDNEY, null);
            textSearch.Adapter = adapter;


            textSearch.ItemClick += (sender, e) => {
                var item = adapter [e.Position];

                // Go to details of place:
                var intent = new Intent (this, typeof (PlaceDetailsActivity));
                intent.PutExtra ("PLACE_ID", item.PlaceId);
                StartActivity (intent);
            };
        }
Beispiel #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetTheme (Android.Resource.Style.ThemeHoloLightNoActionBar);
            SetContentView (Resource.Layout.frmCreaCommessa);
            txtImpianto = FindViewById<AutoCompleteTextView> (Resource.Id.txtImpianto_cc );
            txtDescrizione = FindViewById<EditText> (Resource.Id.txtDescrizione_cc);
            lstAttivita = FindViewById<ListView> (Resource.Id.lstAttivita_cc);
            Button btnSalvaCommessa = FindViewById<Button> (Resource.Id.btnSalva_cc);
            Button btnAnnulla = FindViewById<Button> (Resource.Id.btnAnnulla_cc);

            btnSalvaCommessa.Click+= BtnSalvaCommessa_Click;

            Coddip = this.Intent.GetStringExtra ("coddip");
            AttivitaScelte = new List<Attivita> ();

            prepareWaitDialog ("Carico Impianti...", false).Show();

            s.BeginGetImpianti (
                (ar) => {

                    try {
                        i = s.EndGetImpianti (ar);
                    } catch (Exception) {
                        return;

                    }
                    List<string> ls = new List<string>();
                    foreach (Impianti item in i) {
                        ls.Add(item.Id+  " - " +item.Descrizione );
                    }
                    ArrayAdapter dati = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, ls);
                    RunOnUiThread(()=>{
                        txtImpianto.Adapter = dati;
                        //dialog.Dismiss ();
                        dialog.SetMessage("Carico Attivita...");
                        s.BeginGetAttivita (
                            (ar1) => {
                                try {
                                    lsa = s.EndGetAttivita(ar1);
                                    AttivitaListAdapter datiAtt = new AttivitaListAdapter(this,lsa);
                                    datiAtt.OnCheckChange += (int pos, bool stato) => {
                                        if (stato)
                                            AttivitaScelte.Add(lsa[pos]);

                                        else
                                            //datiAtt.StatoCheck[pos] = 0;
                                            AttivitaScelte.Remove(lsa[pos]);

                                    };
                                    RunOnUiThread(()=>{	lstAttivita.Adapter = datiAtt;dialog.Dismiss();});
                                } catch (Exception ) {
                                    return;

                                }

                            }, null);
                    });
                }, null);
        }
Beispiel #3
0
        protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);


            ServicePointManager.ServerCertificateValidationCallback = delegate
            {
                return true;
            };

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

            _getHelloWorldDataButton = FindViewById<Button>(Resource.Id.getHelloWorldDataButton);
            _getHelloWorldDataButton.Click += GetHelloWorldDataButtonOnClick;
            _getHelloWorldDataTextView = FindViewById<TextView>(Resource.Id.getHelloWorldDataTextView);

            // This button will invoke SayHelloWorld - this method takes a simple string as a parameter.
            _sayHelloWorldButton = FindViewById<Button>(Resource.Id.sayHelloWorldButton);
            _sayHelloWorldButton.Click += SayHelloWorldButtonOnClick;
            _sayHelloWorldTextView = FindViewById<TextView>(Resource.Id.sayHelloWorldTextView);


            _sayHelloTextEdit = FindViewById<AutoCompleteTextView>(Resource.Id.sayHelloTextEdit);
            _getHelloTextEdit = FindViewById<AutoCompleteTextView>(Resource.Id.getHelloWorldTextEdit);
        }
        public static GridLayout GridLayout(IEnumerable <IPrimitive> children)
        {
            Android.Widget.AutoCompleteTextView ss = null;
            var control = new GridLayout(children);

            return(control);
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var shippingDetailsView = inflater.Inflate(Resource.Layout.ShippingDetails, container, false);

			var placeOrder = shippingDetailsView.FindViewById<Button> (Resource.Id.PlaceOrder);
			var phone = shippingDetailsView.FindViewById<EditText> (Resource.Id.Phone);
			phone.Text = user.Phone;

			var firstName = shippingDetailsView.FindViewById<EditText> (Resource.Id.FirstName);
			firstName.Text = user.FirstName;

			var lastName = shippingDetailsView.FindViewById<EditText> (Resource.Id.LastName);
			lastName.Text = user.LastName;

			var streetAddress1 = shippingDetailsView.FindViewById<EditText> (Resource.Id.StreetAddress1);
			streetAddress1.Text = user.Address;

			var streetAddress2 = shippingDetailsView.FindViewById<EditText> (Resource.Id.StreetAddress2);
			streetAddress2.Text = user.Address;

			var city = shippingDetailsView.FindViewById<EditText> (Resource.Id.City);
			city.Text = user.City;

			state = shippingDetailsView.FindViewById<AutoCompleteTextView> (Resource.Id.State);
			state.Text = user.State;

			var postalCode = shippingDetailsView.FindViewById<EditText> (Resource.Id.PostalCode);
			postalCode.Text = user.ZipCode;

			country = shippingDetailsView.FindViewById<AutoCompleteTextView> (Resource.Id.Country);
			user.Country = string.IsNullOrEmpty (user.Country) ? "United States" : user.Country;
			country.Text = user.Country;
			country.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				LoadStates();
			};

			placeOrder.Click += async (sender, e) => {
				var entries = new EditText[] {
					phone, streetAddress1, streetAddress2, city, state, postalCode, country
				};
				foreach (var entry in entries)
					entry.Enabled = false;
				user.FirstName = firstName.Text;
				user.LastName = lastName.Text;
				user.Phone = phone.Text;
				user.Address = streetAddress1.Text;
				user.Address2 = streetAddress2.Text;
				user.City = city.Text;
				user.State = state.Text;
				user.ZipCode = postalCode.Text;
				user.Country = await WebService.Shared.GetCountryCode(country.Text);
				await ProcessOrder();
				foreach (var entry in entries)
					entry.Enabled = true;
			};
			LoadCountries ();
			LoadStates ();
			return 	shippingDetailsView;
		}
 /// <summary>
 /// Constructor for the Android chat app.
 /// </summary>
 public ChatAppAndroid(Context parentContext, TextView chatHistory, AutoCompleteTextView input)
     : base("Android", ConnectionType.TCP)
 {
     this.ParentContext = parentContext;
     this.ChatHistory = chatHistory;
     this.Input = input;
     Serializer = DPSManager.GetDataSerializer<NetworkCommsDotNet.DPSBase.ProtobufSerializer>();
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView(Resource.Layout.Abastecimento);

            Button button = FindViewById<Button>(Resource.Id.Cancelar);
            acTanque = FindViewById<AutoCompleteTextView>(Resource.Id.idTanque);
            button.Click += new EventHandler(Cancelar_Click);
            // Create your application here
        }
		// Test Cases:
		//	_dst is retained on screen reorientation/back button?

		// Bugs: Validation response delayed and no keyboard displayed after validation failure

		// TODO: isShared

		protected void HandleEditorAction (AutoCompleteTextView tv, ListView lv, TextView.EditorActionEventArgs e) {
			if (e.ActionId == ImeAction.Go) {
				var curLoc = AppCommon.Inst.LocationProvider.CurLocInfo.Value.Loc;
				AppCommon.Inst.PlacesProvider.SearchAsync (
					x => RunOnUiThread (() => ShowSearchResults (x, lv)), tv.Text, curLoc.Lat, curLoc.Lng);
				// Hide keyboard
				var imm = (InputMethodManager)GetSystemService (Context.InputMethodService);
				imm.HideSoftInputFromWindow (tv.WindowToken, 0);
				e.Handled = true;
			}
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var shippingDetailsView = inflater.Inflate(Resource.Layout.ShippingDetails, container, false);

			var placeOrder = shippingDetailsView.FindViewById<Button> (Resource.Id.PlaceOrder);
			var phone = shippingDetailsView.FindViewById<EditText> (Resource.Id.Phone);
			phone.Text = user.Phone;

			var streetAddress1 = shippingDetailsView.FindViewById<EditText> (Resource.Id.StreetAddress1);
			streetAddress1.Text = user.Address;

			var streetAddress2 = shippingDetailsView.FindViewById<EditText> (Resource.Id.StreetAddress2);
			streetAddress2.Text = user.Address;

			var city = shippingDetailsView.FindViewById<EditText> (Resource.Id.City);
			city.Text = user.City;

			state = shippingDetailsView.FindViewById<AutoCompleteTextView> (Resource.Id.State);
			state.Text = user.State;

			var postalCode = shippingDetailsView.FindViewById<EditText> (Resource.Id.PostalCode);
			postalCode.Text = user.ZipCode;

			country = shippingDetailsView.FindViewById<AutoCompleteTextView> (Resource.Id.Country);
			user.Country = string.IsNullOrEmpty (user.Country) ? "United States" : user.Country;
			country.Text = user.Country;
			country.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				LoadStates();
			};

			placeOrder.Click += async (sender, e) => {
				//Hide Keyboard
				var imm = (InputMethodManager)Activity.GetSystemService (Activity.InputMethodService);
				imm.HideSoftInputFromWindow(phone.WindowToken,0);

				user.Phone = phone.Text;
				user.Address = streetAddress1.Text;
				user.Address2 = streetAddress2.Text;
				user.City = city.Text;
				user.State = state.Text;
				user.ZipCode = postalCode.Text;
				user.Country = await WebService.Shared.GetCountryCode(country.Text);
				ProcessOrder();
			};
			LoadCountries ();
			LoadStates ();
			return 	shippingDetailsView;
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            Edit = FindViewById<AutoCompleteTextView>(Resource.Id.Edit);

            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate {
                string EditText = Edit.Text;

                Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://test.mp4"));
                intent.SetDataAndType(Android.Net.Uri.Parse(EditText), "video/mp4");
                StartActivity(intent);
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            // get views
            pickDate = FindViewById<TextView> (Resource.Id.pickDate);
            txtProjectCode = FindViewById<AutoCompleteTextView> (Resource.Id.txtProjectCode);
            currencySpinner = FindViewById<Spinner> (Resource.Id.currencySpinner);
            chooseButton = FindViewById<ImageButton> (Resource.Id.chooseImageButton);
            Button addButton = FindViewById<Button> (Resource.Id.addButton);
            EditText txtAmount = FindViewById<EditText> (Resource.Id.txtAmount);

            // set date button
            pickDate.Click += delegate {
                ShowDialog (DATE_DIALOG_ID);
            };
            date = DateTime.Today;
            UpdateDisplay ();

            try {
                // Set autocomplete view
                var adapter = new ArrayAdapter<String> (this, global::Android.Resource.Layout.SimpleListItem1, Backend.Current.projectCodes.Values.ToArray ());
                txtProjectCode.Adapter = adapter;

                // set currency spinner
                ArrayAdapter<string> spinnerAdapter = new ArrayAdapter<string> (this, global::Android.Resource.Layout.SimpleSpinnerItem, Backend.Current.Currencies.Values.ToArray ());
                // Specify the layout to use when the list of choices appears
                spinnerAdapter.SetDropDownViewResource (global::Android.Resource.Layout.SimpleSpinnerDropDownItem);
                // Apply the adapter to the spinner
                currencySpinner.Adapter = spinnerAdapter;
            } catch (Exception ex) {
                Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
            }

            // set choose button event handler
            chooseButton.Click += chooseButtonClicked;

            // set add button event handler
            addButton.Click += addButtonClicked;

            txtAmount.TextChanged += OnAmountOrCurrencyChange;
            currencySpinner.ItemSelected += OnAmountOrCurrencyChange;
        }
Beispiel #12
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            actionBarMenu = menu;
            MenuInflater.Inflate(Resource.Menu.action_menu, menu);

            // init search text view
            searchTextView              = (AWidget.AutoCompleteTextView)menu.FindItem(Resource.Id.action_search).ActionView;
            searchTextView.TextChanged += (s1, e1) => AutoComplete();
            searchTextView.ItemClick   += (s1, e1) => { FinishSearch(); ShowRouteToNearestAddress(searchTextView.Text); };

            var searchListener = new SearchActionListener();

            searchListener.Search += (s1, e1) => { FinishSearch(); ShowRouteToNearestAddress(searchTextView.Text); };
            searchTextView.SetOnEditorActionListener(searchListener);

            UpdateActionBar();

            return(base.OnCreateOptionsMenu(menu));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            // get views
            pickDate = FindViewById<TextView> (Resource.Id.pickDate);
            txtProjectCode = FindViewById<AutoCompleteTextView> (Resource.Id.txtProjectCode);
            chooseButton = FindViewById<ImageButton> (Resource.Id.chooseImageButton);
            Button addButton = FindViewById<Button> (Resource.Id.addButton);

            // set date button
            pickDate.Click += delegate {
                ShowDialog (DATE_DIALOG_ID);
            };
            date = DateTime.Today;
            UpdateDisplay ();

            try {
                // Set autocomplete view
                var adapter = new ArrayAdapter<String> (this, global::Android.Resource.Layout.SimpleListItem1, Backend.Current.projectCodes.Values.ToArray ());
                txtProjectCode.Adapter = adapter;
            } catch (Exception ex) {
                Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
            }

            // set choose button event handler
            chooseButton.Click += delegate
            {
                chooseButtonClicked();
            };

            // set add button event handler
            addButton.Click += delegate
            {
                addButtonClicked();
            };
        }
Beispiel #14
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View v = inflater.Inflate(Resource.Layout.view_search, container, false);

			wordTextview = v.FindViewById<AutoCompleteTextView>(Resource.Id.textview_word);

			tagComponent = new TagsComponent(Screen);
			Screen.ReplaceContainer(tagComponent, Resource.Id.tag_container);

			wordTypeSpinner = v.FindViewById<Spinner>(Resource.Id.spinner_word_type);
			ArrayAdapter wordTypeAdapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.word_types2, Android.Resource.Layout.SimpleSpinnerItem);
			wordTypeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			wordTypeSpinner.Adapter = wordTypeAdapter;

			conjugationSpinner = v.FindViewById<Spinner>(Resource.Id.spinner_conjugation);
			ArrayAdapter conjugationAdapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.conjugations, Android.Resource.Layout.SimpleSpinnerItem);
			conjugationAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			conjugationSpinner.Adapter = conjugationAdapter;

			translationSpinner = v.FindViewById<Spinner>(Resource.Id.spinner_translation_direction);
			ArrayAdapter translateAdapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.translation_directions, Android.Resource.Layout.SimpleSpinnerItem);
			translateAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			translationSpinner.Adapter = translateAdapter;

			randomizeButton = v.FindViewById<ToggleButton>(Resource.Id.button_randomize);

			maxWordTextview = v.FindViewById<TextView>(Resource.Id.textview_number);

			positiveButton = v.FindViewById<ImageButton>(Resource.Id.button_positive);
			positiveButton.Click += (sender, e) => ButtonClick(1);

			negativeButton = v.FindViewById<ImageButton>(Resource.Id.button_negative);
			negativeButton.Click += (sender, e) => ButtonClick(-1);

			ButtonClick(0);
			Screen.DisplayAd ();

			return v;
		}
Beispiel #15
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			View v = inflater.Inflate(Resource.Layout.component_tags, container, false);

			tagText = v.FindViewById<AutoCompleteTextView> (Resource.Id.tag_text);

			button = v.FindViewById<ImageButton> (Resource.Id.button_add_tag);
			button.Click += (sender, e) => {
				tags.Add (new Tag ());
				if (recyclerView.Visibility == ViewStates.Gone)
				{
					recyclerView.Visibility = ViewStates.Visible;
				}
				recyclerView.GetAdapter().NotifyDataSetChanged();
			};

			recyclerView = v.FindViewById<RecyclerView>(Resource.Id.list_tags);
			recyclerView.SetLayoutManager(new LinearLayoutManager(Activity, (int)Orientation.Horizontal, false));
			recyclerView.SetAdapter(new TagsAdapter(Activity, tags));

			return v;
		}
        /// <summary>
        /// Method runs after the application has been launched
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            ISharedPreferences preferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
            ISharedPreferencesEditor editor = preferences.Edit();
            editor.Clear();
            editor.Commit();

            //Get references to user interface controls
            chatHistory = FindViewById<TextView>(Resource.Id.mainText);
            input = FindViewById<AutoCompleteTextView>(Resource.Id.messageTextInput);
            sendButton = FindViewById<Button>(Resource.Id.sendButton);
            settingsButton = FindViewById<Button>(Resource.Id.settingsButton);

            //Append the method 'sendButton_Click' to the button click event
            sendButton.Click += sendButton_Click;

            //Append the settings button event handler
            settingsButton.Click += settingsButton_Click;

            //Initialise the chat application
            chatApplication = new ChatAppAndroid(this, chatHistory, input);

            //Print the usage instructions
            chatApplication.PrintUsageInstructions();

            //Initialise NetworkComms.Net but without a local server
            chatApplication.RefreshNetworkCommsConfiguration();

            //Uncomment this line to enable logging
            //EnableLogging();
        }
        // Initialisation des objets axml

        private void initViews()
        {

            eventName = FindViewById<EditText>(Resource.Id.event_name_textEdit);

            startDate = FindViewById<TextView>(Resource.Id.event_startDate_text);
            startHour = FindViewById<TextView>(Resource.Id.event_startHour_text);
            endDate = FindViewById<TextView>(Resource.Id.event_endDate_text);
            endHour = FindViewById<TextView>(Resource.Id.event_endHour_text);

            eventLocation = FindViewById<AutoCompleteTextView>(Resource.Id.event_location_textEdit);
            eventDescription = FindViewById<EditText>(Resource.Id.event_description_textEdit);

            groupSpinner = FindViewById<Spinner>(Resource.Id.event_group_spinner);

            createButton = FindViewById<Button>(Resource.Id.event_name_button);

        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /**
             * 使用地图sdk前需先初始化BMapManageResource.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }

            SetContentView(Resource.Layout.activity_poisearch);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(12);

            // 初始化搜索模块,注册搜索事件监听
            mSearch = new MKSearch();
            mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this));

            keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey);
            sugAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleDropDownItem1Line);
            keyWorldsView.Adapter = sugAdapter;

            /**
             * 当输入关键字变化时,动态更新建议列表
             */

            keyWorldsView.AddTextChangedListener(new ITextWatcherImpl(this));
        }
        // Dialog zur Anzeige der Customer-Auswahl
        private void customerDialog(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View setCustomer = inflater.Inflate(Resource.Layout.SetCustomer, container);
            dialog = new Dialog(container.Context);
            dialog.SetContentView(setCustomer);
            dialog.SetTitle("Search & select customer");
            tv_customer_search = (AutoCompleteTextView)dialog.FindViewById(Resource.Id.autocomplete);
            tv_customer_search.Threshold = 1;

            ThreadPool.QueueUserWorkItem(o =>
            {
                getCustomers(tv_customer_search, null);
            });

            dialog.Show();

            //tv_customer_search.AfterTextChanged += delegate
            //{
            //    AfterTextChanged_Customer(this.tv_customer_search, null);
            //};
            Button btnSelect = (Button)dialog.FindViewById(Resource.Id.btnSelect);
            Button btnCancel = (Button)dialog.FindViewById(Resource.Id.btnCancel);

            btnCancel.Click += delegate
            {
                btnCancelOnClick(this, null);
            };

            btnSelect.Click += delegate
            {
                btnSelectOnClick(this, null);
            };
        }
Beispiel #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Initialising the Components
            tvDate = FindViewById<TextView>(Resource.Id.tvDate);
            tvLocality = FindViewById<TextView>(Resource.Id.tvLocality);
            ivCloudIcon = FindViewById<ImageView>(Resource.Id.ivCloudIcon);
            tvTemperature = FindViewById<TextView>(Resource.Id.tvTemperature);
            tvHumidity = FindViewById<TextView>(Resource.Id.tvHumidity);
            tvPressure = FindViewById<TextView>(Resource.Id.tvPressure);
            tvWindDirection = FindViewById<TextView>(Resource.Id.tvWindDirection);
            tvTempMin = FindViewById<TextView>(Resource.Id.tvTempMin);
            tvTempMax = FindViewById<TextView>(Resource.Id.tvTempMax);
            tvSunRise = FindViewById<TextView>(Resource.Id.tvSunRise);
            tvSunSet = FindViewById<TextView>(Resource.Id.tvSunSet);

            tvAddress = FindViewById<TextView>(Resource.Id.tvAddress);
            tvLat = FindViewById<TextView>(Resource.Id.tvLat);
            tvLong = FindViewById<TextView>(Resource.Id.tvLong);

            tvDay1 = FindViewById<TextView>(Resource.Id.tvDay1);
            ivDay1Cloud = FindViewById<ImageView>(Resource.Id.ivDay1Cloud);
            tvDay1Temperature = FindViewById<TextView>(Resource.Id.tvDay1Temperature);
            tvDay2 = FindViewById<TextView>(Resource.Id.tvDay2);
            ivDay2Cloud = FindViewById<ImageView>(Resource.Id.ivDay2Cloud);
            tvDay2Temperature = FindViewById<TextView>(Resource.Id.tvDay2Temperature);
            tvDay3 = FindViewById<TextView>(Resource.Id.tvDay3);
            ivDay3Cloud = FindViewById<ImageView>(Resource.Id.ivDay3Cloud);
            tvDay3Temperature = FindViewById<TextView>(Resource.Id.tvDay3Temperature);
            tvDay4 = FindViewById<TextView>(Resource.Id.tvDay4);
            ivDay4Cloud = FindViewById<ImageView>(Resource.Id.ivDay4Cloud);
            tvDay4Temperature = FindViewById<TextView>(Resource.Id.tvDay4Temperature);
            tvDay5 = FindViewById<TextView>(Resource.Id.tvDay5);
            ivDay5Cloud = FindViewById<ImageView>(Resource.Id.ivDay5Cloud);
            tvDay5Temperature = FindViewById<TextView>(Resource.Id.tvDay5Temperature);

            ivWeather = FindViewById<ImageView>(Resource.Id.ivWeather);
            ivWeather.Click += GetWeather;
            ivLocation = FindViewById<ImageView>(Resource.Id.ivLocation);
            ivLocation.Click += GetLocation;
            ivAddress = FindViewById<ImageView>(Resource.Id.ivAddress);
            ivAddress.Click += GetAddress;
            ivMap = FindViewById<ImageView>(Resource.Id.ivMap);
            ivMap.Click += OpenMapActivity;
                        
            chosenLocality = Resources.GetStringArray(Resource.Array.locality);
            acLocality = FindViewById<AutoCompleteTextView>(Resource.Id.acLocality);
            acLocality.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.TestListItem, chosenLocality);
            acLocality.ItemClick += acLocality_ItemClick;
            
            tvDate.Text = DateTime.Today.ToShortDateString(); // Sets the Current Date 

            // Disables the ImageViews when clicked
            ivAddress.Enabled = false; 
            ivMap.Enabled = false;
            ivWeather.Enabled = false;            
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Second);

            MilkVROptions = FindViewById<RadioGroup>(Resource.Id.MilkVROptions);
            AudioOptions = FindViewById<RadioGroup>(Resource.Id.AudioOption);
            LinkPreview = FindViewById<AutoCompleteTextView>(Resource.Id.LinkPreview);
            LinkPreview.Text = "MilkVRLauncher";

            lblUrl = FindViewById<TextView>(Resource.Id.lblUrl);

            button1 = FindViewById<Button>(Resource.Id.button1);
            button1.Click += delegate
            {
                string VideoFormat = LaunchExtensions[getSelectedElement(MilkVROptions), 1];
                string AudioFormat = AudioFormats[getSelectedElement(AudioOptions), 1];

                CreateMVRL(FilePath + LinkPreview.Text + ".mvrl", Url, VideoFormat, AudioFormat);
                ExecUri(convertMilkVRSideloadURL(Url, VideoFormat, AudioFormat));
            };

            Url = CheckForEmby(Intent.DataString);
            button1.Text =  Resources.GetText(Resource.String.ButtonStartCaption);
            lblUrl.Text = Url;

            //try
            //{
            //    string data = new System.Net.WebClient().DownloadString(Url);
            //    if (System.Uri.IsWellFormedUriString(data, UriKind.RelativeOrAbsolute))
            //    {
            //        Url = data;
            //        lblUrl.Text = data;
            //    };
            //}
            //catch
            //{ };

            InitRadioButtons(LaunchExtensions, Url,"ic_", MilkVROptions);
            InitRadioButtons(AudioFormats, Url,"", AudioOptions);
        }
 private void getCustomers(AutoCompleteTextView tv, String search)
 {
     try
     {
         service.getCustomer("*");
     }
     catch (Exception e)
     {
         Activity.RunOnUiThread(() =>
         {
             Toast.MakeText(Activity, e.Message, ToastLength.Short).Show();
         });
     }
     while (service.customersLock == true)
     {
     }
     Activity.RunOnUiThread(() =>
     {
         var adapter = service.PopulateCustomers(Activity, Resource.Layout.details, Resource.Id.Name);
         tv.Adapter = adapter;
     });
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Second);

            MilkVROptions = FindViewById<RadioGroup>(Resource.Id.MilkVROptions);
            LinkPreview = FindViewById<AutoCompleteTextView>(Resource.Id.LinkPreview);
            LinkPreview.Text = "MilkVRLauncher";

            lblUrl = FindViewById<TextView>(Resource.Id.lblUrl);

            button1 = FindViewById<Button>(Resource.Id.button1);
            button1.Click += delegate
            {
                CreateMVRL(FilePath + LinkPreview.Text + ".mvrl", Url, LaunchExtensions[getSelectedElement(MilkVROptions),1]);
                ExecUri(convertMilkVRSideloadURL(Url, LaunchExtensions[getSelectedElement(MilkVROptions), 1]));
            };

            Url = CheckForEmby(Intent.DataString);
            button1.Text =  Resources.GetText(Resource.String.ButtonStartCaption);
            lblUrl.Text = Url;

            InitRadioButtons(LaunchExtensions, Url);
        }
 private void ShowLoginPopup(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     View loginPopup = inflater.Inflate(Resource.Layout.Login, container);
     dialog = new Dialog(container.Context);
     dialog.SetContentView(loginPopup);
     dialog.SetTitle("Login");
     tv_customer_search = (AutoCompleteTextView)dialog.FindViewById(Resource.Id.autocomplete);
     tv_customer_search.Threshold = 1;
     EditText tfLogin =null;
     EditText tfPwd=null;
     //GUI-Elemente werden an Variablennamen gebunden
     //und entsprechende Events zugewiesen.
     tfLogin = loginPopup.FindViewById<EditText>(Resource.Id.tfLogin);
     tfPwd = loginPopup.FindViewById<EditText>(Resource.Id.tfPwd);
     Button btnLogin = loginPopup.FindViewById<Button>(Resource.Id.btnLogin);
     btnLogin.Click += delegate
     {
         ThreadPool.QueueUserWorkItem(o => btnLoginOnClick(btnLogin, null,tfLogin.Text, tfPwd.Text));
     };
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContentView = inflater.Inflate(Resource.Layout.Dashboard, null);
            items_list = mContentView.FindViewById<ListView>(Resource.Id.dashboardList);
            txtSelectedCustomer = mContentView.FindViewById<TextView>(Resource.Id.txtSelectedCustomer);
            actv_Item = mContentView.FindViewById<AutoCompleteTextView>(Resource.Id.actv_Item);
            actv_Item.Threshold = 1;
            Button btnAdd = mContentView.FindViewById<Button>(Resource.Id.btnAdd_to_Cart);
            btnAdd.Enabled = true;
            btnAdd.Clickable = true;
            btnAdd.Click += new EventHandler(btnAddOnClick);
            Activity activity = Activity;
            mContentView.SystemUiVisibilityChange += delegate(object sender, View.SystemUiVisibilityChangeEventArgs e)
            {
                ActionBar actionBar = Activity.ActionBar;
                if (actionBar != null)
                {
                    mContentView.SystemUiVisibility = e.Visibility;
                    if (e.Visibility == StatusBarVisibility.Visible)
                    {
                        actionBar.Show();
                    }
                    else
                    {
                        actionBar.Hide();
                    }
                }
            };

            // Show/hide the system status bar when single-clicking a photo. This is also called
            // 'lights out mode.' Activating and deactivating this mode also invokes the listener
            // defined above, which will show or hide the action bar accordingly.

            mContentView.Click += delegate
            {
                if (mContentView.SystemUiVisibility == StatusBarVisibility.Visible)
                {
                    mContentView.SystemUiVisibility = StatusBarVisibility.Hidden;
                }
                else
                {
                    mContentView.SystemUiVisibility = StatusBarVisibility.Visible;
                }
            };
            return mContentView;
        }
Beispiel #26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            nn_email = Intent.GetStringExtra ("autofillemail") ?? "";

            getcountryflag = false;
            getprovincestate = false;

            SetContentView (Resource.Layout.signup);

            rootlayout = (RelativeLayout)FindViewById (Resource.Id.rootlayout);

            SetTitleBarText (RegisterScreenData.Screentitle);
            SetTitleLeftImg (TapUtil.defaulticon);
            AddSpinner (RegisterScreenData.LoadingScreenTextInit);

            RelativeLayout backcontainer=(RelativeLayout)rootlayout.FindViewById (Resource.Id.header_back_relativelayout);
            backcontainer.Visibility = ViewStates.Visible;
            backimg = (ImageView)rootlayout.FindViewById (Resource.Id.header_backimg_imageview);
            backimg.Click+= (object sender, EventArgs e) => {
                Finish();
            };

            TextView basicinfo=FindViewById<TextView> (Resource.Id.signup_basicinfo_textview);
            basicinfo.Text = RegisterScreenData.BasicInfoLabelText;

            TextView contactinfo=FindViewById<TextView> (Resource.Id.signup_contactinfo_textview);
            contactinfo.Text = RegisterScreenData.ContactInfoLabelText;

            TextView address=FindViewById<TextView> (Resource.Id.signup_address_textview);
            address.Text = RegisterScreenData.AddressInfoLabelText;

            TextView communicateraffle=FindViewById<TextView> (Resource.Id.signup_communicateraffle_textview);
            communicateraffle.Text = RegisterScreenData.RaffleResultsLabelText;

            TextView receivecharity=FindViewById<TextView> (Resource.Id.signup_receivecharity_textview);
            receivecharity.Text = RegisterScreenData.CharityMarketingMessagesLabelText;

            picktimebutton = FindViewById<Button> (Resource.Id.signup_birthday_button);
            picktimebutton.Hint=RegisterScreenData.BirthDateTextFieldPlaceholder;
            picktimebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };

            countryspinner = FindViewById<Spinner> (Resource.Id.signup_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };

            provincespinner= FindViewById<Spinner> (Resource.Id.signup_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            raffleresultspinner= FindViewById<Spinner> (Resource.Id.signup_raffleresult_spinner);

            resultadapter = new CustomResultAndMessageSpinnerAdapter (this, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();

            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };

            marketmesagespinner= FindViewById<Spinner> (Resource.Id.signup_marketingmessage_spinner);

            messaegadapter = new CustomResultAndMessageSpinnerAdapter (this, GlobalVariable.ResultAndMessageList);
            marketmesagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();

            marketmesagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                marketmesagespinner.Tag=e.Position;
            };

            firstname_edittext = FindViewById<EditText> (Resource.Id.signup_firstname_edittext);
            SetEditTextMaximumLength (firstname_edittext,100);
            firstname_edittext.Hint = RegisterScreenData.FirstNameTextFieldPlaceholder;

            lastname_edittext = FindViewById<EditText> (Resource.Id.signup_lastname_edittext);
            SetEditTextMaximumLength (lastname_edittext,100);
            lastname_edittext.Hint = RegisterScreenData.LastNameTextFieldPlaceholder;

            mobilephone_edittext = FindViewById<EditText> (Resource.Id.signup_mobilephone_edittext);
            SetEditTextMaximumLength (mobilephone_edittext,20);
            mobilephone_edittext.InputType = global::Android.Text.InputTypes.ClassPhone;
            mobilephone_edittext.Hint = RegisterScreenData.MobilePhoneTextFieldPlaceholder;

            email_edittext = FindViewById<EditText> (Resource.Id.signup_email_edittext);
            SetEditTextMaximumLength (email_edittext,60);
            if(!string.IsNullOrEmpty(nn_email)){
                email_edittext.Text = nn_email;
            }
            email_edittext.Hint = RegisterScreenData.EmailTextFieldPlaceholder;

            confirmemail_edittext = FindViewById<EditText> (Resource.Id.signup_reemail_edittext);
            SetEditTextMaximumLength (confirmemail_edittext,60);
            confirmemail_edittext.Hint = RegisterScreenData.EmailConfirmTextFieldPlaceholder;

            address1_edittext = FindViewById<AutoCompleteTextView> (Resource.Id.signup_address1_edittext);
            SetEditTextMaximumLength (address1_edittext,100);
            address1_edittext.Hint = RegisterScreenData.Address1TextFieldPlaceholder;
            address1_edittext.Adapter=new GooglePlacesAutocompleteAdapter(this);
            address1_edittext.OnItemClickListener = this;
            address1_edittext.Threshold = 3;

            address2_edittext = FindViewById<EditText> (Resource.Id.signup_address2_edittext);
            SetEditTextMaximumLength (address2_edittext,100);
            address2_edittext.Hint = RegisterScreenData.Address2TextFieldPlaceholder;

            city_edittext = FindViewById<EditText> (Resource.Id.signup_city_edittext);
            SetEditTextMaximumLength (city_edittext,50);
            city_edittext.Hint = RegisterScreenData.CityTextFieldPlaceholder;

            postcode_edittext = FindViewById<EditText> (Resource.Id.signup_postal_edittext);
            SetEditTextMaximumLength (postcode_edittext,20);
            postcode_edittext.Hint = RegisterScreenData.ZipcodeTextFieldPlaceholder;

            MobileBarcodeScanner.Initialize (Application);
            scanner = new MobileBarcodeScanner();

            //			Button scanlicencebut=FindViewById<Button> (Resource.Id.signup_scanlicence_button);
            //			scanlicencebut.Click+=async delegate {
            //				//Tell our scanner to use the default overlay
            //				scanner.UseCustomOverlay = false;
            //
            //				//We can customize the top and bottom text of the default overlay
            //				scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
            //				scanner.BottomText = "Wait for the barcode to automatically scan!";
            //
            //				//Start scanning
            //				var result = await scanner.Scan();
            //
            //				HandleScanResult(result);
            //			};

            Button createaccountbutton = FindViewById<Button> (Resource.Id.signup_createaccount_button);
            createaccountbutton.Text = RegisterScreenData.CreateAccountBtnTitle;
            createaccountbutton.Click+= (object sender, EventArgs e) => {

                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[14];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message="First Name";
                    }
                    if(i==1){
                        message="Last Name";
                    }
                    if(i==2){
                        message="Mobile Phone";
                    }
                    if(i==3){
                        message="Email";
                    }
                    if(i==4){
                        message="Email Confirm";
                    }
                    if(i==5){
                        message="Address1";
                    }
                    if(i==6){
                        message="Address2";
                    }
                    if(i==7){
                        message="City";
                    }
                    if(i==8){
                        message="Postcode";
                    }
                    if(i==9){
                        message="Country";
                    }
                    if(i==10){
                        message="State And Province";
                    }
                    if(i==11){
                        message="Raffle Results";
                    }
                    if(i==12){
                        message="Market Message";
                    }
                    if(i==13){
                        message="Birthdate";
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                string firstname = firstname_edittext.Text;
                string lastname=lastname_edittext.Text;
                string mobilephone=mobilephone_edittext.Text;
                string email=email_edittext.Text;
                string reemail=confirmemail_edittext.Text;
                string address1=address1_edittext.Text;
                string address2=address2_edittext.Text;
                string city=city_edittext.Text;
                string postcode=postcode_edittext.Text;

                string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
                string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

                string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
                string marketmesage=marketmesagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)marketmesagespinner.Tag];

                string datetime=picktimebutton.Text;

                if(FormatManager.chechinput(firstname,FormatManager.FormatOption.OnlyLetter)){
                    flags[0].flag=true;
                }
                if(FormatManager.chechinput(lastname,FormatManager.FormatOption.OnlyLetter)){
                    flags[1].flag=true;
                }
                if(FormatManager.chechinput(mobilephone,FormatManager.FormatOption.OnlyNumber)&&mobilephone.Length>=5){
                    flags[2].flag=true;
                }
                if(FormatManager.chechinput(email,FormatManager.FormatOption.Email)){
                    flags[3].flag=true;
                }
                if(FormatManager.chechinput(reemail,FormatManager.FormatOption.Email)){
                    flags[4].flag=true;
                }
                if(!email.Equals(reemail)){
                    flags[4].flag=false;
                }
                if(FormatManager.chechinput(address1,FormatManager.FormatOption.Regular)){
                    flags[5].flag=true;
                }
                if(FormatManager.chechinput(address2,FormatManager.FormatOption.Regular)){
                    flags[6].flag=true;
                }
                //address2 can be empty
                if(address2.Equals("")){
                    flags[6].flag=true;
                }
                if(FormatManager.chechinput(city,FormatManager.FormatOption.Regular)){
                    flags[7].flag=true;
                }
                if(FormatManager.chechinput(postcode,FormatManager.FormatOption.Regular)){
                    flags[8].flag=true;
                }
                //postcode can be empty
                if(postcode.Equals("")){
                    flags[8].flag=true;
                }
                if(FormatManager.chechinput(country,FormatManager.FormatOption.Regular)){
                    flags[9].flag=true;
                }
                if(FormatManager.chechinput(stateandprovince,FormatManager.FormatOption.Regular)){
                    flags[10].flag=true;
                }
                if(FormatManager.chechinput(raffleresults,FormatManager.FormatOption.Regular)){
                    flags[11].flag=true;
                }
                if(FormatManager.chechinput(marketmesage,FormatManager.FormatOption.Regular)){
                    flags[12].flag=true;
                }
                if(FormatManager.chechinput(datetime,FormatManager.FormatOption.Date)){
                    flags[13].flag=true;
                }
                bool totalfalg=true;
                foreach(var flagobj in flags){
                    if(!flagobj.flag){
                        totalfalg=false;
                    }
                }
                if(totalfalg==true && email.Equals(reemail)){

                    AddSpinner(RegisterScreenData.LoadingScreenTextCreate);

                    Dictionary<string,string> paramdic =new Dictionary<string, string>();
                    paramdic.Add("email",email);
                    paramdic.Add("firstname",firstname);
                    paramdic.Add("lastname",lastname);
                    paramdic.Add("birthdate",datetime);
                    paramdic.Add("m_phone",mobilephone);
                    paramdic.Add("add1",address1);
                    paramdic.Add("add2",address2);
                    paramdic.Add("city",city);
                    paramdic.Add("province",stateandprovince);
                    paramdic.Add("postal",postcode);
                    paramdic.Add("country",country);
                    paramdic.Add("raffle_result",raffleresults);
                    paramdic.Add("charity_marketing_message",marketmesage);
            //					//try to create new user
                    App.INSTANCE.networknamager.Register (paramdic,(Tap5050WebResponse response)=>{
                        this.RunOnUiThread(()=>{
                            RemoveSpinner ();
                        });
                        if(response.available){
                            if((response.parsedobject as Register).result_success.Equals("Y")) {
                                ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenCreateAccountRespondTitle,RegisterScreenData.AlertScreenCreateAccountRespondSuccessMessage,GlobalScreenData.DefaultPositive,null,"registersuccessdialog");
                            }
                            else if((response.parsedobject as Register).result_success.Equals("N")){
                                ShowCustomAlterDialogFragment((response.parsedobject as Register).err_message,GlobalScreenData.DefaultPositive,null,"registerfailedsdialog");
                            }
                        }
                        else{
                            ShowCustomAlterDialogFragment(response.exceptionreport.errormessage,GlobalScreenData.DefaultPositive,null,"registerexceptiondialog");
                        }
                    });

                }
                else if(!email.Equals(reemail)){
                    Toast.MakeText(this,RegisterScreenData.AlertScreenEmailNotMatchTitle+"\n"+RegisterScreenData.AlertScreenEmailNotMatchMessage,ToastLength.Long).Show();
                }
                else if(totalfalg==false){
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+"\n";
                            }else{
                                message+=flags[i].message+".";
                            }
                        }
                    }
                    ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"formatcheckdialog");
                }

            };
            GetCountryStateAndProivince ();
        }
        //private string _parameterText;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            _locator = CrossGeolocator.Current;
            // New in iOS 9 allowsBackgroundLocationUpdates must be set if you are running a background agent to track location. I have exposed this on the Geolocator via:
            // disable because it drill down the battery very quickly
            _locator.AllowsBackgroundUpdates = false;
            _locator.DesiredAccuracy = 50;
            _locator.PositionChanged -= Locator_PositionChanged;
            _locator.PositionChanged += Locator_PositionChanged;

            // parse params to show any shared location if it exists
            ParseIntent();

            var tintManager = new SystemBarTintManager(this);
            // set the transparent color of the status bar, 30% darker
            tintManager.SetTintColor(Color.ParseColor("#30000000"));
            tintManager.SetNavigationBarTintEnabled(true);
            tintManager.StatusBarTintEnabled = true;

            // prevent the soft keyboard from pushing the view up
            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            // prepare icons for location / compass button
            var iconGenerator = new IconGenerator(this);
            iconGenerator.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_location, null));
            _iconUserLocation = iconGenerator.MakeIcon();
            iconGenerator.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_compass, null));
            _iconCompass = iconGenerator.MakeIcon();
            //var uiOptions = (int)this.Window.DecorView.SystemUiVisibility;
            //var newUiOptions = (int)uiOptions;
            //newUiOptions &= ~(int)SystemUiFlags.LowProfile;
            //newUiOptions &= ~(int)SystemUiFlags.Fullscreen;
            //newUiOptions &= ~(int)SystemUiFlags.HideNavigation;
            //newUiOptions &= ~(int)SystemUiFlags.Immersive;
            //newUiOptions |= (int)SystemUiFlags.ImmersiveSticky;
            //this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
            //Window.SetFlags(WindowManagerFlags.LayoutNoLimits, WindowManagerFlags.LayoutNoLimits);

            var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            //toolbar.Background.SetAlpha(200);
            ViewCompat.SetElevation(toolbar, 6f);
            SetSupportActionBar(toolbar);

            //Enable support action bar to display hamburger and back arrow
            // http://stackoverflow.com/questions/28071763/toolbar-navigation-hamburger-icon-missing
            _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            //_drawerToggle = new CustomActionBarDrawerToggle(this, _drawerLayout, toolbar, Resource.String.ApplicationName, Resource.String.ApplicationName);
            //_drawerToggle.DrawerIndicatorEnabled = true;
            _drawerLayout.SetDrawerListener(new CustomDrawerToggle(this));
            //Enable support action bar to display hamburger


            var burgerImage = FindViewById<ImageButton>(Resource.Id.burgerImage);
            burgerImage.SetOnClickListener(new HomeButtonClickListener(this));

            // SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetHomeButtonEnabled(false);
            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetDisplayShowCustomEnabled(false);

            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
            navigationView.SetNavigationItemSelectedListener(new NavigationItemSelectedListener(this));

            _bikesButton = FindViewById<FloatingActionButton>(Resource.Id.bikesButton);
            _bikesButton.BackgroundTintList = ColorStateList.ValueOf(Resources.GetColor(Resource.Color.primary_light));
            _bikesButton.Click += BikesButton_Click;

            _parkingButton = FindViewById<FloatingActionButton>(Resource.Id.parkingButton);
            _parkingButton.BackgroundTintList = ColorStateList.ValueOf(Resources.GetColor(Resource.Color.primary_light));
            _parkingButton.Click += ParkingButton_Click;

            _locationButton = FindViewById<FloatingActionButton>(Resource.Id.locationButton);
            _locationButton.BackgroundTintList = ColorStateList.ValueOf(Color.White);
            _locationButton.SetColorFilter(Color.Gray);

            _searchProgressBar = FindViewById<ProgressBar>(Resource.Id.searchProgressBar);

            // Doesn't work on Kitkat 4.4, use SetColorFilter instead
            //_locationButton.ImageTintList = ColorStateList.ValueOf(Color.Black);
            _locationButton.Click += LocationButton_Click;

            _tileButton = FindViewById<FloatingActionButton>(Resource.Id.tileButton);
            _tileButton.BackgroundTintList = ColorStateList.ValueOf(Color.White);
            _tileButton.SetColorFilter(Color.DarkGray);
            _tileButton.Click += TileButton_Click;
            var parent = (View)_tileButton.Parent;

            // Gets the parent view and posts a Runnable on the UI thread. 
            // This ensures that the parent lays out its children before calling the getHitRect() method.
            // The getHitRect() method gets the child's hit rectangle (touchable area) in the parent's coordinates.
            parent.Post(() =>
            {
                var touchRect = new Rect();
                _tileButton.GetHitRect(touchRect);
                touchRect.Top -= 200;
                touchRect.Left -= 200;
                touchRect.Bottom += 200;
                touchRect.Right += 200;


                parent.TouchDelegate = new TouchDelegate(touchRect, _tileButton);
            });

            _currentTileName = FindViewById<TextView>(Resource.Id.currentTileName);
            _currentTileNameAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.placeholder);
            _disappearTileNameAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.disappearAnimation);
            _currentTileNameAnimation.AnimationEnd += _currentTileNameAnimation_AnimationEnd;

            UnStickUserLocation();

            AutoCompleteSearchPlaceTextView = FindViewById<AutoCompleteTextView>(Resource.Id.autoCompleteSearchPlaceTextView);
            AutoCompleteSearchPlaceTextView.ItemClick += AutoCompleteSearchPlaceTextView_ItemClick;
            googlePlacesAutocompleteAdapter = new GooglePlacesAutocompleteAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line);
            AutoCompleteSearchPlaceTextView.Adapter = googlePlacesAutocompleteAdapter;


            Observable.FromEventPattern(AutoCompleteSearchPlaceTextView, "TextChanged")
                .Throttle(TimeSpan.FromMilliseconds(300))
                .Where(x => AutoCompleteSearchPlaceTextView.Text.Length >= 2)
                .Subscribe(async x =>
                {
                    try
                    {
                        RunOnUiThread(() =>
                        {
                            _searchProgressBar.Visibility = ViewStates.Visible;
                        });

                        using (var client = new HttpClient(new NativeMessageHandler()))
                        {
                            var response = await client.GetAsync(strAutoCompleteGoogleApi + AutoCompleteSearchPlaceTextView.Text + "&key=" + strGoogleApiKey).ConfigureAwait(false);
                            var responseBodyAsText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                            var predictions = JsonConvert.DeserializeObject<PlaceApiModel>(responseBodyAsText).predictions.ToList();
                            googlePlacesAutocompleteAdapter.Results = predictions;
                            if (AutoCompleteSearchPlaceTextView.Text.Length >= 2)
                            {
                                RunOnUiThread(() =>
                                {
                                    googlePlacesAutocompleteAdapter.NotifyDataSetChanged();
                                    EndPlacesSearch();
                                });
                            }
                        }
                    }
                    catch
                    {
                        RunOnUiThread(() =>
                        {
                            EndPlacesSearch();
                        });
                    }
                });


            //navigationView.NavigationItemSelected += (sender, e) =>
            //{
            //    e.MenuItem.SetChecked(true);
            //    //react to click here and swap fragments or navigate
            //    drawerLayout.CloseDrawers();
            //};

            // trigger the creation of the injected dependencies
            _settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
            _favoritesService = SimpleIoc.Default.GetInstance<IFavoritesService>();
        }
Beispiel #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_poisearch);
            // ��ʼ������ģ�飬ע�������¼�����
            mPoiSearch = PoiSearch.NewInstance();
            mPoiSearch.SetOnGetPoiSearchResultListener(this);
            mSuggestionSearch = SuggestionSearch.NewInstance();
            mSuggestionSearch.SetOnGetSuggestionResultListener(this);
            keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey);
            sugAdapter = new ArrayAdapter<string>(this,
                    Android.Resource.Layout.SimpleDropDownItem1Line);
            keyWorldsView.Adapter = sugAdapter;
            mBaiduMap = (Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                    .FindFragmentById(Resource.Id.map))).BaiduMap;

            /**
             * ������ؼ��ֱ仯ʱ����̬���½����б�
             */
            keyWorldsView.AfterTextChanged += (sender, e) => { };
            keyWorldsView.BeforeTextChanged += (sender, e) => { };
            keyWorldsView.TextChanged += (sender, e) =>
            {
                ICharSequence cs = new String(e.Text.ToString());
                if (cs.Length() <= 0)
                {
                    return;
                }
                string city = (FindViewById<EditText>(Resource.Id.city)).Text;
                /**
                 * ʹ�ý������������ȡ�����б�������onSuggestionResult()�и���
                 */
                mSuggestionSearch
                        .RequestSuggestion((new SuggestionSearchOption())
                                .Keyword(cs.ToString()).City(city));
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            int doctorID = Intent.GetIntExtra("DoctorID", 0);
            //			if(doctorID > 0) {
                doctor = DoctorManager.GetDoctor(doctorID);
            //			}

            // set our layout to be the home screen
            SetContentView(Resource.Layout.DoctorDetails);

            SNameTextEdit   = FindViewById<EditText> (Resource.Id.txtSecondName);
            FNameTextEdit   = FindViewById<EditText> (Resource.Id.txtFirstName);
            TNameTextEdit   = FindViewById<EditText> (Resource.Id.txtThirdName);
            TelTextEdit     = FindViewById<EditText> (Resource.Id.txtTel);
            EmailTextEdit   = FindViewById<EditText> (Resource.Id.txtEmail);
            CabinetTextEdit = FindViewById<EditText> (Resource.Id.txtCabinet);

            SpecTextEdit  = FindViewById<AutoCompleteTextView> (Resource.Id.actxtSpeciality);
            ArrayAdapter SpecTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line, DoctorSpecialitys.GetSpecialitys());
            SpecTextEdit.Adapter = SpecTextEditAdapter;

            PosTextEdit   = FindViewById<AutoCompleteTextView> (Resource.Id.txtPosition);
            ArrayAdapter PosTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line,DoctorPositions.GetPositions() );
            PosTextEdit.Adapter = PosTextEditAdapter;

            saveButton = FindViewById<Button> (Resource.Id.btnSave);
            cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
            chIsDays = FindViewById<CheckBox> (Resource.Id.chIsDays);
            lstWorkTime = FindViewById<ListView> (Resource.Id.lstWorkTime);

            // set the cancel delete based on whether or not it's an existing task
            if(cancelDeleteButton != null)
            { cancelDeleteButton.Text = (doctor.ID == 0 ? "Отмена" : "Удалить"); }

            // SecondName
            if(SNameTextEdit != null) { SNameTextEdit.Text = doctor.SecondName; }

            // FirstName
            if(FNameTextEdit != null) { FNameTextEdit.Text = doctor.FirstName; }

            // ThirdName
            if(TNameTextEdit != null) { TNameTextEdit.Text = doctor.ThirdName; }

            // Telephone
            if(TelTextEdit != null) { TelTextEdit.Text = doctor.Tel; }

            // E-mail
            if(EmailTextEdit != null) { EmailTextEdit.Text = doctor.Email; }

            // Cabinet
            if(CabinetTextEdit != null) { CabinetTextEdit.Text = doctor.Cabinet; }

            // Speciality
            if(SpecTextEdit != null) { SpecTextEdit.Text = doctor.Speciality; }

            // Position
            if(PosTextEdit != null) { PosTextEdit.Text = doctor.Position; }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click += (sender, e) => { Save(); };

            workTimeItems = new List<Tuple<String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>>();

            if (doctorID == 0) {
                chIsDays.Checked = true;
                doctor.wtKind = WorkTime_Kind.Days;
            } else {
                switch (doctor.wtKind) {
                case WorkTime_Kind.OddEven: { chIsDays.Checked = false; break; }
                case WorkTime_Kind.Days   : { chIsDays.Checked = true; break; }
                }
            }

            UpdateWorkTimeList();

            chIsDays.CheckedChange += (sender, e) => {
                if (chIsDays.Checked) { doctor.wtKind = WorkTime_Kind.Days; }
                else { doctor.wtKind = WorkTime_Kind.OddEven; }
                UpdateWorkTimeList();
            };

            /////////////////new code///////////////
            spnHospital = FindViewById<Spinner> (Resource.Id.spnHospital);
            hospitals = HospitalManager.GetHospitals();

            hospitalList = new Adapters.HospitalSpinnerAdapter(this, hospitals);
            spnHospital.Adapter = hospitalList;

            for (int i = 0; i < hospitals.Count; i++) {
                if (hospitals [i].ID == doctor.HospitalID) {
                    spnHospital.SetSelection (i + 1);
                }
            }

            spnHospital.ItemSelected += (sender, e) => {
                var s = sender as Spinner;
                if (e.Position == 0) {
                    doctor.HospitalID = -1;
                }
                else {
                    doctor.HospitalID = hospitals[e.Position - 1].ID;
                }
            };
            /////////////////new code///////////////
        }
 private void getItems(AutoCompleteTextView tv, String search)
 {
     try
     {
         service.getItems("*");
     }
     catch (Exception e)
     {
         if (e.Message.Contains("400"))
             getItems(tv,search);
         else
             Activity.RunOnUiThread(() =>
             {
                 Toast.MakeText(Activity, e.Message, ToastLength.Short).Show();
             });
     }
     while (service.itemLock == true)
     {
     }
     Activity.RunOnUiThread(() =>
     {
         var adapter = service.PopulateItems(Activity, Resource.Layout.autocomplete_item, Resource.Id.Desc1);
         tv.Adapter = adapter;
     });
 }
        public override global::Android.Views.View OnCreateView(global::Android.Views.LayoutInflater inflater,  global::Android.Views.ViewGroup container,  global::Android.OS.Bundle savedInstanceState)
        {
            var view = (RelativeLayout)inflater.Inflate (Resource.Layout.signup_fragment, container, false);

            rootlayout = (RelativeLayout)view.FindViewById (Resource.Id.rootlayout);
            loadingcontainer = new RelativeLayout (nn_activity);
            loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            loadingcontainer.SetBackgroundColor(Color.White);

            var detailcontainer = new LinearLayout (nn_activity);

            detailcontainer.Orientation = Orientation.Vertical;
            RelativeLayout.LayoutParams param=new RelativeLayout.LayoutParams((int)TapUtil.dptodx(100), RelativeLayout.LayoutParams.WrapContent);
            param.AddRule (LayoutRules.CenterInParent);
            detailcontainer.LayoutParameters = param;

            LinearLayout.LayoutParams linearlayoutparm=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            linearlayoutparm.Gravity=GravityFlags.CenterHorizontal;

            ProgressBar progressbar = new ProgressBar (nn_activity);
            progressbar.LayoutParameters =  linearlayoutparm;

            TextView tectview = new TextView (nn_activity);
            tectview.LayoutParameters = linearlayoutparm;
            tectview.Text = RegisterScreenData.LoadingScreenTextInit;
            tectview.Gravity = GravityFlags.CenterHorizontal;

            detailcontainer.AddView (progressbar);
            detailcontainer.AddView (tectview);

            loadingcontainer.AddView (detailcontainer);
            rootlayout.AddView (loadingcontainer);

            TextView basicinfo = view.FindViewById<TextView>(Resource.Id.signup_basicinfo_textview);
            basicinfo.Text = RegisterScreenData.BasicInfoLabelText;

            TextView contactinfo = view.FindViewById<TextView>(Resource.Id.signup_contactinfo_textview);
            contactinfo.Text = RegisterScreenData.ContactInfoLabelText;

            TextView address = view.FindViewById<TextView>(Resource.Id.signup_address_textview);
            address.Text = RegisterScreenData.AddressInfoLabelText;

            TextView communicateraffle = view.FindViewById<TextView>(Resource.Id.signup_communicateraffle_textview);
            communicateraffle.Text = RegisterScreenData.RaffleResultsLabelText;

            TextView receivecharity = view.FindViewById<TextView>(Resource.Id.signup_receivecharity_textview);
            receivecharity.Text = RegisterScreenData.CharityMarketingMessagesLabelText;

            picktimebutton = view.FindViewById<Button> (Resource.Id.signup_birthday_button);
            picktimebutton.Hint=RegisterScreenData.BirthDateTextFieldPlaceholder;
            picktimebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };
            countryspinner = view.FindViewById<Spinner> (Resource.Id.signup_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                    stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                    stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };
            provincespinner= view.FindViewById<Spinner> (Resource.Id.signup_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            raffleresultspinner= view.FindViewById<Spinner> (Resource.Id.signup_raffleresult_spinner);
            resultadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();
            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };

            marketmesagespinner= view.FindViewById<Spinner> (Resource.Id.signup_marketingmessage_spinner);

            messaegadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            marketmesagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();

            marketmesagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                marketmesagespinner.Tag=e.Position;
            };

            firstname_edittext = view.FindViewById<EditText> (Resource.Id.signup_firstname_edittext);
            SetEditTextMaximumLength (firstname_edittext,100);
            firstname_edittext.Hint = RegisterScreenData.FirstNameTextFieldPlaceholder;

            lastname_edittext = view.FindViewById<EditText> (Resource.Id.signup_lastname_edittext);
            SetEditTextMaximumLength (lastname_edittext,100);
            lastname_edittext.Hint = RegisterScreenData.LastNameTextFieldPlaceholder;

            mobilephone_edittext = view.FindViewById<EditText> (Resource.Id.signup_mobilephone_edittext);
            SetEditTextMaximumLength (mobilephone_edittext,20);
            mobilephone_edittext.InputType = global::Android.Text.InputTypes.ClassPhone;
            if(!string.IsNullOrEmpty(nn_phone)){
                mobilephone_edittext.Text = nn_phone;
            }
            mobilephone_edittext.Hint = RegisterScreenData.MobilePhoneTextFieldPlaceholder;

            email_edittext = view.FindViewById<EditText> (Resource.Id.signup_email_edittext);
            SetEditTextMaximumLength (email_edittext,60);
            if(!string.IsNullOrEmpty(nn_email)){
                email_edittext.Text = nn_email;
            }
            email_edittext.Hint = RegisterScreenData.EmailTextFieldPlaceholder;

            confirmemail_edittext = view.FindViewById<EditText> (Resource.Id.signup_reemail_edittext);
            SetEditTextMaximumLength (confirmemail_edittext,60);

            address1_edittext = view.FindViewById<AutoCompleteTextView> (Resource.Id.signup_address1_edittext);
            SetEditTextMaximumLength (address1_edittext,100);
            address1_edittext.Hint = RegisterScreenData.Address1TextFieldPlaceholder;
            address1_edittext.Adapter=new GooglePlacesAutocompleteAdapter(this);
            address1_edittext.OnItemClickListener = this;
            address1_edittext.Threshold = 3;

            address2_edittext = view.FindViewById<EditText> (Resource.Id.signup_address2_edittext);
            SetEditTextMaximumLength (address2_edittext,100);
            address2_edittext.Hint = RegisterScreenData.Address2TextFieldPlaceholder;

            city_edittext = view.FindViewById<EditText> (Resource.Id.signup_city_edittext);
            SetEditTextMaximumLength (city_edittext,50);
            city_edittext.Hint = RegisterScreenData.CityTextFieldPlaceholder;

            postcode_edittext = view.FindViewById<EditText> (Resource.Id.signup_postal_edittext);
            SetEditTextMaximumLength (postcode_edittext,20);
            postcode_edittext.Hint = RegisterScreenData.ZipcodeTextFieldPlaceholder;

            MobileBarcodeScanner.Initialize (nn_activity.Application);
            scanner = new MobileBarcodeScanner();

            TextView signuphint = view.FindViewById<TextView> (Resource.Id.signup_hint_textview);
            signuphint.Text = RegisterScreenData.BuyerSignupHint;
            signuphint.SetTextColor (Color.Red);

            //			Button scanlicencebut=view.FindViewById<Button> (Resource.Id.signup_scanlicence_button);
            //			scanlicencebut.Click+=async delegate {
            //				//Tell our scanner to use the default overlay
            //				scanner.UseCustomOverlay = false;
            //
            //				//We can customize the top and bottom text of the default overlay
            //				scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
            //				scanner.BottomText = "Wait for the barcode to automatically scan!";
            //
            //				//Start scanning
            //				var result = await scanner.Scan();
            //
            //				HandleScanResult(result);
            //			};

            Button createaccountbutton = view.FindViewById<Button> (Resource.Id.signup_createaccount_button);
            createaccountbutton.Text = RegisterScreenData.CreateAccountBtnTitle;
            createaccountbutton.Click+= (object sender, EventArgs e) => {

                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[14];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message="First Name";
                    }
                    if(i==1){
                        message="Last Name";
                    }
                    if(i==2){
                        message="Mobile Phone";
                    }
                    if(i==3){
                        message="Email";
                    }
                    if(i==4){
                        message="Email Confirm";
                    }
                    if(i==5){
                        message="Address1";
                    }
                    if(i==6){
                        message="Address2";
                    }
                    if(i==7){
                        message="City";
                    }
                    if(i==8){
                        message="Postcode";
                    }
                    if(i==9){
                        message="Country";
                    }
                    if(i==10){
                        message="State And Province";
                    }
                    if(i==11){
                        message="Raffle Results";
                    }
                    if(i==12){
                        message="Market Message";
                    }
                    if(i==13){
                        message="Birthdate";
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                string firstname = firstname_edittext.Text;
                string lastname=lastname_edittext.Text;
                string mobilephone=mobilephone_edittext.Text;
                string email=email_edittext.Text;
                string reemail=confirmemail_edittext.Text;
                string address1=address1_edittext.Text;
                string address2=address2_edittext.Text;
                string city=city_edittext.Text;
                string postcode=postcode_edittext.Text;

                string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
                string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

                string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
                string marketmesage=marketmesagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)marketmesagespinner.Tag];

                string datetime=picktimebutton.Text;

                if(FormatManager.chechinput(firstname,FormatManager.FormatOption.OnlyLetter)){
                    flags[0].flag=true;
                }
                if(FormatManager.chechinput(lastname,FormatManager.FormatOption.OnlyLetter)){
                    flags[1].flag=true;
                }
                if(FormatManager.chechinput(mobilephone,FormatManager.FormatOption.OnlyNumber)&&mobilephone.Length>=5){
                    flags[2].flag=true;
                }
                if(FormatManager.chechinput(email,FormatManager.FormatOption.Email)){
                    flags[3].flag=true;
                }
                if(FormatManager.chechinput(reemail,FormatManager.FormatOption.Email)){
                    flags[4].flag=true;
                }
                if(!email.Equals(reemail)){
                    flags[4].flag=false;
                }
                if(FormatManager.chechinput(address1,FormatManager.FormatOption.Regular)){
                    flags[5].flag=true;
                }
                if(FormatManager.chechinput(address2,FormatManager.FormatOption.Regular)){
                    flags[6].flag=true;
                }
                //address2 can be empty
                if(address2.Equals("")){
                    flags[6].flag=true;
                }
                if(FormatManager.chechinput(city,FormatManager.FormatOption.Regular)){
                    flags[7].flag=true;
                }
                if(FormatManager.chechinput(postcode,FormatManager.FormatOption.Regular)){
                    flags[8].flag=true;
                }
                //postcode can be empty
                if(postcode.Equals("")){
                    flags[8].flag=true;
                }
                if(FormatManager.chechinput(country,FormatManager.FormatOption.Regular)){
                    flags[9].flag=true;
                }
                if(FormatManager.chechinput(stateandprovince,FormatManager.FormatOption.Regular)){
                    flags[10].flag=true;
                }
                if(FormatManager.chechinput(raffleresults,FormatManager.FormatOption.Regular)){
                    flags[11].flag=true;
                }
                if(FormatManager.chechinput(marketmesage,FormatManager.FormatOption.Regular)){
                    flags[12].flag=true;
                }
                if(FormatManager.chechinput(datetime,FormatManager.FormatOption.Date)){
                    flags[13].flag=true;
                }
                bool totalfalg=true;
                foreach(var flagobj in flags){
                    if(!flagobj.flag){
                        totalfalg=false;
                    }
                }
                if(totalfalg==true && email.Equals(reemail)){

                    nn_activity.AddSpinner(RegisterScreenData.LoadingScreenTextCreate);

                    Dictionary<string,string> paramdic =new Dictionary<string, string>();
                    paramdic.Add("email",email);
                    paramdic.Add("firstname",firstname);
                    paramdic.Add("lastname",lastname);
                    paramdic.Add("birthdate",datetime);
                    paramdic.Add("m_phone",mobilephone);
                    paramdic.Add("add1",address1);
                    paramdic.Add("add2",address2);
                    paramdic.Add("city",city);
                    paramdic.Add("province",stateandprovince);
                    paramdic.Add("postal",postcode);
                    paramdic.Add("country",country);
                    paramdic.Add("raffle_result",raffleresults);
                    paramdic.Add("charity_marketing_message",marketmesage);

                    App.INSTANCE.networknamager.Register (paramdic,(Tap5050WebResponse response)=>{
                        nn_activity.RunOnUiThread(()=>{
                            nn_activity.RemoveSpinner();
                        });
                        if(response.available){
                            if((response.parsedobject as Register).result_success.Equals("Y")) {
                                nn_activity.ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenCreateAccountRespondTitle,RegisterScreenData.AlertScreenCreateAccountRespondSuccessMessage,GlobalScreenData.DefaultPositive,null,"successdialog.buyersignup.success",email);
                            }
                            else if((response.parsedobject as Register).result_success.Equals("N")){
                                nn_activity.ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenCreateAccountRespondTitle,(response.parsedobject as Register).err_message,GlobalScreenData.DefaultPositive,null,"invalidedialog.buyersignup.failed");
                            }
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.DefaultPositive,null,"exceptiondialog.buyersignup.failed");
                        }
                    });

                }
                else if(!email.Equals(reemail)){
                    Toast.MakeText(nn_activity,RegisterScreenData.AlertScreenEmailNotMatchTitle+"\n"+RegisterScreenData.AlertScreenEmailNotMatchMessage,ToastLength.Long).Show();
                }
                else if(totalfalg==false){
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+"\n";
                            }else{
                                message+=flags[i].message+".";
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"formatcheckdialog");
                }

            };

            return view;
        }
Beispiel #32
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            Window.RequestFeature (WindowFeatures.NoTitle);
            SetContentView (Resource.Layout.Main);
            Window.SetBackgroundDrawableResource (Resource.Drawable.empty);
            Window.SetFeatureInt (WindowFeatures.NoTitle,0);
            Window.ClearFlags (WindowManagerFlags.DimBehind);

            kalinga = Typeface.CreateFromAsset (this.Assets, "fonts/kalinga.ttf");
            kalingab = Typeface.CreateFromAsset (this.Assets, "fonts/kalingab.ttf");

            prefs = GetPreferences (FileCreationMode.Append);
            firstTime = prefs.GetBoolean (FIRST, true);
            tSel = prefs.GetBoolean (TIMESEL, true);

            flipper = FindViewById<ViewFlipper> (Resource.Id.viewFlipper1);
            viewStart = FindViewById<LinearLayout> (Resource.Id.view1);
            viewSearch = FindViewById<LinearLayout> (Resource.Id.view2);
            ibSearch = FindViewById<ImageButton> (Resource.Id.ibSearch);
            ibTravel = FindViewById<ImageButton> (Resource.Id.ibTravel);
            ibPrevious = FindViewById<ImageButton> (Resource.Id.ibPrevious);
            main = FindViewById<LinearLayout> (Resource.Id.llMain);
            from = FindViewById<TextView> (Resource.Id.tvFrom);
            fromInput = FindViewById<AutoCompleteTextView> (Resource.Id.atvFrom);
            toInput = FindViewById<AutoCompleteTextView> (Resource.Id.atvTo);
            to = FindViewById<TextView> (Resource.Id.tvTo);
            dateLabel = FindViewById<Button> (Resource.Id.tvDate);
            timeLabel = FindViewById<Button> (Resource.Id.tvTime);
            rbDepart = FindViewById<RadioButton> (Resource.Id.rbDeparture);
            rbArrive = FindViewById<RadioButton> (Resource.Id.rbArrival);
            var dateButton = FindViewById<ImageButton> (Resource.Id.btnDate);
            var timeButton = FindViewById<ImageButton> (Resource.Id.btnTime);
            var btnGo = FindViewById<Button> (Resource.Id.btnGo);

            dateButton.Click += DatePicker_Dialog;
            dateLabel.Click += DatePicker_Dialog;
            timeButton.Click += TimePicker_Dialog;
            timeLabel.Click += TimePicker_Dialog;
            btnGo.Click += Download_Itinerary;
            rbDepart.Click += RadioButtonClick;
            rbArrive.Click += RadioButtonClick;
            btnGo.Click += CloseKeyBoard;
            main.Click += CloseKeyBoard;
            from.Click += ShowFocus;
            to.Click += ShowFocus;
            fromInput.TextChanged += ChangeGravity;
            toInput.TextChanged += ChangeGravity;
            ibSearch.Click += NextView;
            ibPrevious.Click += PreviousView;
            ibTravel.Click += delegate {
                StartActivity (typeof (ActivityUnderConstruction));
            };

            DateTime now = DateTime.Now;
            var day = XTool.CatchZero (now.Day);
            var month = XTool.CatchZero (now.Month);
            var year = XTool.CatchZero (now.Year - 2000);
            var hour = XTool.CatchZero (now.Hour);
            var minute = XTool.CatchZero (now.Minute);

            RunOnUiThread (() => {
                dateLabel.Text = String.Format ("{0}/{1}/{2}", day, month, year);
                timeLabel.Text = String.Format ("{0}:{1}", hour, minute);

                rbDepart.Checked = tSel;
                rbArrive.Checked = !tSel;
                from.Typeface = kalinga;
                fromInput.Typeface = kalingab;
                to.Typeface = kalinga;
                toInput.Typeface = kalingab;
                dateLabel.Typeface = kalinga;
                timeLabel.Typeface = kalinga;
                rbArrive.Typeface = tSel ? kalinga : kalingab;
                rbDepart.Typeface = tSel ? kalingab : kalinga;
                btnGo.Typeface = kalingab;
            });

            if (firstTime) {
                Download_Stations ();
            } else {
            //				using (StreamReader reader = new StreamReader(Assets.Open ("stations.txt")))
            //				{
            //					var line = reader.ReadToEnd ();
            //					reader.Close ();
            //					SaveStations (line);
            //				}
            }

            var dbStation = new StationCommands (this);
            List<string> list = new List<string> ();
            list = dbStation.All;
            dbStation.Close ();
            autoCompleteAdapter = new ArrayAdapter (this, Resource.Layout.autocomplete, list.ToArray ());
            fromInput.Adapter = autoCompleteAdapter;
            toInput.Adapter = autoCompleteAdapter;
        }