Ejemplo n.º 1
1
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			items = new string[] { "Sessions", "Speakers", "About" };
			ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };
            ArrayAdapter la = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
            ListView lview = FindViewById<ListView> (Resource.Id.listView1);
            lview.Adapter = la;

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

            button.Click += delegate {
                button.Text = string.Format ("{0} clicks!", count++);

                ProgressBar pbar1 = FindViewById<ProgressBar> (Resource.Id.progressBar1);
                pbar1.Visibility = ViewStates.Visible;

            };

            ProgressBar pbar = FindViewById<ProgressBar> (Resource.Id.progressBar1);
            pbar.Visibility = ViewStates.Gone;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.AutoCompleteTextView);

            AutoCompleteTextView act = FindViewById<AutoCompleteTextView>(Resource.Id.AutoCompleteInput);


            Stream seedDataStream = Assets.Open(@"WordList.txt");
            
            List<string> lines = new List<string>();
            using (StreamReader reader = new StreamReader(seedDataStream)) {
                string line;
                while ((line = reader.ReadLine()) != null) {
                    lines.Add(line);
                }
            }

            string[] wordlist = lines.ToArray();


            ArrayAdapter arr = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, wordlist);
            act.Adapter = arr;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.Contacts, container, false);

            contacts_listview = view.FindViewById<ListView>(Resource.Id.contactList);

            //populate the list contact
            foreach(User user in DataBase.current_user.contacts)
            {
                contacts.Add(user.pseudo);
            }

            // Create and set the adapter
            ArrayAdapter<string> adapter = new ArrayAdapter<string>(Activity, Android.Resource.Layout.SimpleListItem1, contacts);
            contacts_listview.Adapter = adapter;


            //affichage du contact
            contacts_listview.ItemClick += OnListItemClick;
  
            // Actions pour l'ajout de contact
            TextView addContact = view.FindViewById<TextView>(Resource.Id.add_contact_text);

            addContact.Click += delegate
            {
                Activity.StartActivity(typeof(AddContactActivity));
            };

            // Return
            return view;
        }
        protected override void OnCreate (Bundle savedInstanceState) 
        {
            base.OnCreate (savedInstanceState);
            SetContentView (Resource.Layout.person_list_activity);

            var options = new PlusClass.PlusOptions.Builder ().AddActivityTypes (MomentUtil.ACTIONS).Build ();
            mGoogleApiClient = new GoogleApiClientBuilder (this)
                .AddConnectionCallbacks (this)
                .AddOnConnectionFailedListener (this)
                .AddApi (PlusClass.API, options)
                .AddScope (PlusClass.ScopePlusLogin)
                .Build ();

            mListItems = new List<string>();
            mListAdapter = new ArrayAdapter<string> (this,
                Android.Resource.Layout.SimpleListItem1, mListItems);
            mPersonListView = FindViewById<ListView> (Resource.Id.person_list);
            mResolvingError = savedInstanceState != null
                && savedInstanceState.GetBoolean (STATE_RESOLVING_ERROR, false);

            var available = GooglePlayServicesUtil.IsGooglePlayServicesAvailable (this);
            if (available != CommonStatusCodes.Success)
                ShowDialog (DIALOG_GET_GOOGLE_PLAY_SERVICES);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) {
                this.ActionBar.SetDisplayHomeAsUpEnabled (true);
            }
        }
        public void UpdateArtistsList()
        {
            list = model.Songs.Select (s => s.Artist).Distinct ().OrderBy (s => s).Select (s => new String (s)).ToArray ();

            var adapter = new ArrayAdapter<String> (this, Android.Resource.Layout.SimpleListItem1, list);
            this.ListAdapter = adapter;
        }
Ejemplo n.º 7
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            if (!IsConnectedToService())
            {
                throw new Exception("cant connect to service");
            }

            base.OnCreate(bundle);

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

            ListView carListView = FindViewById<ListView>(Resource.Id.carlistView);

            List<string> cars = (await _client.GetAllAsync()).Select(x=>x.Model).ToList();

            _adapter = new ArrayAdapter(
                this,
                Android.Resource.Layout.SimpleListItem1,
                cars);

            carListView.Adapter = _adapter;
        }
Ejemplo n.º 8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            items = new string[] { "DrawerLayout","SlidingPaneLayout"};
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
        }
Ejemplo n.º 9
0
 //ListView mainListView ;
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate (bundle);
        			SetContentView (Resource.Layout.Books);
     items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };
     ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
 }
Ejemplo n.º 10
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            var client = new Client("Android");

            var input = FindViewById<EditText>(Resource.Id.Input);
            var messages = FindViewById<ListView>(Resource.Id.Messages);

            var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
            var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, new List<string>());

            messages.Adapter = adapter;

            await client.Connect();

            input.EditorAction +=
              delegate
              {
                  inputManager.HideSoftInputFromWindow(input.WindowToken, HideSoftInputFlags.None);

                  if (string.IsNullOrEmpty(input.Text))
                      return;

                  client.Send(input.Text);

                  input.Text = "";
              };

            client.OnMessageReceived +=
              (sender, message) => RunOnUiThread(() =>
                adapter.Add(message));
        }
Ejemplo n.º 11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            items = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemChecked, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemSingleChoice, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemMultipleChoice, items);

            ListView lv = FindViewById<ListView>(Android.Resource.Id.List);
#if __ANDROID_11__
            lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // 1
            //lv.ChoiceMode = Android.Widget.ChoiceMode.Multiple; // 2
            //lv.ChoiceMode = Android.Widget.ChoiceMode.None; // 0
#else
            lv.ChoiceMode = 1; // Single
            //lv.ChoiceMode = 0; // none
            //lv.ChoiceMode = 2; // Multiple
            //lv.ChoiceMode = 3; // MultipleModal
#endif
            // Set the initially checked row ("Fruits")
            lv.SetItemChecked(1, true);

            // Set another initially checked row ("Bulbs") IF multiple selection allowed
            lv.SetItemChecked(4, true);
        }
Ejemplo n.º 12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            Assembly asm = Assembly.GetExecutingAssembly();
            Stream pdfStream = asm.GetManifestResourceStream("PDFToImage.xfinium.pdf");
            document = new PdfFixedDocument (pdfStream);
            pdfStream.Close();

            Spinner pageNumbers = FindViewById<Spinner>(Resource.Id.pageNumberSpinner);
            ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            pageNumbers.Adapter = adapter;
            adapter.Add("Please select a page number");
            for (int i = 1; i <= document.Pages.Count; i++)
            {
                adapter.Add(i.ToString());
            }
            Button button = FindViewById<Button> (Resource.Id.btnConvertToImage);

            button.Click += delegate {
                if ((pageNumbers.SelectedItemPosition >= 1) && (pageNumbers.SelectedItemPosition <= document.Pages.Count))
                {
                    PdfPageRenderer renderer = new PdfPageRenderer (document.Pages [pageNumbers.SelectedItemPosition - 1]);
                    Bitmap pageImage = renderer.ConvertPageToImage (96);

                    ImageView pageImageView = FindViewById<ImageView> (Resource.Id.pageImageView);
                    pageImageView.SetImageBitmap(pageImage);
                }
            };
        }
Ejemplo n.º 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var phoneNumbers = Intent.Extras.GetStringArrayList("phone_numbers") ?? new string[0];
            ListAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleExpandableListItem1, phoneNumbers);
        }
        private void SetupBankViews(View parent)
        {
            var banksSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank);
            var banksBranchSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank_branch);

            var banks = bankRepository.GetAll().ToList();
            var bankNames = banks.Select(b => b.Name).ToList();
            var banksAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item, bankNames);
            banksSpinner.Adapter = banksAdapter;

            var bankBranchesAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item);
            banksBranchSpinner.Adapter = bankBranchesAdapter;

            banksSpinner.ItemSelected += delegate
            {
                this.bank = banks[banksSpinner.SelectedItemPosition];

                var bankBranchNames = bank.Branches.Select(b => b.Name).ToList();
                bankBranchesAdapter.Clear();
                bankBranchesAdapter.AddAll(bankBranchNames);

                banksBranchSpinner.ItemSelected += delegate
                {
                    this.bankBranch = bank.Branches[banksBranchSpinner.SelectedItemPosition];
                };
            };

            bank = banks.First();
            bankBranch = bank.Branches.First();
        }
Ejemplo n.º 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            //Vue qui va contenir la liste des groupes de l'utilisateur
            ListView lv = FindViewById<ListView>(Resource.Id.List);
            lv.ChoiceMode = ChoiceMode.Single;  //On ne peut selectionné qu'un item
            
            //On remplit la liste items avec les noms de groupes du user

            foreach (Group grp in users_db[1].groups)
            {
                items.Add(grp.groupName);
            }

            //on remplit le ListView avec la liste items
            ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItemActivated1, items);
            lv.Adapter = adapter;
            
            lv.ItemClick += OnListItemClick;

        }
Ejemplo n.º 16
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			lstUserNames.Add ("Bob");
			lstUserNames.Add ("Mike");
			lstUserNames.Add ("Rick");
			lstUserNames.Add ("Stu");
			lstUserNames.Add ("Jim");

			// 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
			Spinner spnUser = FindViewById<Spinner> (Resource.Id.spnUser);
			TextView lblCurrentUser =  FindViewById<TextView> (Resource.Id.lblCurrentUser);
			ArrayAdapter adapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, lstUserNames);
			spnUser.Adapter = adapter;
			spnUser.ItemSelected += delegate {
				lblCurrentUser.Text = spnUser.SelectedItem.ToString();
			};
			//Button button = FindViewById<Button> (Resource.Id.myButton);
			
		//	button.Click += delegate {
		//		button.Text = string.Format ("{0} clicks!", count++);
		//	};
		}
Ejemplo n.º 17
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.list_12);

			mAdapter = new ArrayAdapter<String> (this, Android.Resource.Layout.SimpleListItem1, mStrings);

			ListAdapter = mAdapter;

			mUserText = FindViewById <EditText> (Resource.Id.userText);

			mUserText.Click += delegate {
				SendText ();
			};

			mUserText.KeyPress += delegate (object sender, View.KeyEventArgs e) {
				if (e.Event.Action == KeyEventActions.Down) {
					switch (e.KeyCode) {
					case Keycode.DpadCenter:
					case Keycode.Enter:
						SendText ();
						break;
					case Keycode.Back:
						OnBackPressed ();
						break;
					}
				}
			};
		}
 public EndlessScrollListener(ArrayAdapter<DateTime> adapter)
 {
     this.adapter = adapter;
     for (int i = 0; i < chunksize*2; i++) {
         adapter.Add (DateTime.Now.AddDays (i));
     };
 }
Ejemplo n.º 19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            this._feedManager = new FeedManager ();
            this._feedManager.FeedAdded += this.FeedAdded;

            SetContentView (Resource.Layout.Main);

            var drawList = this.FindViewById<ListView>(Resource.Id.DrawNavigation);

            this._drawListAdapter = new ArrayAdapter<string> (
                this,
                Resource.Layout.DrawListItem,
                this._feedManager.Feeds.Select(f => f.Name == null ? f.FeedLocation.AbsoluteUri : f.Name).ToList());

            drawList.Adapter = this._drawListAdapter;

            var layout = this.FindViewById<DrawerLayout> (Resource.Id.MainLayout);

            this.ActionBar.SetDisplayHomeAsUpEnabled (true);
            this.ActionBar.SetHomeButtonEnabled(true);

            this._drawToggle = new ActionBarDrawerToggle(
                this,
                layout,
                Resource.Drawable.ic_drawer,
                Resource.String.DrawerOpen,
                Resource.String.DrawerClose);

            layout.SetDrawerListener (this._drawToggle);
        }
Ejemplo n.º 20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.ShareLocation);

            customDate = DateTime.Now;

            boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress);
            boxProgress.Visibility = ViewStates.Gone;

            textDate = FindViewById<TextView> (Resource.Id.textDate);
            textDate.Visibility = ViewStates.Gone;

            spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime);
            spinnerTime.ItemSelected += HandleItemSelected;
            arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem);
            arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerTime.Adapter = arrayAdapter;
            spinnerTime.SetSelection (defaultTimeIndex);
            selectedTime = timeValues [defaultTimeIndex];

            shareButton = FindViewById<Button> (Resource.Id.buttonShare);
            shareButton.Click += HandleShareClick;

            textDate.Click += delegate {
                ShowDialog (0);
            };
        }
Ejemplo n.º 21
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // shows a spinner while it gets polls from database
            var progressDialog = new ProgressDialog(this);
            progressDialog.Show();
            {
                try
                {
                    // gets all the polls from the database
                    polls = await VotingService.MobileService.GetTable<Poll>().ToListAsync();
                }
                catch (Exception exc)
                {
                    // error dialog that shows if something goes wrong
                    var errorDialog = new AlertDialog.Builder(this).SetTitle("Oops!").SetMessage("Something went wrong " + exc.ToString()).SetPositiveButton("Okay", (sender1, e1) =>
                    {

                    }).Create();
                    errorDialog.Show();
                }
            };
            // ends spinner on completion
            progressDialog.Dismiss();

            // created table for polls
            ListAdapter = new ArrayAdapter<Poll>(this, Android.Resource.Layout.SimpleListItem1, polls);
        }
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var detailsFrame = Activity.FindViewById<View>(Resource.Id.details);

            // If running on a tablet, then the layout in Resources/Layout-Large will be loaded.
            // That layout uses fragments, and defines the detailsFrame. We use the visiblity of
            // detailsFrame as this distinguisher between tablet and phone.
            _isDualPane = detailsFrame != null && detailsFrame.Visibility == ViewStates.Visible;

            var adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, Shakespeare.Titles);
            ListAdapter = adapter;

            if (savedInstanceState != null)
            {
                _currentPlayId = savedInstanceState.GetInt("current_play_id", 0);
            }

            if (_isDualPane)
            {
                ListView.ChoiceMode = ChoiceMode.Single;
                ShowDetails(_currentPlayId);
            }
        }
Ejemplo n.º 23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            SetTitle (Resource.String.mainmenu_settings);
            SetContentView (Resource.Layout.AdPara);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights = Utility.GetAccessRights (pathToDatabase);

            spinPrType= FindViewById<Spinner> (Resource.Id.txtprintertype);
            spinner = FindViewById<Spinner> (Resource.Id.txtSize);
            spinBt= FindViewById<Spinner> (Resource.Id.txtprinters);
            Button butSave = FindViewById<Button> (Resource.Id.ad_bSave);
            Button butCancel = FindViewById<Button> (Resource.Id.ad_Cancel);
            FindControls ();

            butSave.Click += butSaveClick;
            butCancel.Click += butCancelClick;
            findBTPrinter ();
            //RunOnUiThread(()=>{ findBTPrinter ();});
            adapterPT = ArrayAdapter.CreateFromResource (this, Resource.Array.printer_array, Android.Resource.Layout.SimpleSpinnerItem);
            adapterPT.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

            adapter = ArrayAdapter.CreateFromResource (this, Resource.Array.papersize_array, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

            spinPrType.Adapter = adapterPT;
            spinner.Adapter = adapter;
            spinner.ItemSelected+= Spinner_ItemSelected;
            spinBt.ItemSelected+= Spinner_ItemSelected;
            LoadData ();
            // Create your application here
        }
Ejemplo n.º 24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            Button startTest = FindViewById<Button>(Resource.Id.startTest);
            ListView listView = FindViewById<ListView>(Resource.Id.listView);

            startTest.Click += delegate
            {
                ArrayAdapter<string> adapter = new ArrayAdapter<string>(
                    this,
                    Android.Resource.Layout.SimpleListItem1,
                    Android.Resource.Id.Text1);
                listView.Adapter = adapter;

                OkHttpClient client = new OkHttpClient();

                // Create request for remote resource.
                Request request = new Request.Builder()
                    .Url(Endpoint)
                    .Build();

                // Execute the request and retrieve the response.
                WebSocketCall call = WebSocketCall.Create(client, request);
                WebSocketListener listener = call.Enqueue();

                // attach handlers to the various events
                listener.Close += (sender, e) =>
                {
                    RunOnUiThread(() => adapter.Add(string.Format("{0}: {1}", e.Code, e.Reason)));
                };
                listener.Failure += (sender, e) =>
                {
                    if (e.Exception != null)
                        RunOnUiThread(() => adapter.Add(e.Exception.Message));
                    else
                        RunOnUiThread(() => adapter.Add("Unknown Error!"));
                };
                listener.Message += (sender, e) =>
                {
                    string payload = e.Payload.String();
                    e.Payload.Close();
					RunOnUiThread(() => adapter.Add(string.Format("{0}\n{1}", payload, e.Payload.ContentType())));
                };
                listener.Open += (sender, e) =>
                {
                    RunOnUiThread(() => adapter.Add("Opened Web Socket."));

                    StartMessages(e.WebSocket);
                };
                listener.Pong += (sender, e) =>
                {
                    string payload = e.Payload.ReadString(Charset.DefaultCharset());
                    e.Payload.Close();
                    RunOnUiThread(() => adapter.Add(payload));
                };
            };
        }
 public MultiSelectionSpinner(Context c, IAttributeSet attr, int defStyle)
     : base(c, attr, defStyle)
 {
     context = c;
     simpleAdapter = new ArrayAdapter<string>(context, Android.Resource.Layout.SimpleSpinnerItem);
     Adapter = simpleAdapter;
 }
 public MultiSelectionSpinner(Context c)
     : base(c, null)
 {
     context = c;
     simpleAdapter = new ArrayAdapter<string>(context, Android.Resource.Layout.SimpleSpinnerItem);
     Adapter = simpleAdapter;
 }
Ejemplo n.º 27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            beaconManager = new BeaconManager(this);
            beaconManager.Eddystone += (sender, e) => 
                {
                    if(e.Eddystones.Count == 0)
                        return;

                    RunOnUiThread(()=>
                        {
                            var items = e.Eddystones.Select(n => "Url: " + n.Url + "Proximity: " + Utils.ComputeProximity(n));
                            ListAdapter = new ArrayAdapter<string>(this, 
                                Android.Resource.Layout.SimpleListItem1, 
                                Android.Resource.Id.Text1, 
                                items.ToArray());



                            ActionBar.Subtitle = string.Format("Found {0} eddystones.", items.Count());
                        });


                };



        }
Ejemplo n.º 28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            items = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemChecked, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemSingleChoice, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemMultipleChoice, items);

            ListView lv = FindViewById<ListView>(Android.Resource.Id.List);

			// For targeting Gingerbread the ChoiceMode is an int, otherwise it is an
			// enumeration.
			 
            lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // 1
            //lv.ChoiceMode = Android.Widget.ChoiceMode.Multiple; // 2
            //lv.ChoiceMode = Android.Widget.ChoiceMode.None; // 0

			// Use this block if targeting Gingerbread or Lower
			/*
			lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // Single
            //lv.ChoiceMode = 0; // none
            //lv.ChoiceMode = 2; // Multiple
            //lv.ChoiceMode = 3; // MultipleModal
			*/

            // Set the initially checked row ("Fruits")
            lv.SetItemChecked(1, true);

            // Set another initially checked row ("Bulbs") IF multiple selection allowed
            lv.SetItemChecked(4, true);
        }
        // NOTE: subclasses MapActivity (and implement IsRouteDisplayed)
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.AutoCompleteTextView);

            AutoCompleteTextView act = FindViewById<AutoCompleteTextView>(Resource.Id.AutoCompleteInput);

            Stream seedDataStream = Assets.Open(@"WordList.txt");
            //StreamReader reader = new StreamReader(seedDataStream);

            List<string> lines = new List<string>();
            using (StreamReader reader = new StreamReader(seedDataStream)) {
                // 3
                // Use while != null pattern for loop
                string line;
                while ((line = reader.ReadLine()) != null) {
                    // 4
                    // Insert logic here.
                    // ...
                    // "line" is a line in the file. Add it to our List.
                    lines.Add(line);
                }
            }

            string[] wordlist = lines.ToArray();

            ArrayAdapter arr = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, wordlist);
            act.Adapter = arr;
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			// If this is a submenu list, this will have the prefix to get here
			var prefix = Intent.GetStringExtra ("com.example.android.apis.Path");

			// This must be the top-level menu list
			prefix = prefix ?? string.Empty;

			// Get the activities for this prefix
			var activities = GetDemoActivities (prefix);

			// Get the menu items we need to show
			var items = GetMenuItems (activities, prefix);

			// Add the menu items to the list
			ListAdapter = new ArrayAdapter<ActivityListItem> (this, AndroidR.Layout.SimpleListItem1, AndroidR.Id.Text1, items);

			// Launch the new activity when the list is clicked
			ListView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args) {
				var item = (ActivityListItem)(sender as ListView).GetItemAtPosition (args.Position);
				LaunchActivityItem (item);
			};
			
		}
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog UI to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx = Activity.ApplicationContext;

            // Set a dialog title
            Dialog.SetTitle("Statistics Definitions");

            // Call OnCreateView on the base
            base.OnCreateView(inflater, container, savedInstanceState);

            // The container for the dialog is a vertical linear layout
            dialogView = new LinearLayout(ctx)
            {
                Orientation = Orientation.Vertical
            };

            // Spinner for choosing a field to get statistics for
            _fieldSpinner = new Spinner(ctx);

            // Create an array adapter to display the fields
            ArrayAdapter fieldsAdapter = new ArrayAdapter(ctx, Android.Resource.Layout.SimpleSpinnerItem);

            foreach (string field in _fieldNames)
            {
                fieldsAdapter.Add(field);
            }

            // Set the drop down style for the array adapter, then assign it to the field spinner control
            fieldsAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _fieldSpinner.Adapter = fieldsAdapter;

            // Create a horizontal layout to display the field spinner (with a label)
            LinearLayout fieldView = new LinearLayout(ctx)
            {
                Orientation = Orientation.Horizontal
            };

            // Create a label for the spinner
            TextView fieldLabel = new TextView(ctx)
            {
                Text     = "Field:",
                LabelFor = _fieldSpinner.Id
            };

            // Add field controls to the horizontal layout
            fieldView.AddView(fieldLabel);
            fieldView.AddView(_fieldSpinner);
            fieldView.SetPadding(140, 0, 0, 0);
            dialogView.AddView(fieldView);

            // Spinner for selecting the statistic type
            _statSpinner = new Spinner(ctx);

            // Create an array adapter to display the statistic types
            ArrayAdapter statTypeAdapter = new ArrayAdapter(ctx, Android.Resource.Layout.SimpleSpinnerItem);

            // Read the statistic types from the StatisticType enum
            Array statTypes = Enum.GetValues(typeof(StatisticType));

            foreach (object stat in statTypes)
            {
                // Add each statistic type to the adapter
                statTypeAdapter.Add(stat.ToString());
            }

            // Set the drop down style for the array adapter, then assign it to the statistic type spinner control
            statTypeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _statSpinner.Adapter = statTypeAdapter;

            // Create a horizontal layout to display the statistic type spinner (with a label)
            LinearLayout statTypeView = new LinearLayout(ctx)
            {
                Orientation = Orientation.Horizontal
            };

            // Create the label for the statistic type list
            TextView typeLabel = new TextView(ctx)
            {
                Text     = "Type:",
                LabelFor = _statSpinner.Id
            };

            // Add statistic type controls to the horizontal layout
            statTypeView.AddView(typeLabel);
            statTypeView.AddView(_statSpinner);
            statTypeView.SetPadding(140, 0, 0, 0);

            // Add the statistic type layout to the dialog
            dialogView.AddView(statTypeView);

            // Create a button to add a new statistic definition (selected field and statistic type)
            Button addStatDefButton = new Button(ctx)
            {
                Text = "Add"
            };

            addStatDefButton.Click += AddStatisticDefinition;

            // Create a button to remove the selected statistic definition
            Button removeStatDefButton = new Button(ctx)
            {
                Text = "Remove"
            };

            removeStatDefButton.Click += RemoveStatisticDefinition;

            // Create a horizontal layout to contain the add and remove buttons
            LinearLayout buttonView = new LinearLayout(ctx)
            {
                Orientation = Orientation.Horizontal
            };

            buttonView.AddView(addStatDefButton);
            buttonView.AddView(removeStatDefButton);

            // Add the button layout to the dialog
            dialogView.AddView(buttonView);

            // Create a list view and an instance of a custom list adapter to show the statistic definitions
            StatDefinitionListAdapter listAdapter = new StatDefinitionListAdapter(Activity, _statisticDefinitions);

            _statDefListView = new ListView(ctx)
            {
                Adapter = listAdapter,

                // Only allow one choice in the statistic definitions list ('remove' button will work on the selected row)
                ChoiceMode = ChoiceMode.Single
            };

            // Add the statistic definitions list to the dialog
            dialogView.AddView(_statDefListView);

            // Return the new view for display
            return(dialogView);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_container_condition);


            condition = FindViewById <RelativeLayout>(Resource.Id.condition);
            s_open_close_container    = FindViewById <EditText>(Resource.Id.s_open_close_container);
            s_lock_unlock_door        = FindViewById <EditText>(Resource.Id.s_lock_unlock_door);
            btn_open_close_container  = FindViewById <Button>(Resource.Id.btn_open_close_container);
            btn_lock_unlock_door      = FindViewById <Button>(Resource.Id.btn_lock_unlock_door);
            btn_save_status_container = FindViewById <Button>(Resource.Id.btn_save_parameters);
            box_lay_fold          = FindViewById <ImageView>(Resource.Id.box_lay_fold);
            s_situation_container = FindViewById <Spinner>(Resource.Id.s_situation);


            s_open_close_container.Focusable     = false;
            s_open_close_container.LongClickable = false;
            s_lock_unlock_door.Focusable         = false;
            s_lock_unlock_door.LongClickable     = false;

            GetInfoAboutBox();
            s_situation_container.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.a_situation_loaded_container, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            s_situation_container.Adapter = adapter;



            btn_save_status_container.Click += async delegate
            {
                try
                {
                    StaticBox.Sensors["Состояние контейнера"]      = (s_open_close_container.Text == "сложен")?"0":"1";
                    StaticBox.Sensors["Состояние дверей"]          = (s_lock_unlock_door.Text == "закрыта")?"0":"1";
                    StaticBox.Sensors["Местоположение контейнера"] = a_situation;

                    var o_data = await ContainerService.EditBox();

                    if (o_data.Status == "1")
                    {
                        Toast.MakeText(this, o_data.Message, ToastLength.Long).Show();
                        GetInfoAboutBox();
                    }
                    else
                    {
                        GetInfoAboutBox();
                        StaticBox.CameraOpenOrNo = 1;
                        Intent authActivity = new Intent(this, typeof(Auth.SensorsDataActivity));
                        StartActivity(authActivity);
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show();
                }
            };

            //изменение состояния контейнера
            btn_open_close_container.Click += async delegate
            {
                try
                {
                    if (s_open_close_container.Text == "сложен")
                    {
                        s_open_close_container.Text = "разложен";
                        s_lock_unlock_door.Text     = "открыта";
                        box_lay_fold.SetImageResource(Resource.Drawable.open_door);
                    }

                    else
                    {
                        s_open_close_container.Text = "сложен";
                        s_lock_unlock_door.Text     = "открыта";
                        box_lay_fold.SetImageResource(Resource.Drawable.close_box);
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show();
                }
            };

            //изменение состояния дверей
            btn_lock_unlock_door.Click += async delegate
            {
                try
                {
                    if (s_lock_unlock_door.Text == "закрыта")
                    {
                        s_lock_unlock_door.Text = "открыта";
                        box_lay_fold.SetImageResource(Resource.Drawable.open_door);
                    }
                    else if (s_lock_unlock_door.Text == "открыта" && s_open_close_container.Text == "разложен")
                    {
                        s_lock_unlock_door.Text = "закрыта";
                        box_lay_fold.SetImageResource(Resource.Drawable.close_door);
                    }
                    else if (s_open_close_container.Text == "сложен" && s_lock_unlock_door.Text == "открыта")
                    {
                        Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                        alert.SetTitle("Внимание !");
                        alert.SetMessage("Невозможно изменить состояние дверей.");
                        alert.SetPositiveButton("Закрыть", (senderAlert, args) => {
                            Toast.MakeText(this, "Предупреждение было закрыто!", ToastLength.Short).Show();
                        });
                        Dialog dialog = alert.Create();
                        dialog.Show();
                    }
                    else if (s_open_close_container.Text == null && s_lock_unlock_door.Text == null)
                    {
                        Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                        alert.SetTitle("Внимание !");
                        alert.SetMessage("Невозможно изменить состояние дверей и контейнера.");
                        alert.SetPositiveButton("Закрыть", (senderAlert, args) => {
                            Toast.MakeText(this, "Предупреждение было закрыто!", ToastLength.Short).Show();
                        });
                        Dialog dialog = alert.Create();
                        dialog.Show();
                    }
                    else
                    {
                        Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                        alert.SetTitle("Внимание !");
                        alert.SetMessage("Невозможно изменить состояние дверей.");
                        alert.SetPositiveButton("Закрыть", (senderAlert, args) => {
                            Toast.MakeText(this, "Предупреждение было закрыто!", ToastLength.Short).Show();
                        });
                        Dialog dialog = alert.Create();
                        dialog.Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show();
                }
            };
        }
Ejemplo n.º 33
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.bt_selection);


            Title = "Choose bluetooth device...";

            _btReceiver.DeviceReceived += OnDeviceReceived;

            _progressDialog = new ProgressDialog(ApplicationContext);


            var filter = new IntentFilter(BluetoothDevice.ActionFound);

            RegisterReceiver(_btReceiver, filter);

            var filter2 = new IntentFilter(BluetoothAdapter.ActionDiscoveryStarted);

            RegisterReceiver(_btReceiverStart, filter2);

            _arrayAdapter = new ArrayAdapter <string>(this,
                                                      Resource.Layout.bt_selection_item);
            _arrayDevice = new List <BluetoothDevice>();

            ListView lv = (ListView)FindViewById(Resource.Id.bt_selection_list);

            lv.Adapter = _arrayAdapter;

            lv.ItemClick += Lv_ItemClick;

            lv.TextFilterEnabled = true;


            if (_bluetoothAdapter == null)
            {
                Toast.MakeText(ApplicationContext, "No bluetooth adapter...",
                               ToastLength.Long).Show();
            }
            else
            {
                if (!_bluetoothAdapter.IsEnabled)
                {
                    var enableBtIntent = new Intent(
                        BluetoothAdapter.ActionRequestEnable);
                    StartActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
                }
                RegisterReceiver(_btReceiver, filter);

                var pairedDevices = _bluetoothAdapter.BondedDevices;

                if (pairedDevices.Count > 0)
                {
                    foreach (var device in pairedDevices)
                    {
                        _arrayAdapter.Add(device.Name + "\n"
                                          + device.Address);
                        _arrayDevice.Add(device);
                    }
                }
                _bluetoothAdapter.StartDiscovery();
            }
        }
        public void actions()
        {
            bool         IsValidJson;
            ConsumeRest  cRest = new ConsumeRest();
            object       strResponse;
            Address      address = new Address();
            string       endpoint;
            ValidateJson validateJson = new ValidateJson();

            ///////////// telephones
            try
            {
                List <string> Teleph = new List <string>();
                List <string> emails = new List <string>();
                endpoint    = address.Endpoint + "CommunicationList/" + myID; //1001;
                strResponse = cRest.makeRequest(endpoint);
                IsValidJson = validateJson.IsValidJson(strResponse);
                List <Communication> communication = JsonConvert.DeserializeObject <List <Communication> >(strResponse.ToString());
                if (communication.Any())
                {
                    for (int i = 0; i < communication.Count; i++)
                    {
                        Teleph.Add(communication[i].Telephone.ToString());
                        emails.Add(communication[i].email);
                    }
                }
                adapt         = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Teleph);
                adapt1        = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, emails);
                spin.Adapter  = adapt;
                spin1.Adapter = adapt1;
            }
            catch (Exception e)
            {
            }

            txt1.Text = "Patient";
            demographics demogr;

            endpoint    = address.Endpoint + "Demographics/" + receiverID;
            strResponse = cRest.makeRequest(endpoint);

            IsValidJson = validateJson.IsValidJson(strResponse);

            if (IsValidJson)
            {
                demogr     = JsonConvert.DeserializeObject <demographics>(strResponse.ToString());
                txt13.Text = demogr.FirstName;
                txt14.Text = demogr.LastName;
                txt15.Text = demogr.Country;
                txt16.Text = demogr.City;
                txt24.Text = demogr.StreetName;
                txt17.Text = demogr.StreetNumber.ToString();
                txt18.Text = demogr.Sex;
                txt19.Text = demogr.Birthday.ToString();
            }
            else
            {
                new AlertDialog.Builder(this)
                .SetTitle("An error has occured")
                .SetMessage("No data found due to unexpected problem" + "n/" + strResponse)
                .Show();
            }
        }
Ejemplo n.º 35
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_displaying_values);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.displaying_values);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widgets
            mLinearGauge     = (C1LinearGauge)FindViewById(Resource.Id.linearGauge1);
            mRadialGauge     = (C1RadialGauge)FindViewById(Resource.Id.radialGauge1);
            mShowTextSpinner = (Spinner)FindViewById(Resource.Id.showTextSpinner);
            mValueText       = (TextView)FindViewById(Resource.Id.valueText);

            // creating and initializing adapter to string array
            ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.showTextSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mShowTextSpinner.Adapter       = adapter1;
            mShowTextSpinner.ItemSelected += mShowTextSpinner_ItemSelected;

            // setting dafault values
            mValueText.Text = ((int)(mValue * 100)).ToString();

            mLinearGauge.ShowText = GaugeShowText.All;
            mRadialGauge.ShowText = GaugeShowText.All;

            setRange(0, 40, -65536);
            setRange(40, 80, -256);
            setRange(80, 100, -16711936);

            mLinearGauge.Min  = 0;
            mLinearGauge.Max  = 1;
            mLinearGauge.Step = .01f;
            // mLinearGauge.Ranges = mRanges;
            mLinearGauge.ShowRanges = false;
            mLinearGauge.ShowText   = GaugeShowText.All;
            //mLinearGauge.GaugeWidth = .5f;
            mLinearGauge.Animate();
            mLinearGauge.Format = "0%";
            mLinearGauge.Value  = mValue;

            mRadialGauge.Min  = 0;
            mRadialGauge.Max  = 1;
            mRadialGauge.Step = .01f;
            //mRadialGauge.Ranges = mRanges;
            mRadialGauge.ShowRanges = false;
            mRadialGauge.ShowText   = GaugeShowText.All;
            //mRadialGauge.GaugeWidth = .5f;
            mRadialGauge.Animate();
            mRadialGauge.Format = "0%";
            mRadialGauge.Value  = mValue;

            Button minusButton = (Button)FindViewById(Resource.Id.buttonMinus);

            minusButton.Click += button_Click;
            Button plusButton = (Button)FindViewById(Resource.Id.buttonPlus);

            plusButton.Click += button_Click;

            mLinearGauge.ValueChanged += OnValueChanged;
            mRadialGauge.ValueChanged += OnValueChanged;
        }
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.DrawMonthCell -= Calendar_DrawMonthCell;
                calendar.Dispose();
                calendar = null;
            }

            if (viewModetxt != null)
            {
                viewModetxt.Dispose();
                viewModetxt = null;
            }

            if (modeSpinner != null)
            {
                modeSpinner.Dispose();
                modeSpinner = null;
            }

            if (spaceAdder1 != null)
            {
                spaceAdder1.Dispose();
                spaceAdder1 = null;
            }

            if (spaceAdder2 != null)
            {
                spaceAdder2.Dispose();
                spaceAdder2 = null;
            }

            if (minDate != null)
            {
                minDate.Dispose();
                minDate = null;
            }

            if (maxDate != null)
            {
                maxDate.Dispose();
                maxDate = null;
            }

            if (minPick != null)
            {
                minPick.Dispose();
                minPick = null;
            }

            if (maxPick != null)
            {
                maxPick.Dispose();
                maxPick = null;
            }

            if (minDateButton != null)
            {
                minDateButton.Dispose();
                minDateButton = null;
            }

            if (maxDateButton != null)
            {
                maxDateButton.Dispose();
                maxDateButton = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (minDatePicker != null)
            {
                minDatePicker.Dispose();
                minDatePicker = null;
            }

            if (maxDatePicker != null)
            {
                maxDatePicker.Dispose();
                maxDatePicker = null;
            }

            if (underMaxSeparatorLayoutParam != null)
            {
                underMaxSeparatorLayoutParam.Dispose();
                underMaxSeparatorLayoutParam = null;
            }

            if (minMaxSeparatorLayoutParam != null)
            {
                minMaxSeparatorLayoutParam.Dispose();
                minMaxSeparatorLayoutParam = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (underMaxSeparator != null)
            {
                underMaxSeparator.Dispose();
                underMaxSeparator = null;
            }

            if (minMaxSeparator != null)
            {
                minMaxSeparator.Dispose();
                minMaxSeparator = null;
            }
        }
        private void CreateLayout()
        {
            #region UI for selecting parameter type and applying the renderer
            // Create a vertical layout for the page.
            LinearLayout mainLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Add some padding to the layout.
            mainLayout.SetPadding(20, 0, 0, 5);

            // Create a horizontal layout for the parameter type list and button to apply the renderer.
            LinearLayout parameterTypeLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };
            string[] stretchTypes = { "Min Max", "Percent Clip", "Standard Deviation" };
            ArrayAdapter <string> stretchTypesAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, stretchTypes);

            // Create the spinner control for choosing the stretch parameter input type and handle its ItemSelected event.
            _parameterInputTypeSpinner = new Spinner(this)
            {
                Adapter       = stretchTypesAdapter,
                DropDownWidth = 340
            };
            _parameterInputTypeSpinner.ItemSelected += ParameterInputTypeSpinner_ItemSelected;

            // Create the button that applies the renderer and handle its Click event.
            _applyRendererButton = new Button(this)
            {
                Text    = "Apply",
                Enabled = false
            };
            _applyRendererButton.Click += ApplyRendererButton_Click;

            // Add a label, parameter type spinner control, and the apply button.
            TextView parameterTypeTextView = new TextView(this)
            {
                Text = "Stretch type: "
            };
            parameterTypeLayout.AddView(parameterTypeTextView);
            parameterTypeLayout.AddView(_parameterInputTypeSpinner);
            parameterTypeLayout.AddView(_applyRendererButton);

            // Add the parameter UI choice controls to the main layout.
            mainLayout.AddView(parameterTypeLayout);
            #endregion

            #region UI for defining min/max RGB values
            // Create a horizontal layout for the min/max RGB inputs.
            _minMaxLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Create a range of values from 0-255 and an adapter to display them.
            int[] minMaxValues = Enumerable.Range(0, 256).ToArray();
            ArrayAdapter <int> minMaxValuesAdapter = new ArrayAdapter <int>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, minMaxValues);

            // Get the width of the current device (in pixels).
            int widthPixels = Resources.DisplayMetrics.WidthPixels;

            // Use 1/5 of the device width for the drop down.
            int dropDownWidth = widthPixels / 5;

            // Create controls for specifying the minimum and maximum red values (0-255).
            _minRedSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _minRedSpinner.SetSelection(0);
            _maxRedSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _maxRedSpinner.SetSelection(255);

            // Set the background color to indicate which values the inputs are for.
            _minRedSpinner.SetBackgroundColor(Android.Graphics.Color.DarkRed);
            _maxRedSpinner.SetBackgroundColor(Android.Graphics.Color.DarkRed);

            // Create controls for specifying the minimum and maximum green values (0-255).
            _minGreenSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _minGreenSpinner.SetSelection(0);
            _maxGreenSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _maxGreenSpinner.SetSelection(255);

            // Set the background color to indicate which values the inputs are for.
            _minGreenSpinner.SetBackgroundColor(Android.Graphics.Color.DarkGreen);
            _maxGreenSpinner.SetBackgroundColor(Android.Graphics.Color.DarkGreen);

            // Create controls for specifying the minimum and maximum blue values (0-255).
            _minBlueSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _minBlueSpinner.SetSelection(0);
            _maxBlueSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = minMaxValuesAdapter,
                DropDownWidth = dropDownWidth
            };
            _maxBlueSpinner.SetSelection(255);

            // Set the background color to indicate which values the inputs are for.
            _minBlueSpinner.SetBackgroundColor(Android.Graphics.Color.DarkBlue);
            _maxBlueSpinner.SetBackgroundColor(Android.Graphics.Color.DarkBlue);

            // Create vertical layouts for the color inputs (so they align properly).
            LinearLayout redInputsLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };
            LinearLayout greenInputsLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };
            LinearLayout blueInputsLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Add the color inputs to their corresponding layout.
            redInputsLayout.AddView(_minRedSpinner);
            redInputsLayout.AddView(_maxRedSpinner);
            greenInputsLayout.AddView(_minGreenSpinner);
            greenInputsLayout.AddView(_maxGreenSpinner);
            blueInputsLayout.AddView(_minBlueSpinner);
            blueInputsLayout.AddView(_maxBlueSpinner);

            // Add the vertical color inputs to the horizontal parent layout.
            _minMaxLayout.SetPadding(50, 10, 0, 10);
            _minMaxLayout.AddView(redInputsLayout);
            _minMaxLayout.AddView(greenInputsLayout);
            _minMaxLayout.AddView(blueInputsLayout);

            // Add the UI layouts to the main layout
            mainLayout.AddView(_minMaxLayout);
            #endregion

            #region UI for defining percent clip values
            // Create a (hidden) vertical layout for the min/max percent clip sliders.
            _percentClipLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical,
                Visibility  = Android.Views.ViewStates.Gone
            };

            // Apply some padding for the layout.
            _percentClipLayout.SetPadding(20, 5, 0, 20);

            // Create the minimum and maximum percent sliders (SeekBar).
            _minPercentClipSlider = new SeekBar(this)
            {
                Max      = 100,
                Progress = 0
            };
            _maxPercentClipSlider = new SeekBar(this)
            {
                Max      = 100,
                Progress = 0
            };

            // Set the SeekBar dimensions and a left margin.
            ActionBar.LayoutParams layoutParamsSeekBar = new ActionBar.LayoutParams(400, 30)
            {
                LeftMargin = 5
            };
            _minPercentClipSlider.LayoutParameters = layoutParamsSeekBar;
            _maxPercentClipSlider.LayoutParameters = layoutParamsSeekBar;

            // Create labels for minimum and maximum percent.
            TextView minimumSliderLabel = new TextView(this)
            {
                Text = "Min: "
            };
            TextView maximumSliderLabel = new TextView(this)
            {
                Text = "Max: "
            };

            // Create horizontal layouts for the minimum and maximum controls.
            LinearLayout minPercentClipLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };
            LinearLayout maxPercentClipLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Add min and max percent controls to their corresponding layouts.
            minPercentClipLayout.AddView(minimumSliderLabel);
            minPercentClipLayout.AddView(_minPercentClipSlider);
            maxPercentClipLayout.AddView(maximumSliderLabel);
            maxPercentClipLayout.AddView(_maxPercentClipSlider);

            // Add the slider layouts to the percent clip layout.
            _percentClipLayout.AddView(minPercentClipLayout);
            _percentClipLayout.AddView(maxPercentClipLayout);

            // Add the percent clip UI to the main layout.
            mainLayout.AddView(_percentClipLayout);
            #endregion

            #region UI for defining standard deviation factor
            // Create a range of values from 0-5 (in 0.5 increments) and an adapter to display them.
            IEnumerable <int>     wholeStdDevs         = Enumerable.Range(1, 10);
            List <double>         halfStdDevs          = wholeStdDevs.Select(i => (double)i / 2).ToList();
            ArrayAdapter <double> stdDevFactorsAdapter = new ArrayAdapter <double>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, halfStdDevs);

            // Create a drop down (Spinner) control for specifying the standard deviation factor (0.0 - 5.0).
            _stdDeviationFactorSpinner = new Spinner(this, SpinnerMode.Dropdown)
            {
                Adapter       = stdDevFactorsAdapter,
                DropDownWidth = dropDownWidth
            };

            // Set the default selection to the 4th item (value of 2.0)
            _stdDeviationFactorSpinner.SetSelection(4);

            // Create a label (TextView) for the Spinner.
            TextView factorLabel = new TextView(this)
            {
                Text = "Factor: "
            };

            // Create a horizontal layout for the controls.
            LinearLayout stdDevFactorLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Add the controls for selecting a standard deviation factor.
            stdDevFactorLayout.AddView(factorLabel);
            stdDevFactorLayout.AddView(_stdDeviationFactorSpinner);

            // Create the standard deviation factor layout and add the controls.
            _stdDeviationLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical,
                Visibility  = Android.Views.ViewStates.Gone
            };
            _stdDeviationLayout.SetPadding(50, 5, 0, 5);
            _stdDeviationLayout.AddView(stdDevFactorLayout);

            // Add the standard deviation layout to the main layout.
            mainLayout.AddView(_stdDeviationLayout);
            #endregion

            // Create the map view control.
            _myMapView = new MapView(this);

            // Add the map view to the layout.
            mainLayout.AddView(_myMapView);

            // Set the layout as the sample view.
            SetContentView(mainLayout);
        }
Ejemplo n.º 38
0
        public override View GetPropertyWindowLayout(Android.Content.Context context)
        {
            /**
             * Property Window
             * */
            int          width          = (context.Resources.DisplayMetrics.WidthPixels) / 2;
            LinearLayout propertylayout = new LinearLayout(context); //= new LinearLayout(context);

            propertylayout.Orientation = Android.Widget.Orientation.Vertical;

            LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
                width * 2, 5);

            layoutParams1.SetMargins(0, 20, 0, 0);

            TextView drawType = new TextView(context);

            drawType.TextSize = 20;
            drawType.Text     = "Draw Type";
            drawType.SetPadding(5, 20, 0, 20);

            TextView polarAngle = new TextView(context);

            polarAngle.TextSize = 20;
            polarAngle.Text     = "Angle";
            polarAngle.SetPadding(5, 20, 0, 20);

            Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog);

            polarAngleMode = new List <String>()
            {
                "Rotate 0", "Rotate 90", "Rotate 180", "Rotate 270"
            };

            ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>
                                                    (context, Android.Resource.Layout.SimpleSpinnerItem, polarAngleMode);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            selectLabelMode.Adapter = dataAdapter;

            selectLabelMode.ItemSelected += SelectLabelMode_ItemSelected;

            Spinner selectDrawType = new Spinner(context, SpinnerMode.Dialog);

            List <String> adapter = new List <String>()
            {
                "Area", "Line"
            };
            ArrayAdapter <String> dataAdapter1 = new ArrayAdapter <String>
                                                     (context, Android.Resource.Layout.SimpleSpinnerItem, adapter);

            dataAdapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            selectDrawType.Adapter = dataAdapter1;

            selectDrawType.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                String selectedItem = dataAdapter1.GetItem(e.Position);

                if (selectedItem.Equals("Area"))
                {
                    radarSeries1.DrawType = PolarChartDrawType.Area;
                    radarSeries2.DrawType = PolarChartDrawType.Area;
                    radarSeries3.DrawType = PolarChartDrawType.Area;
                }
                else if (selectedItem.Equals("Line"))
                {
                    radarSeries1.DrawType = PolarChartDrawType.Line;
                    radarSeries2.DrawType = PolarChartDrawType.Line;
                    radarSeries3.DrawType = PolarChartDrawType.Line;
                }
            };

            SeparatorView separate = new SeparatorView(context, width * 2);

            separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);

            propertylayout.AddView(drawType);
            propertylayout.AddView(selectDrawType);
            propertylayout.AddView(polarAngle);
            propertylayout.AddView(selectLabelMode);
            propertylayout.AddView(separate, layoutParams1);


            return(propertylayout);
        }
Ejemplo n.º 39
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CallStack = new StackFrame(1, true);
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            mManager = (UsbManager)this.Application.GetSystemService(Context.UsbService);
            // Initialize reader
            mReader = new Com.Acs.Smartcard.Reader(mManager);


            // Initialize reader spinner
            mReaderAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem);

            foreach (UsbDevice device in mManager.DeviceList.Values)
            {
                if (mReader.IsSupported(device))
                {
                    mReaderAdapter.Add(device.DeviceName);
                }
            }
            stateChangeListner change = new stateChangeListner(mReader, mReadKeyOption, this);

            // Com.Acs.Smartcard.Reader.IOnStateChangeListener onStateChangeListener =new ;

            mReader.SetOnStateChangeListener(change);


            mReaderSpinner         = FindViewById <Spinner>(Resource.Id.main_spinner_reader);
            mReaderSpinner.Adapter = mReaderAdapter;

            mPermissionIntent = PendingIntent.GetBroadcast(this, 0, new Intent(
                                                               ACTION_USB_PERMISSION), 0);
            //IntentFilter filter = new IntentFilter();
            //filter.AddAction(ACTION_USB_PERMISSION);
            //filter.AddAction(UsbManager.ActionUsbDeviceDetached);
            //filter.AddAction(UsbManager.ActionUsbDeviceAttached);
            txtview = FindViewById <TextView>(Resource.Id.txtview);
            //RegisterReceiver(receiver, intent);
            //TextView txt = FindViewById<TextView>(Resource.Id.txtview);
            //txt.Text = "";
            try
            {
                mReceiver    _receiver = new mReceiver();
                IntentFilter filter    = new IntentFilter();
                filter.AddAction(ACTION_USB_PERMISSION);
                filter.AddAction(UsbManager.ActionUsbDeviceDetached);
                filter.AddAction(UsbManager.ActionUsbDeviceAttached);

                RegisterReceiver(_receiver, filter);


                //RegisterReceiver(_receiver, new IntentFilter(ACTION_USB_PERMISSION));
                //RegisterReceiver(_receiver, new IntentFilter(UsbManager.ActionUsbDeviceDetached));
                //RegisterReceiver(_receiver, new IntentFilter(UsbManager.ActionUsbDeviceAttached));

                ////var intent = new Intent(this, typeof(mReceiver));
                //var intent = new Intent(this, receiver.Class);
                //intent.SetAction(ACTION_USB_PERMISSION);
                //intent.SetAction(UsbManager.ActionUsbDeviceDetached);
                //intent.SetAction(UsbManager.ActionUsbDeviceAttached);
                // Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).SendBroadcast(intent);
                //SendBroadcast(intent);
                // txt.Text = "done";
                // ****** OnStateChangeListener ******
                // this.onStateChange(0);
            }
            catch (SecurityException ex)
            {
                txtview.Text = ex.Message.ToString();
            }

            mSlotAdapter         = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem);
            mSlotSpinner         = FindViewById <Spinner>(Resource.Id.main_spinner_slot);
            mSlotSpinner.Adapter = mSlotAdapter;

            string deviceName = (string)mReaderSpinner.SelectedItem;

            if (deviceName != null)
            {
                foreach (UsbDevice device in mManager.DeviceList.Values)
                {
                    if (deviceName.Equals(device.DeviceName))
                    {
                        mManager.RequestPermission(device, mPermissionIntent);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 40
0
        public View GetPropertyWindowLayout(Context context)
        {
            width                      = (context.Resources.DisplayMetrics.WidthPixels) / 2;
            propertylayout             = new LinearLayout(context);
            propertylayout.Orientation = Orientation.Vertical;

            /***********
            **Culture**
            ***********/
            LinearLayout.LayoutParams cultureLayoutParams = new LinearLayout.LayoutParams(width * 2, 5);
            cultureLayoutParams.SetMargins(0, 20, 0, 0);

            //Culture Text
            TextView culturetxt = new TextView(context);

            culturetxt.TextSize = 20;
            culturetxt.Text     = "Culture";

            //CultureList
            List <String> cultureList = new List <String>();

            cultureList.Add("United States");
            cultureList.Add("United Kingdom");
            cultureList.Add("Japan");
            cultureList.Add("France");
            cultureList.Add("Italy");
            cultureDataAdapter = new ArrayAdapter <String>
                                     (context, Android.Resource.Layout.SimpleSpinnerItem, cultureList);
            cultureDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            //CultureSpinner
            cultureSpinner         = new Spinner(context, SpinnerMode.Dialog);
            cultureSpinner.Adapter = cultureDataAdapter;

            //CultureSpinner ItemSelected Listener
            cultureSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = cultureDataAdapter.GetItem(e.Position);
                if (selectedItem.Equals("United States"))
                {
                    localinfo = Java.Util.Locale.Us;
                }
                if (selectedItem.Equals("United Kingdom"))
                {
                    localinfo = Java.Util.Locale.Uk;
                }
                if (selectedItem.Equals("Japan"))
                {
                    localinfo = Java.Util.Locale.Japan;
                }
                if (selectedItem.Equals("France"))
                {
                    localinfo = Java.Util.Locale.France;
                }
                if (selectedItem.Equals("Italy"))
                {
                    localinfo = Java.Util.Locale.Italy;
                }
            };
            propertylayout.AddView(culturetxt);
            propertylayout.AddView(cultureSpinner);

            //CultureSeparate
            SeparatorView cultureSeparate = new SeparatorView(context, width * 2);

            cultureSeparate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            // propertylayout.AddView(cultureSeparate, cultureLayoutParams);

            /*************
            **AllowNull**
            *************/
            TextView allowNullText = new TextView(context);

            allowNullText.Text     = "Allow Null";
            allowNullText.Gravity  = GravityFlags.Center;
            allowNullText.TextSize = 20;

            //AllowNullCheckBox
            Switch allowNullCheckBox = new Switch(context);

            allowNullCheckBox.Checked        = true;
            allowNullCheckBox.CheckedChange += (object send, CompoundButton.CheckedChangeEventArgs eve) => {
                if (!eve.IsChecked)
                {
                    allownull = false;
                }
                else
                {
                    allownull = true;
                }
            };
            LinearLayout.LayoutParams allowNullCheckBoxLayoutParams = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            allowNullCheckBoxLayoutParams.SetMargins(0, 10, 0, 0);
            LinearLayout.LayoutParams allowNullTextLayoutParams = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent, 70);
            allowNullTextLayoutParams.SetMargins(0, 10, 0, 0);

            TextView textSpacing = new TextView(context);

            propertylayout.AddView(textSpacing);

            //AllowNullLayout
            allowNullLayout = new LinearLayout(context);
            allowNullLayout.AddView(allowNullText);
            allowNullLayout.AddView(allowNullCheckBox, allowNullCheckBoxLayoutParams);
            allowNullLayout.Orientation = Orientation.Horizontal;
            propertylayout.AddView(allowNullLayout);

            TextView textSpacing1 = new TextView(context);

            propertylayout.AddView(textSpacing1);
            //AllowNullSeparate
            SeparatorView allowNullSeparate = new SeparatorView(context, width * 2);

            allowNullSeparate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams allowNullLayoutParams = new LinearLayout.LayoutParams(width * 2, 5);
            allowNullLayoutParams.SetMargins(0, 20, 15, 0);
            //    propertylayout.AddView(allowNullSeparate, allowNullLayoutParams);
            propertylayout.SetPadding(5, 0, 5, 0);

            return(propertylayout);
        }
Ejemplo n.º 41
0
        public override View GetSampleContent(Context con)
        {
            int          numerHeight = getDimensionPixelSize(con, Resource.Dimension.numeric_txt_ht);
            int          width       = con.Resources.DisplayMetrics.WidthPixels - 40;
            LinearLayout linear      = new LinearLayout(con);

            linear.SetBackgroundColor(Android.Graphics.Color.White);
            linear.Orientation = Orientation.Vertical;
            linear.SetPadding(10, 10, 10, 10);

            TextView space = new TextView(con);

            space.TextSize = 10;
            linear.AddView(space);

            TextView text2 = new TextView(con);

            text2.TextSize      = 17;
            text2.TextAlignment = TextAlignment.Center;
            text2.Text          = "This sample demonstrates how to create secure PDF document.";
            text2.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            text2.SetPadding(5, 5, 5, 5);

            linear.AddView(text2);

            TextView space1 = new TextView(con);

            space1.TextSize = 10;
            linear.AddView(space1);

            advancedLinear1 = new LinearLayout(con);
            TextView space3 = new TextView(con);

            space3.TextSize      = 17;
            space3.TextAlignment = TextAlignment.Center;
            space3.Text          = "Algorithms";
            space3.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            space3.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear1.AddView(space3);
            m_context = con;

            string[] list1 = new string[] { "RC4", "AES" };
            ArrayAdapter <String> array1 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, list1);

            m_algorithms         = new Spinner(con);
            m_algorithms.Adapter = array1;
            m_algorithms.SetSelection(1);
            advancedLinear1.AddView(m_algorithms);
            linear.AddView(advancedLinear1);

            TextView space4 = new TextView(con);

            space4.TextSize = 10;
            linear.AddView(space4);

            LinearLayout subLinear = new LinearLayout(con);
            TextView     space2    = new TextView(con);

            space2.TextSize      = 17;
            space2.TextAlignment = TextAlignment.Center;
            space2.Text          = "Key Size";
            space2.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            space2.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            subLinear.AddView(space2);

            string[] list = { "40 Bit", "128 Bit" };
            ArrayAdapter <String> array = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, list);

            m_rc4Key         = new Spinner(con);
            m_rc4Key.Adapter = array;
            m_rc4Key.SetSelection(1);
            subLinear.AddView(m_rc4Key);
            //linear.AddView(subLinear);

            LinearLayout subLinear2 = new LinearLayout(con);
            TextView     sbspace    = new TextView(con);

            sbspace.TextSize      = 17;
            sbspace.TextAlignment = TextAlignment.Center;
            sbspace.Text          = "Key Size";
            sbspace.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            sbspace.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            subLinear2.AddView(sbspace);

            string[] list2 = { "128 Bit", "256 Bit", "256 Revision 6" };
            ArrayAdapter <String> array2 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, list2);

            m_aesKey         = new Spinner(con);
            m_aesKey.Adapter = array2;
            m_aesKey.SetSelection(1);
            subLinear2.AddView(m_aesKey);

            LinearLayout subLinear5 = new LinearLayout(con);
            TextView     sbspace2   = new TextView(con);

            sbspace2.TextSize      = 17;
            sbspace2.TextAlignment = TextAlignment.Center;
            sbspace2.Text          = "Encryption Options";
            sbspace2.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            sbspace2.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            subLinear5.AddView(sbspace2);

            string[] encryptionList      = new string[] { "Encrypt all contents", "Encrypt all contents except metadata", "Encrypt only attachments" };
            ArrayAdapter <String> array3 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, encryptionList);

            m_encryptionKey         = new Spinner(con);
            m_encryptionKey.Adapter = array3;
            m_encryptionKey.SetSelection(0);
            subLinear5.AddView(m_encryptionKey);
            //linear.AddView(subLinear5);

            LinearLayout subLinear3 = new LinearLayout(con);
            TextView     space5     = new TextView(con);

            space5.TextSize = 10;
            subLinear3.AddView(space5);

            TextView text4 = new TextView(con);

            text4.TextSize      = 17;
            text4.TextAlignment = TextAlignment.Center;
            text4.Text          = "User Password : password";
            text4.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            text4.SetPadding(5, 5, 5, 5);
            subLinear3.AddView(text4);
            linear.AddView(subLinear3);

            LinearLayout subLinear4 = new LinearLayout(con);
            TextView     text5      = new TextView(con);

            text5.TextSize      = 17;
            text5.TextAlignment = TextAlignment.Center;
            text5.Text          = "Owner Password : syncfusion";
            text5.SetTextColor(Android.Graphics.Color.ParseColor("#262626"));
            text5.SetPadding(5, 5, 5, 5);
            subLinear4.AddView(text5);
            linear.AddView(subLinear4);

            Button button1 = new Button(con);

            button1.Text   = "Generate PDF";
            button1.Click += OnButtonClicked;
            linear.AddView(button1);

            m_algorithms.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                String selectedItem = array1.GetItem(e.Position);
                if (selectedItem.Equals("AES"))
                {
                    linear.RemoveView(button1);
                    linear.RemoveView(subLinear3);
                    linear.RemoveView(subLinear4);
                    linear.RemoveView(subLinear);
                    linear.AddView(subLinear2);
                    linear.AddView(subLinear5);
                    linear.AddView(subLinear3);
                    linear.AddView(subLinear4);
                    linear.AddView(button1);
                }
                else
                {
                    linear.RemoveView(button1);
                    linear.RemoveView(subLinear3);
                    linear.RemoveView(subLinear4);
                    linear.RemoveView(subLinear2);
                    linear.RemoveView(subLinear5);
                    m_encryptionKey.SetSelection(0);
                    linear.AddView(subLinear);
                    linear.AddView(subLinear3);
                    linear.AddView(subLinear4);
                    linear.AddView(button1);
                }
            };
            m_encryptionKey.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                String selectedItem = array3.GetItem(e.Position);
                if (selectedItem.Equals("Encrypt only attachments"))
                {
                    linear.RemoveView(button1);
                    linear.RemoveView(subLinear4);
                    linear.RemoveView(subLinear3);
                    linear.RemoveView(subLinear5);
                    linear.RemoveView(subLinear2);
                    linear.AddView(subLinear2);
                    linear.AddView(subLinear5);
                    linear.AddView(subLinear3);
                    linear.AddView(button1);
                }
                else
                {
                    linear.RemoveView(button1);
                    linear.RemoveView(subLinear4);
                    linear.RemoveView(subLinear3);
                    linear.RemoveView(subLinear5);
                    linear.RemoveView(subLinear2);
                    linear.AddView(subLinear2);
                    linear.AddView(subLinear5);
                    linear.AddView(subLinear3);
                    linear.AddView(subLinear4);
                    linear.AddView(button1);
                }
            };
            return(linear);
        }
        void ShowCardSets()
        {
            ArrayAdapter adapter = new ArrayAdapter <string>(view.Context, Resource.Layout.activity_listview, allSets);

            cardSetsView.Adapter = adapter;
        }
Ejemplo n.º 43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.HomePageLayout);

            fragmentProjects      = new Fragments.Fragment_projects();
            fragmentMembers       = new Fragments.Fragment_members();
            fragmentBacklog       = new Fragments.Fragment_backlog();
            fragmentInDevelopment = new Fragments.Fragment_in_development();
            fragmentInReview      = new Fragments.Fragment_in_review();
            fragmentInTesting     = new Fragments.Fragment_in_testing();
            fragmentDone          = new Fragments.Fragment_done();
            fragmentCurent        = fragmentProjects;

            var transaction = SupportFragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.fragmentContainer, fragmentDone, "Done");
            transaction.Hide(fragmentDone);
            transaction.Add(Resource.Id.fragmentContainer, fragmentInTesting, "In testing");
            transaction.Hide(fragmentInTesting);
            transaction.Add(Resource.Id.fragmentContainer, fragmentInReview, "In review");
            transaction.Hide(fragmentInReview);
            transaction.Add(Resource.Id.fragmentContainer, fragmentInDevelopment, "In dev");
            transaction.Hide(fragmentInDevelopment);
            transaction.Add(Resource.Id.fragmentContainer, fragmentBacklog, "Backlog");
            transaction.Hide(fragmentBacklog);
            transaction.Add(Resource.Id.fragmentContainer, fragmentMembers, "Members");
            transaction.Hide(fragmentMembers);
            transaction.Add(Resource.Id.fragmentContainer, fragmentProjects, "Projects");
            currentFragment = fragmentProjects;
            transaction.Commit();

            hToolbar      = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            hDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            hRightDrawer  = FindViewById <ListView>(Resource.Id.right_drawer);
            hLeftDrawer   = FindViewById <ListView>(Resource.Id.left_drawer);
            SetSupportActionBar(hToolbar);

            rightMenuDataSet = new List <string>();
            rightMenuDataSet.Add("Create Project and Team");
            rightMenuDataSet.Add("Add member");
            rightMenuDataSet.Add("Create task");
            rightMenuAdapter     = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, rightMenuDataSet);
            hRightDrawer.Adapter = rightMenuAdapter;

            leftMenuDataSet = new List <string>();
            leftMenuDataSet.Add("Projects and Teams");
            leftMenuDataSet.Add("Members");
            leftMenuDataSet.Add("Backlog");
            leftMenuDataSet.Add("In Development");
            leftMenuDataSet.Add("In Review");
            leftMenuDataSet.Add("In Testing");
            leftMenuDataSet.Add("Done");
            leftMenuDataSet.Add("Sign out");
            leftMenuAdapter     = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, leftMenuDataSet);
            hLeftDrawer.Adapter = leftMenuAdapter;

            hLeftDrawer.ItemClick  += HLeftDrawer_ItemClick;
            hRightDrawer.ItemClick += HRightDrawer_ItemClick;

            hDrawerToggle = new HomePageActionBarDrawerToggle(
                this,
                hDrawerLayout,
                Resource.String.app_name,
                Resource.String.app_name
                );
            hDrawerLayout.AddDrawerListener(hDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            hDrawerToggle.SyncState();
        }
Ejemplo n.º 44
0
        void Populate()
        {
            ArrayAdapter <string> adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mListItems);

            ListAdapter = adapter;
        }
Ejemplo n.º 45
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, items);
 }
Ejemplo n.º 46
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            var messageList = FindViewById <ListView>(Resource.Id.msgList);

            adapter             = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1);
            messageList.Adapter = adapter;
            var progressBar = FindViewById <ProgressBar>(Resource.Id.downloadProgressBar);

            progressBar.Max = 100;

            var datePicker = FindViewById <DatePicker>(Resource.Id.downloadDatePicker);
            var button     = FindViewById <Button>(Resource.Id.downloadButton);

            button.Click += async(object sender, EventArgs e) =>
            {
                var cm = GetSystemService(ConnectivityService) as ConnectivityManager;
                if (cm?.ActiveNetworkInfo.Type != ConnectivityType.Wifi)
                {
                    var builder = new AlertDialog.Builder(this);
                    builder.SetMessage("Connect without wifi?");
                    builder.SetNegativeButton("Cancel", (obj, x) => { });
                    builder.SetPositiveButton("Ok", async(obj, which) =>
                    {
                        await StartBatchDownload();
                    });
                    builder.Show();
                }
                else
                {
                    await StartBatchDownload();
                }
            };

            Task StartBatchDownload()
            {
                return(Task.Run(() =>
                {
                    var savePath = GetSavePath();

                    AddressBuilder.Date = datePicker.DateTime;
                    var addrs = AddressBuilder.Load(Assets.Open("PodAddress.xml"));
                    var urls = AddressBuilder.GetEffectiveAddresses(addrs);

                    List <string> failedList = new List <string>();
                    failedList.AddRange(BatchDownloader.DownloadFromUrls(savePath, urls, DownloadProgressHandler));

                    RunOnUiThread(() =>
                    {
                        failedList
                        .Select(msg => "failed url: " + msg)
                        .ToList()
                        .ForEach(msg =>
                        {
                            Log.Info(typeof(MainActivity).ToString(), msg);
                            adapter.Add(msg);
                        });
                        adapter.Add("Download complete");
                        adapter.NotifyDataSetChanged();
                        Toast.MakeText(this, "Download complete", ToastLength.Long).Show();
                    });
                }));
            }

            void DownloadProgressHandler(object sender, DownloadProgressChangedEventArgs e)
            {
                progressBar.SetProgress(e.ProgressPercentage, true);
            }
        }
        // Mbushet lista me te dhenat e shtuara
        //StringArrayAdapter ad;
        private void MbusheListen()
        {
            IListAdapter lista = new ArrayAdapter <String> (this, Android.Resource.Layout.SimpleListItem1, stockList);

            listWifi.Adapter = lista;
        }
Ejemplo n.º 48
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState, Resource.Layout.frmNewLicense);

            translateScreen();

            mustRefresh = false;

            licence = ReceivingDetailsActivity.licence;
            var tfWeight = FindViewById <EditText>(Resource.Id.tfWeight);



            // Récupération de la réception sélectionnée
            ReceptionWS reception = (ReceptionWS)ReceivingDetailsActivity.data;

            // Récupération de la liste de produit selon une reception grâce au web service Operations
            List <ProductDetailsWS> listProduct = OperationsWebService.getReceptionProductDetails(Configuration.securityToken, reception.ReceptionNRI, (int)Configuration.currentLanguage, Configuration.userInfos.NRI, Configuration.userInfos.Udp_Label).OfType <ProductDetailsWS>().ToList();

            // Creation liste de nom produit pour le spinner
            List <string> typeProd = new List <string>();

            foreach (ProductDetailsWS p in listProduct)
            {
                if (!(typeProd.Contains(p.code.ToString())))
                {
                    typeProd.Add(p.code.ToString());
                }
            }

            // Configuration du Spinner et de son Adapter par rapport à une liste de produit
            spinner = FindViewById <Spinner>(Resource.Id.spnProduct);
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, typeProd);

            spinner.Adapter = adapter;

            dateSelect        = FindViewById <TextView>(Resource.Id.tvDate);
            dateSelect.Click += (sender, e) =>
            {
                DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time)
                {
                    date            = new DateTime();
                    date            = time;
                    dateSelect.Text = time.ToLongDateString();
                    Console.Write(time.ToLongDateString());
                });
                Console.Write(dateSelect.Text);
                frag.Show(FragmentManager, DatePickerFragment.TAG);
            };

            spinner.ItemSelected += (parent, args) =>
            {
                // Sauvegarde de la réception choisie
                licence.productNRI  = listProduct[args.Position].NRI;
                licence.productSSCC = listProduct[args.Position].SSCC[0];
                if (listProduct[args.Position].isFixedWeight)
                {
                    tfWeight.Text = listProduct[args.Position].defaultProductWeight.ToString();
                }
            };

            FindViewById <Button>(Resource.Id.btnConfirm).Click += async(sender, e) => {
                bool   sucess = true;
                string msg    = "";
                switch (Configuration.currentLanguage)
                {
                case CR_TTLangue.French_Canada:
                {
                    msg = "Veuillez renseigner les champs :  ";

                    break;
                }

                case CR_TTLangue.English:
                {
                    msg = "Please fill in the fields:  ";
                    break;
                }
                }

                if (date != null)
                {
                    licence.expirationDate = date;
                    licence.packingDate    = date;
                    licence.saleDate       = date;
                    licence.productionDate = date;
                }
                else
                {
                    msg   += "date, ";
                    sucess = false;
                }

                if (licence.productNRI == 0)
                {
                    switch (Configuration.currentLanguage)
                    {
                    case CR_TTLangue.French_Canada:
                    {
                        msg += "produit, ";

                        break;
                    }

                    case CR_TTLangue.English:
                    {
                        msg += "product, ";
                        break;
                    }
                    }

                    sucess = false;
                }

                if (tfWeight.Text != "")
                {
                    licence.weightKG = decimal.Parse(tfWeight.Text);
                    licence.weightLb = decimal.Parse(tfWeight.Text);
                }
                else
                {
                    switch (Configuration.currentLanguage)
                    {
                    case CR_TTLangue.French_Canada:
                    {
                        msg += "poids, ";

                        break;
                    }

                    case CR_TTLangue.English:
                    {
                        msg += "weight, ";
                        break;
                    }
                    }
                    sucess = false;
                }


                if (sucess == true)
                {
                    IsBusy = true;
                    await Task.Delay(50);

                    var produit = OperationsWebService.pickLicenseReception(Configuration.securityToken, licence, (int)Configuration.currentLanguage, Configuration.userInfos.Udp_NRI, Configuration.userInfos.Udp_Label);
                    if (produit == null)
                    {
                        Toast.MakeText(this, OperationsWebService.errorMessage, ToastLength.Long).Show();
                    }
                    else
                    {
                        if (ReceivingDetailsActivity.licences == null)
                        {
                            ReceivingDetailsActivity.licences = new List <LicenseWS>();
                        }
                        ReceivingDetailsActivity.licences.Add(licence);
                    }

                    IsBusy      = false;
                    mustRefresh = true;
                    Finish();
                }
                else
                {
                    msg.Remove(msg.Length - 2, 2);
                    Toast.MakeText(this, msg, ToastLength.Long).Show();
                }
            };
        }
        private void SamplePageContents(Android.Content.Context con)
        {
            //Title list
            Title.Add("Software");
            Title.Add("Banking");
            Title.Add("Media");
            Title.Add("Medical");

            //jobSearchLabel
            jobSearchLabel          = new TextView(con);
            jobSearchLabel.Text     = "Job Search";
            jobSearchLabel.TextSize = 30;
            jobSearchLabel.Typeface = Typeface.DefaultBold;

            //jobSearchLabelSpacing
            jobSearchLabelSpacing = new TextView(con);
            jobSearchLabelSpacing.SetHeight(40);

            //countryLabel
            countryLabel          = new TextView(con);
            countryLabel.Text     = "Country";
            countryLabel.TextSize = 16;

            //countryLabelSpacing
            countryLabelSpacing = new TextView(con);
            countryLabelSpacing.SetHeight(10);

            //countryAutoCompleteSpacing
            countryAutoCompleteSpacing = new TextView(con);
            countryAutoCompleteSpacing.SetHeight(30);

            //jobFieldLabel
            jobFieldLabel          = new TextView(con);
            jobFieldLabel.Text     = "Job Field";
            jobFieldLabel.TextSize = 16;

            //jobFieldLabelSpacing
            jobFieldLabelSpacing = new TextView(con);
            jobFieldLabelSpacing.SetHeight(10);

            //jobFieldAutoCompleteSpacing
            jobFieldAutoCompleteSpacing = new TextView(con);
            jobFieldAutoCompleteSpacing.SetHeight(30);

            //experienceLabel
            experienceLabel          = new TextView(con);
            experienceLabel.Text     = "Experience";
            experienceLabel.TextSize = 16;

            //experienceLabelSpacing
            experienceLabelSpacing = new TextView(con);
            experienceLabelSpacing.SetHeight(10);

            //Experience list
            Experience.Add("1");
            Experience.Add("2");

            //searchButton
            searchButton = new Button(con);
            searchButton.SetWidth(ActionBar.LayoutParams.MatchParent);
            searchButton.SetHeight(40);
            searchButton.Text = "Search";
            searchButton.SetTextColor(Color.White);
            searchButton.SetBackgroundColor(Color.Gray);
            searchButton.Click += (object sender, EventArgs e) => {
                GetResult();
                resultsDialog.SetMessage(jobNumber + " Jobs Found");
                resultsDialog.Create().Show();
            };

            //searchButtonSpacing
            searchButtonSpacing = new TextView(con);
            searchButtonSpacing.SetHeight(30);

            //experience Spinner
            experienceSpinner = new Spinner(con, SpinnerMode.Dialog);
            experienceSpinner.DropDownWidth = 500;
            experienceSpinner.SetBackgroundColor(Color.Gray);
            ArrayAdapter <String> experienceDataAdapter = new ArrayAdapter <String>
                                                              (con, Android.Resource.Layout.SimpleSpinnerItem, Experience);

            experienceDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            experienceSpinner.Adapter = experienceDataAdapter;

            //experienceSpinnerSpacing
            experienceSpinnerSpacing = new TextView(con);
            experienceSpinnerSpacing.SetHeight(30);

            //results dialog
            resultsDialog = new AlertDialog.Builder(con);
            resultsDialog.SetTitle("Results");
            resultsDialog.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) =>
            {
            });
            resultsDialog.SetCancelable(true);
        }
Ejemplo n.º 50
0
        public override View GetPropertyWindowLayout(Android.Content.Context context)
        {
            /**
             * Property Window
             * */
            int          width          = (context.Resources.DisplayMetrics.WidthPixels) / 2;
            LinearLayout propertylayout = new LinearLayout(context); //= new LinearLayout(context);

            propertylayout.Orientation = Android.Widget.Orientation.Vertical;

            LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
                width * 2, 5);

            layoutParams1.SetMargins(0, 20, 0, 0);

            TextView labelDisplayMode = new TextView(context);

            labelDisplayMode.TextSize = 20;
            labelDisplayMode.Text     = "LabelDisplay Mode";

            Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog);

            List <String> adapter = new List <String>()
            {
                "FloatAllPoints", "NearestPoint", "GroupAllPoints"
            };
            ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>
                                                    (context, Android.Resource.Layout.SimpleSpinnerItem, adapter);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            selectLabelMode.Adapter = dataAdapter;

            selectLabelMode.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                String selectedItem = dataAdapter.GetItem(e.Position);
                ChartTrackballBehavior trackballBehavior = (chart.Behaviors[0] as ChartTrackballBehavior);
                if (selectedItem.Equals("NearestPoint"))
                {
                    trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.NearestPoint;
                }
                else if (selectedItem.Equals("FloatAllPoints"))
                {
                    trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.FloatAllPoints;
                }
                else if (selectedItem.Equals("GroupAllPoints"))
                {
                    trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.GroupAllPoints;
                }
            };

            propertylayout.AddView(labelDisplayMode);
            SeparatorView separate = new SeparatorView(context, width * 2);

            separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            propertylayout.AddView(separate, layoutParams1);
            propertylayout.AddView(selectLabelMode);



            return(propertylayout);
        }
        private void OnCardOpen(object sender, AdapterView.ItemClickEventArgs e)
        {
            HideKeyboard();
            searchField.Text = string.Empty;

            var builder = CreateView(Resource.Layout.CustomCardAlert);

            var cardTitle     = builder.FindViewById <TextView>(Resource.Id.card_title);
            var eventType     = builder.FindViewById <TextView>(Resource.Id.card_etype);
            var eventDate     = builder.FindViewById <TextView>(Resource.Id.card_edate);
            var eventClient   = builder.FindViewById <TextView>(Resource.Id.card_eclient);
            var eventPersons  = builder.FindViewById <TextView>(Resource.Id.card_epersons);
            var eventLocation = builder.FindViewById <TextView>(Resource.Id.card_elocation);
            var spinner       = builder.FindViewById <Spinner>(Resource.Id.card_emanager);
            var cost          = builder.FindViewById <EditText>(Resource.Id.card_cost);

            var btnCancel = builder.FindViewById <Button>(Resource.Id.btn_cancel);
            var btnSend   = builder.FindViewById <Button>(Resource.Id.btn_send);

            btnCancel.Click += (s, p) =>
            {
                builder.Dismiss();
                HideKeyboard();
            };

            btnSend.Click += (s, p) =>
            {
                builder.Dismiss();
                OnSend(cardItems[e.Position].CardId);
            };

            cardTitle.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            eventType.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            eventDate.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            eventClient.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            eventPersons.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            eventLocation.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            cost.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            btnCancel.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);
            btnSend.SetTypeface(Constants.Instance.AEH, TypefaceStyle.Normal);

            eventType.Text     = cardItems[e.Position].EventType;
            eventDate.Text     = cardItems[e.Position].EventDate;
            eventClient.Text   = cardItems[e.Position].ClientName;
            eventPersons.Text  = $"{cardItems[e.Position].Persons} persons";
            eventLocation.Text = cardItems[e.Position].Location;

            LoadManagers();

            var data = new List <string>();

            foreach (var item in managersItems)
            {
                data.Add(item.Name);
            }

            if (data.Count == 0)
            {
                data.Add("No available managers");
            }

            var adapter = new ArrayAdapter(this, Resource.Drawable.spinner_item, data);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
        }
        private void SuggestionModeLayout()
        {
            /*****************
             **SuggestionMode**
             ******************/
            TextView suggestionModeLabel = new TextView(context);

            suggestionModeLabel.Text     = "Suggestion Mode";
            suggestionModeLabel.TextSize = 20;
            suggestionModeLabel.Gravity  = GravityFlags.Left;

            //SpaceText
            TextView spacingText = new TextView(context);

            propertylayout.AddView(spacingText);
            suggestionModeSpinner = new Spinner(context, SpinnerMode.Dialog);
            propertylayout.AddView(suggestionModeLabel);
            propertylayout.AddView(suggestionModeSpinner);

            //SuggestionList
            List <String> suggestionModeList = new List <String>();

            suggestionModeList.Add("StartsWith");
            suggestionModeList.Add("StartsWithCaseSensitive");
            suggestionModeList.Add("Contains");
            suggestionModeList.Add("ContainsWithCaseSensitive");
            suggestionModeList.Add("EndsWith");
            suggestionModeList.Add("EndsWithCaseSensitive");
            suggestionModeList.Add("Equals");
            suggestionModeList.Add("EqualsWithCaseSensitive");
            suggestionModeDataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, suggestionModeList);
            suggestionModeDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            suggestionModeSpinner.Adapter = suggestionModeDataAdapter;

            //suggestionModeSpinner ItemSelected Listener
            suggestionModeSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = suggestionModeDataAdapter.GetItem(e.Position);
                if (selectedItem.Equals("StartsWith"))
                {
                    suggestionModes = SuggestionMode.StartsWith;
                }
                else if (selectedItem.Equals("StartsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.StartsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Contains"))
                {
                    suggestionModes = SuggestionMode.Contains;
                }
                else if (selectedItem.Equals("ContainsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
                }
                else if (selectedItem.Equals("EndsWith"))
                {
                    suggestionModes = SuggestionMode.EndsWith;
                }
                else if (selectedItem.Equals("EndsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EndsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Equals"))
                {
                    suggestionModes = SuggestionMode.Equals;
                }
                else if (selectedItem.Equals("EqualsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
                }
            };

            //Separator
            SeparatorView suggestionModeSeparate = new SeparatorView(context, width * 2);

            suggestionModeSeparate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams suggestionModeLayoutParam = new LinearLayout.LayoutParams(width * 2, 5);
            suggestionModeLayoutParam.SetMargins(0, 20, 0, 0);
            // propertylayout.AddView(suggestionModeSeparate, suggestionModeLayoutParam);
        }
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.customer_registration_tblCustomer);

            string url = "http://192.168.0.111/culturalcities/webservice/";
            //string url = "http://192.168.0.111:44322/webservice/";
            var           clienteHTTP = new ODataClient(url);
            Button        btnRegister = FindViewById <Button>(Resource.Id.btnRegister);
            List <string> countryID   = new List <string>();
            List <string> countryName = new List <string>();
            List <string> cityID      = new List <string>();
            List <string> cityName    = new List <string>();

            EditText txtCustomerID             = FindViewById <EditText>(Resource.Id.txtCustomerId);
            EditText txtCustomerFirstName      = FindViewById <EditText>(Resource.Id.txtCustomerFirstName);
            EditText txtCustomerLastName       = FindViewById <EditText>(Resource.Id.txtCustomerLastName);
            EditText txtCustomerBirth          = FindViewById <EditText>(Resource.Id.txtCustomerBirth);
            EditText txtCustomerUserName       = FindViewById <EditText>(Resource.Id.txtCustomerUserName);
            EditText txtCustomerPassWord       = FindViewById <EditText>(Resource.Id.txtCustomerPassWord);
            EditText txtCustomerReTypePassWord = FindViewById <EditText>(Resource.Id.txtCustomerReTypePassWord);
            EditText txtCustomerEmail          = FindViewById <EditText>(Resource.Id.txtCustomerEmail);
            Spinner  countrySpinner            = FindViewById <Spinner>(Resource.Id.spnCountry);
            Spinner  citySpinner = FindViewById <Spinner>(Resource.Id.spnCity);

            CustomerBirthDate        = FindViewById <TextView>(Resource.Id.txtCustomerBirth);
            CustomerBirthDate.Click += (sender, e) => {
                DateTime         today  = DateTime.Today;
                DatePickerDialog dialog = new DatePickerDialog(this, OnDateSet, today.Year, today.Month - 1, today.Day);
                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            try
            {
                var countries = await clienteHTTP.FindEntriesAsync("tblCountries");

                foreach (var country in countries)
                {
                    countryID.Add(country["country_id"].ToString());
                    countryName.Add(country["name"].ToString());
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }
            var countryAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, countryName);

            countrySpinner.Adapter = countryAdapter;

            countrySpinner.ItemSelected += async(sender, args) =>
            {
                try
                {
                    var cities = await clienteHTTP.FindEntriesAsync("tblCities?$filter=country_id eq " + int.Parse(countryID[args.Position]));

                    foreach (var city in cities)
                    {
                        cityID.Clear();
                        cityName.Clear();
                        cityID.Add(city["city_id"].ToString());
                        cityName.Add(city["name"].ToString());
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
                var cityAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, cityName);
                citySpinner.Adapter = cityAdapter;
            };

            btnRegister.Click += async(sender, args) =>
            {
                try
                {
                    var registry = new
                    {
                        customer_id             = 0,
                        personal_identification = int.Parse(txtCustomerID.Text),
                        first_name  = txtCustomerFirstName.Text,
                        last_name   = txtCustomerLastName.Text,
                        birth_date  = Convert.ToDateTime(txtCustomerBirth.Text),
                        username    = txtCustomerUserName.Text,
                        password    = txtCustomerPassWord.Text,
                        email       = txtCustomerEmail.Text,
                        city_id     = cityID[citySpinner.SelectedItemPosition],
                        create_time = Convert.ToDateTime(DateTime.Now),
                        update_time = Convert.ToDateTime(DateTime.Now)
                    };
                    var result = await clienteHTTP.For("tblCustomers").Set(registry).InsertEntryAsync();

                    if (result.Count() == 0)
                    {
                        //Falló la inserción
                        Toast.MakeText(this, "Registro fallido", ToastLength.Long).Show();
                    }
                    else
                    {
                        var preferences = await clienteHTTP.FindEntriesAsync("tblPreferenceValues");

                        foreach (var preference in preferences)
                        {
                            switch (preference["preference_name"])
                            {
                            case "max_items_per_page":
                                await clienteHTTP.For("tblCustomerPreferences").Set(new
                                {
                                    customer_id      = result["customer_id"],
                                    preference_id    = preference["preference_id"],
                                    preference_value = "20",
                                    update_time      = Convert.ToDateTime(DateTime.Now)
                                }).InsertEntryAsync();

                                break;

                            case "mobile_alerts_enabled":
                                await clienteHTTP.For("tblCustomerPreferences").Set(new
                                {
                                    customer_id      = result["customer_id"],
                                    preference_id    = preference["preference_id"],
                                    preference_value = "0",
                                    update_time      = Convert.ToDateTime(DateTime.Now)
                                }).InsertEntryAsync();

                                break;

                            case "preferred_genres":
                                break;
                            }
                        }
                        Toast.MakeText(this, "Registro exitoso", ToastLength.Long).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.TripAddLayout);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            spinner             = FindViewById <Spinner>(Resource.Id.spinnerFriends);
            buttonStartDate     = FindViewById <Button>(Resource.Id.buttonStartDate);
            buttonEndDate       = FindViewById <Button>(Resource.Id.buttonEndDate);
            titleField          = FindViewById <EditText>(Resource.Id.editTextName);
            descriptionField    = FindViewById <EditText>(Resource.Id.editTextDescription);
            listView            = FindViewById <ListView>(Resource.Id.listViewFriends);
            listView.ItemClick += ListViewClick;

            titleField.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(25) });
            descriptionField.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(60) });

            var swipeContainer = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeContainer);

            swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
            swipeContainer.Refresh += SwipeContainer_Refresh;

            buttonStartDate.Click += delegate
            {
                ButtonStartDate_OnClick();
            };

            buttonEndDate.Click += delegate
            {
                ButtonEndDate_OnClick();
            };

            users = new List <UserItem>();
            users.Add(new UserItem {
                Name = "Choose friend"
            });
            item       = JsonConvert.DeserializeObject <TripItem>(Intent.GetStringExtra("Trip"));
            allFriends = MyFriendsActivity.friendsList;
            if (item != null)
            {
                GetFriends();
                titleField.Text       = item.Name;
                descriptionField.Text = item.Description;
                StartDate             = item.StartDate;
                EndDate = item.EndDate;

                if (allFriends.Contains(HomeActivity1.userItem))
                {
                    allFriends.Remove(HomeActivity1.userItem);
                }
                allFriends = new ObservableCollection <UserItem>(allFriends.Except(friendsTrip).ToList());
                allFriends = new ObservableCollection <UserItem>(allFriends.OrderBy(o => o.Name).ToList());
                users.AddRange(allFriends);
            }

            else
            {
                allFriends = new ObservableCollection <UserItem>(allFriends.OrderBy(o => o.Name).ToList());
                users.AddRange(allFriends);
            }

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected);

            var adapter = new ArrayAdapter <UserItem>(this, Android.Resource.Layout.SimpleSpinnerItem, users);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerItem);
            spinner.Adapter = adapter;
        }
Ejemplo n.º 55
0
        public override View GetPropertyWindowLayout(Android.Content.Context context)
        {
            /**
             * Property Window
             * */
            int          width          = (context.Resources.DisplayMetrics.WidthPixels) / 2;
            LinearLayout propertylayout = new LinearLayout(context); //= new LinearLayout(context);

            propertylayout.Orientation = Android.Widget.Orientation.Vertical;

            LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
                width * 2, 5);

            layoutParams1.SetMargins(0, 20, 0, 0);

            TrendTypeValue      = new TextView(context);
            TrendTypeValue.Text = "Trendline Type";
            TrendTypeValue.SetPadding(5, 20, 0, 20);

            ForwardForecast      = new TextView(context);
            ForwardForecast.Text = "Forward Forecast: 0";
            ForwardForecast.SetPadding(5, 20, 0, 20);

            SeekBar FwdForecast = new SeekBar(context);

            FwdForecast.Max              = 5;
            FwdForecast.Progress         = 0;
            FwdForecast.ProgressChanged += FwdForecast_ProgressChanged;

            BackwardForecast      = new TextView(context);
            BackwardForecast.Text = "Backward Forecast: 0";
            BackwardForecast.SetPadding(5, 20, 0, 20);

            SeekBar BwdForecast = new SeekBar(context);

            BwdForecast.Max              = 5;
            BwdForecast.Progress         = 0;
            BwdForecast.ProgressChanged += BwdForecast_ProgressChanged;

            PolyomialOrder      = new TextView(context);
            PolyomialOrder.Text = "Polynomial Order: 2";
            PolyomialOrder.SetPadding(5, 20, 0, 20);

            SeekBar PolyOrder = new SeekBar(context);

            PolyOrder.Max              = 5;
            PolyOrder.Progress         = 2;
            PolyOrder.ProgressChanged += PolyOrder_ProgressChanged;
            var spinner = new Spinner(context, SpinnerMode.Dialog);

            adapter = new List <String>()
            {
                "Linear", "Exponential", "Logarithmic", "Power", "Polynomial"
            };
            ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>
                                                    (context, Android.Resource.Layout.SimpleSpinnerItem, adapter);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinner.Adapter = dataAdapter;

            spinner.ItemSelected += Spinner_ItemSelected;

            propertylayout.AddView(TrendTypeValue);
            propertylayout.AddView(spinner);
            propertylayout.AddView(ForwardForecast);
            propertylayout.AddView(FwdForecast);
            propertylayout.AddView(BackwardForecast);
            propertylayout.AddView(BwdForecast);
            propertylayout.AddView(PolyomialOrder);
            propertylayout.AddView(PolyOrder);
            SeparatorView separate = new SeparatorView(context, width * 2);

            separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            propertylayout.AddView(separate, layoutParams1);

            return(propertylayout);
        }
Ejemplo n.º 56
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            // Setup the window
            SetContentView(Resource.Layout.device_list);

            // Set result CANCELED incase the user backs out
            SetResult(Android.App.Result.Canceled);

            _activityCommon = new ActivityCommon(this);

            _appDataDir = Intent.GetStringExtra(ExtraAppDataDir);

            // Initialize the button to perform device discovery
            _scanButton        = FindViewById <Button>(Resource.Id.button_scan);
            _scanButton.Click += (sender, e) =>
            {
                DoDiscovery();
                _scanButton.Enabled = false;
            };

            // Initialize array adapters. One for already paired devices and
            // one for newly discovered devices
            _pairedDevicesArrayAdapter = new ArrayAdapter <string> (this, Resource.Layout.device_name);
            _newDevicesArrayAdapter    = new ArrayAdapter <string> (this, Resource.Layout.device_name);

            // Find and set up the ListView for paired devices
            var pairedListView = FindViewById <ListView> (Resource.Id.paired_devices);

            pairedListView.Adapter    = _pairedDevicesArrayAdapter;
            pairedListView.ItemClick += DeviceListClick;

            // Find and set up the ListView for newly discovered devices
            var newDevicesListView = FindViewById <ListView> (Resource.Id.new_devices);

            newDevicesListView.Adapter    = _newDevicesArrayAdapter;
            newDevicesListView.ItemClick += DeviceListClick;

            // Register for broadcasts when a device is discovered
            _receiver = new Receiver(this);
            var filter = new IntentFilter(BluetoothDevice.ActionFound);

            RegisterReceiver(_receiver, filter);

            // Register for broadcasts when discovery has finished
            filter = new IntentFilter(BluetoothAdapter.ActionDiscoveryFinished);
            RegisterReceiver(_receiver, filter);

            // Get the local Bluetooth adapter
            _btAdapter = BluetoothAdapter.DefaultAdapter;

            // Get a set of currently paired devices
            var pairedDevices = _btAdapter.BondedDevices;

            // If there are paired devices, add each one to the ArrayAdapter
            if (pairedDevices.Count > 0)
            {
                foreach (var device in pairedDevices)
                {
                    if (device == null)
                    {
                        continue;
                    }
                    try
                    {
                        ParcelUuid[] uuids = device.GetUuids();
                        if ((uuids == null) || (uuids.Any(uuid => SppUuid.CompareTo(uuid.Uuid) == 0)))
                        {
                            _pairedDevicesArrayAdapter.Add(device.Name + "\n" + device.Address);
                        }
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
            }
            else
            {
                String noDevices = Resources.GetText(Resource.String.none_paired);
                _pairedDevicesArrayAdapter.Add(noDevices);
            }
        }
Ejemplo n.º 57
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.EventCreationForm);

            // Services
            userService = new UserService(DataBase.current_user);

            // Set views
            initViews();

            // Liste des groupes de l'utilisateur
            groupList = GetUserGroupNames(userService.GetUserAllGroups());
            ArrayAdapter <string> spinnerAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, groupList);

            if (groupSpinner != null)
            {
                groupSpinner.Adapter = spinnerAdapter;
            }

            // Connecting the action of the fragment datepicker
            if (startDate != null)
            {
                startDate.Click += delegate
                {
                    isStartDateClicked = true;
                    ShowDialog(DATE_DIALOG_ID);
                }
            }
            ;

            if (endDate != null)
            {
                endDate.Click += delegate
                {
                    isStartDateClicked = false;
                    ShowDialog(DATE_DIALOG_ID);
                }
            }
            ;

            // Connectiong action of the fragment timepicker

            if (startHour != null)
            {
                startHour.Click += delegate
                {
                    isStartTimeClicked = true;
                    ShowDialog(TIME_DIALOG_ID);
                }
            }
            ;

            if (endHour != null)
            {
                endHour.Click += delegate
                {
                    isStartTimeClicked = false;
                    ShowDialog(TIME_DIALOG_ID);
                }
            }
            ;

            // Création de l'événement
            if (createButton != null)
            {
                createButton.Click += delegate
                {
                    Event newEvent = createEvent();

                    // adding event into user eventlist and vice versa
                    newEvent.addUser(DataBase.current_user);
                    userService.addUserEvent(newEvent.groupId, newEvent);

                    StartActivity(typeof(EventManagerActivity));
                }
            }
            ;

            // Setting today's date and time
            _date = DateTime.Today;
            _time = DateTime.Today;

            // On stocke les heure du début et de fin
            startDateTime = DateTime.Today;
            endDateTime   = DateTime.Today;

            startDate.Text = _date.ToString(_dateFormat);
            startHour.Text = _time.ToString(_timeFormat);
        }
Ejemplo n.º 58
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.KullaniciEkle);
            // Create your application here
            //web servis baðlantýsý için refenrans oluþturulu
            List <String> liste = new List <string>();

            EditText   ad       = (EditText)FindViewById(Resource.Id.ad_giris);
            EditText   soyisim  = (EditText)FindViewById(Resource.Id.soyad_giris);
            EditText   email    = (EditText)FindViewById(Resource.Id.e_mail_giris);
            RadioGroup cins     = (RadioGroup)FindViewById(Resource.Id.rd_group_cinsiyet);
            RadioGroup unvan    = (RadioGroup)FindViewById(Resource.Id.rd_unvan_group);
            Spinner    bolum    = (Spinner)FindViewById(Resource.Id.spin_bolum);
            EditText   sifre    = (EditText)FindViewById(Resource.Id.sifre_giris);
            EditText   resim    = (EditText)FindViewById(Resource.Id.resim_yolu);
            Button     btnKayit = (Button)FindViewById(Resource.Id.btnKayit);

            WebService.Service1 servis = new WebService.Service1();
            try
            {
                liste.AddRange(servis.BolumCek());
                ArrayAdapter <String> adapter_state = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleSpinnerItem, liste);
                adapter_state.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                bolum.Adapter = adapter_state;
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); }

            btnKayit.Click += delegate
            {
                String isim     = ad.Text;
                String soyad    = soyisim.Text;
                String mail     = email.Text;
                int    cinsiyet = cins.CheckedRadioButtonId;
                if (cinsiyet == 2131099659)
                {
                    cinsiyet = 1;
                }
                else
                {
                    cinsiyet = 2;
                }
                int unv = unvan.CheckedRadioButtonId;
                if (unv == 2131099662)
                {
                    unv = 1;
                }
                else
                {
                    unv = 2;
                }
                int     spn   = (int)bolum.SelectedItemId + 1;
                String  sfr   = sifre.Text;
                String  rsm   = resim.Text;
                Boolean cevap = servis.KullaniciKayit(isim, soyad, mail,
                                                      cinsiyet, unv, spn, sfr, rsm);
                if (cevap.Equals(true))
                {
                    Toast.MakeText(this, "Baþarýyla kaydýnýz" +
                                   " yapýldý.", ToastLength.Short);
                    Toast.MakeText(this, "Þimdi giriþ sayfasýna" +
                                   " yönlendiriliyorsunuz...", ToastLength.Short);
                    StartActivity(new Intent(this, typeof(MainActivity)));
                }
                else
                {
                    Toast.MakeText(this, "Kayýt iþlemi sýrasýnda beklenmeyen bir " +
                                   "hata oluþtu lütfen tekrar deneyiniz.", ToastLength.Short);
                }
            };
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Called immediately after <c><see cref="M:Android.App.Fragment.OnCreateView(Android.Views.LayoutInflater, Android.Views.ViewGroup, Android.Views.ViewGroup)" /></c>
        /// has returned, but before any saved state has been restored in to the view.
        /// </summary>
        /// <param name="view">The View returned by <c><see cref="M:Android.App.Fragment.OnCreateView(Android.Views.LayoutInflater, Android.Views.ViewGroup, Android.Views.ViewGroup)" /></c>.</param>
        /// <param name="savedInstanceState">If non-null, this fragment is being re-constructed
        /// from a previous saved state as given here.</param>
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            var layout = ( FrameLayout )view;

            //
            // Initialize the background image view.
            //
            BackgroundImageView = new ImageView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent),
                Alpha            = 0.25f
            };
            BackgroundImageView.SetScaleType(ImageView.ScaleType.FitCenter);
            layout.AddView(BackgroundImageView);

            //
            // Initialize the title view.
            //
            TitleView = new TextView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(880), DipToPixel(40))
                {
                    TopMargin = DipToPixel(30),
                    Gravity   = GravityFlags.CenterHorizontal
                },
                TextAlignment = TextAlignment.Center,
                TextSize      = 28,
                Typeface      = Typeface.DefaultBold
            };
            layout.AddView(TitleView);

            //
            // Initialize the poster image view.
            //
            PosterImageView = new ImageView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(400), DipToPixel(225))
                {
                    TopMargin  = DipToPixel(100),
                    LeftMargin = DipToPixel(40)
                }
            };
            PosterImageView.SetScaleType(ImageView.ScaleType.FitCenter);
            layout.AddView(PosterImageView);

            //
            // Initialize the left detail text view.
            //
            DetailLeftView = new TextView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(200), DipToPixel(20))
                {
                    TopMargin  = DipToPixel(325),
                    LeftMargin = DipToPixel(40)
                },
                TextAlignment = TextAlignment.ViewStart,
                TextSize      = 14
            };
            layout.AddView(DetailLeftView);

            //
            // Initialize the right detail text view.
            //
            DetailRightView = new TextView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(200), DipToPixel(20))
                {
                    TopMargin  = DipToPixel(325),
                    LeftMargin = DipToPixel(240)
                },
                TextAlignment = TextAlignment.ViewEnd,
                TextSize      = 14
            };
            layout.AddView(DetailRightView);

            //
            // Initialize the description text view.
            //
            DescriptionView = new TextView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(400), DipToPixel(140))
                {
                    TopMargin  = DipToPixel(355),
                    LeftMargin = DipToPixel(40)
                },
                TextSize  = 14,
                Ellipsize = global::Android.Text.TextUtils.TruncateAt.End
            };
            DescriptionView.SetMaxLines(8);
            DescriptionView.SetLines(8);
            DescriptionView.SetSingleLine(false);
            layout.AddView(DescriptionView);

            //
            // Initialize the poster items view.
            //
            PosterItems = new ListView(Activity)
            {
                LayoutParameters = new FrameLayout.LayoutParams(DipToPixel(400), DipToPixel(340))
                {
                    TopMargin   = DipToPixel(100),
                    RightMargin = DipToPixel(40),
                    Gravity     = GravityFlags.Right
                }
            };
            layout.AddView(PosterItems);

            //
            // Initialize the data and settings for the list view.
            //
            PosterItemsAdapter        = new ArrayAdapter <string>(Activity, Resource.Layout.PosterListViewItem);
            PosterItems.Adapter       = PosterItemsAdapter;
            PosterItems.ItemClick    += listView_ItemClick;
            PosterItems.ItemSelected += listView_ItemSelected;

            if (PosterData != null)
            {
                UpdateUserInterfaceFromContent();
            }
        }
Ejemplo n.º 60
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     Activities  = utilFuncActivity.getStartingMenu(this);
     ListAdapter = new ArrayAdapter <ActivityItem>(this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, Activities);
 }