Пример #1
0
		async public Task ListViewClickAsync()
		{

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

			// Disable the controls 
			DisableControls ();

			// Specific Controls

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;


            _ansprechpartnern = await BusinessLayer.Ansprechpartner.GetAnsprechpartnernAsync ( _stateClass._person.ID, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);
			_tasks = await BusinessLayer.Task.GetTasksAsync ( _stateClass._person.ID,MainActivity.User);
            _taskStatus =  CreateTaskStatusList (UI.Utilities.GetCurrentLanguage(_mainActivity));

			// Fill the spinners
			// Tasks
			_spinnerTask = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
			TaskViewAdapter _adapterTask = new TaskViewAdapter (_mainActivity, _tasks);
			_spinnerTask.Adapter = _adapterTask;

			// Ansprechpartner
			_spinnerAnsprechpartner = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
			_spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerAnsprechpartnerItemSelected );
			AnsprechpartnerViewAdapter _adapterAnsprechpartner = new AnsprechpartnerViewAdapter (_mainActivity,_ansprechpartnern);
			_spinnerAnsprechpartner.Adapter = _adapterAnsprechpartner;

			// Art Spinner
			_spinnerArt = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerArt);
            ArtViewAdapter _adapterArt = new ArtViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.taskArts);
			_spinnerArt.Adapter = _adapterArt;

			// Typ Spinner
			_spinnerTyp = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTyp);
            TypViewAdapter _adapterTyp = new TypViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.taskTyps);
			_spinnerTyp.Adapter = _adapterTyp;

			// Status Spinner
			_spinnerStatus = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerStatus);
			StringViewAdapter _adapterString = new StringViewAdapter (_mainActivity, _taskStatus);
			_spinnerStatus.Adapter = _adapterString;

			// Mitarbeiter Spinner
			_spinnerMitarbeiter = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerMitarbeiter);
			_spinnerMitarbeiter.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerMitarbeiterItemSelected );
            MitarbeiterViewAdapter _adapterMitarbeiter = new MitarbeiterViewAdapter (_mainActivity,BusinessLayer.UtilityClasses.mitarbeitern);
			_spinnerMitarbeiter.Adapter = _adapterMitarbeiter;

			// Abteilung Spinner
			_spinnerAbteilung = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAbteilung);
            AbteilungViewAdapter _adapterAbteilung = new AbteilungViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.abteilungen);
			_spinnerAbteilung.Adapter = _adapterAbteilung;

			// Specific Controls
			if (_tasks.Count > 0)
			{
				// Show by default the first item, if there is an item!!!
				_edDatum.Text = _tasks [_selectedIndex].Datum;
				_edZeit.Text = _tasks [_selectedIndex].Zeit;
				_edAnsprechpartner.Text = _tasks [_selectedIndex].Ansprechpartner;
				_edStartTelefon.Text = _tasks [_selectedIndex].Time_TelStart;
				_edDauerTelefon.Text =  _tasks [_selectedIndex].Time_TelDauer;
				_edDatumEdit.Text =  _tasks [_selectedIndex].Datum_Edit;
				_edDatumClose.Text = _tasks [_selectedIndex].Datum_Close;
				_edText.Text =  _tasks [_selectedIndex].Memo;
				_edNummer.Text = _tasks [_selectedIndex].ID;
			}
			else
			{
				// If not, just clear all controls
				_task = BusinessLayer.Task.Create ();
				ResetControls ();
			}

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(permission.Create, false, false, false, false);
            else
                ConfigureButtons(permission.Create, false, false, false, permission.UpDownload);

            return ;

		}
Пример #2
0
        public override void OnStart ()
        {
            base.OnStart ();

            _spinnerTyp = _activity.FindViewById<Spinner>(Resource.Id.spinnerTyp);
            _spinnerArt = _activity.FindViewById<Spinner>(Resource.Id.spinnerArt);
            _spinnerStatus = _activity.FindViewById<Spinner> (Resource.Id.spinnerStatus);
            _spinnerMitarbeiter = _activity.FindViewById<Spinner>(Resource.Id.spinnerMitarbeiter);
            _spinnerAbteilung = _activity.FindViewById<Spinner>(Resource.Id.spinnerAbteilung);

            _edNummer = _activity.FindViewById<EditText> (Resource.Id.edNummer);
            _edDatum = _activity.FindViewById<EditText> (Resource.Id.edDatum);
            _edZeit = _activity.FindViewById<EditText> (Resource.Id.edZeit);
            _edAnsprechpartner = _activity.FindViewById<EditText> (Resource.Id.edAnsprechpartner);
            _edStartTelefon = _activity.FindViewById<EditText> (Resource.Id.edStartTelefon);
            _edDauerTelefon = _activity.FindViewById<EditText> (Resource.Id.edDauerTelefon);
            _edDatumEdit = _activity.FindViewById<EditText> (Resource.Id.edDatumEdit);
            _edDatumClose = _activity.FindViewById<EditText> (Resource.Id.edDatumClose);
            _edText = _activity.FindViewById<EditText> (Resource.Id.edText);



            // Fill the spinners
            // Tasks
            _spinnerTask = _activity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
            _spinnerTask.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (_stateFragment.SpinnerTaskItemSelected );
            TaskViewAdapter _adapterTask = new TaskViewAdapter (_activity, _stateFragment._tasks);
            _spinnerTask.Adapter = _adapterTask;
            _spinnerTask.Touch += SpinnerTask_Touch;


            // Ansprechpartner
            _spinnerAnsprechpartner = _activity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
            _spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (_stateFragment.SpinnerAnsprechpartnerItemSelected );
            AnsprechpartnerViewAdapter _adapterAnsprechpartner = new AnsprechpartnerViewAdapter (_activity, _stateFragment._ansprechpartnern);
            _spinnerAnsprechpartner.Adapter = _adapterAnsprechpartner;
            _spinnerAnsprechpartner.Touch += SpinnerAnsprechpartner_Touch;

            // Art Spinner
            _spinnerArt = _activity.FindViewById<Spinner> (Resource.Id.spinnerArt);
            ArtViewAdapter _adapterArt = new ArtViewAdapter (_activity, BusinessLayer.UtilityClasses.taskArts);         
            _spinnerArt.Adapter = _adapterArt;
            _spinnerArt.Touch += SpinnerArt_Touch;


            // Typ Spinner
            _spinnerTyp = _activity.FindViewById<Spinner> (Resource.Id.spinnerTyp);
            TypViewAdapter _adapterTyp = new TypViewAdapter (_activity, BusinessLayer.UtilityClasses.taskTyps);
            _spinnerTyp.Adapter = _adapterTyp;
            _spinnerTyp.Touch += SpinnerTyp_Touch;

            // Status Spinner
            _spinnerStatus = _activity.FindViewById<Spinner> (Resource.Id.spinnerStatus);
            StringViewAdapter _adapterString = new StringViewAdapter (_activity, _stateFragment._taskStatus);
            _spinnerStatus.Adapter = _adapterString;
            _spinnerStatus.Touch += SpinnerStatus_Touch;

            // Mitarbeiter Spinner
            _spinnerMitarbeiter = _activity.FindViewById<Spinner> (Resource.Id.spinnerMitarbeiter);
            _spinnerMitarbeiter.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (_stateFragment.SpinnerMitarbeiterItemSelected );
            MitarbeiterViewAdapter _adapterMitarbeiter = new MitarbeiterViewAdapter (_activity, BusinessLayer.UtilityClasses.mitarbeitern);
            _spinnerMitarbeiter.Adapter = _adapterMitarbeiter;
            _spinnerMitarbeiter.Touch += SpinnerMitarbeiter_Touch;

            // Abteilung Spinner
            _spinnerAbteilung = _activity.FindViewById<Spinner> (Resource.Id.spinnerAbteilung);
            AbteilungViewAdapter _adapterAbteilung = new AbteilungViewAdapter (_activity, BusinessLayer.UtilityClasses.abteilungen);
            _spinnerAbteilung.Adapter = _adapterAbteilung;
            _spinnerAbteilung.Touch += SpinnerAbteilung_Touch;

            // Disable the controls if necessary
            _stateFragment.GetControlReferences();
            if (_edNummer.Enabled == false)
                _stateFragment.DisableControls();

        }