コード例 #1
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
		public  void BtnGeneralFragmentClick()
		{

            PersonGeneralFragment fragment =  new PersonGeneralFragment(Resource.Layout.FrgPersonGeneral, _mainActivity , this);

			_mainActivity.FragmentManager 
				.BeginTransaction()
				.SetCustomAnimations (Android.Resource.Animator.FadeIn,Android.Resource.Animator.FadeOut)
				.Replace(Resource.Id.frameContent, fragment)
				.AddToBackStack (null)
				.Commit();

            if (_stateClass._person == null || _stateClass._person.ID == null)
            {
                ConfigureButtons(false, false, false, false, false);
                return;
            }

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

		}
コード例 #2
0
		protected override void OnCreate(Bundle savedInstanceState)
		{
			// Set the main flag for the activity, so that the blank Launcher knows this activity is running
			isRunning = true;

            progress_handler = new ProgressHandler (this);

			// Create the broadcast receiver and bind the event handler
			// so that the app gets updates of the network connectivity status
			_networkmonitor = new NetworkStatusMonitor (this);
			if (_broadcastReceiver == null)
			{
				// Set the ActivityController to 0 -> That has the effect that the sound won't be raised
				// This is just the first time when the activity starts, after that this counter increments
				// And doesn't prevent the sound
				NetworkStatusMonitor.ActivityController = 0;
				_broadcastReceiver = new NetworkStatusBroadcastReceiver ();
				_broadcastReceiver.ConnectionStatusChanged += _networkmonitor.OnNetworkStatusChanged;

				// Register the broadcast receiver
				Application.Context.RegisterReceiver (_broadcastReceiver, 
					new IntentFilter (ConnectivityManager.ConnectivityAction));

			}

			// Keep the ActivityController to 0 because we want to call the UpdateNetworkStatus on our own
			// And the sound shouldn't be raised
			UI.MainActivity._networkstate = _networkmonitor.GetNetworkStatus();


			base.OnCreate(savedInstanceState);

			// The SQLite Utility will be initialized
			// -> Open Connection -> Create Database -> Create Security and Object tables
			//DataAccessLayer.SQLiteUtilities.Initialize ();

			// Set the classname which is by default Kunden
			_className = "Kunden";

			// Set the layout
			SetContentView(Resource.Layout.ActivityMain);

            // First run the UtilityClasses
            BusinessLayer.UtilityClasses.FillUtilityClasses(BaseContext.Resources.Configuration.Locale.Language.ToUpper(), _user);

			// Run our lovely fragment which is by default the FrgGeneral
            fragment = new PersonGeneralFragment(Resource.Layout.FrgPersonGeneral,this,null);
			FragmentManager
				.BeginTransaction()
				.Replace(Resource.Id.frameContent, fragment)
				.Commit();

			// Initialize the controls
			_list = FindViewById<ListView>(Resource.Id.left_pane);
			_btnSearch = FindViewById<ImageButton> (Resource.Id.btnSearch);
			_btnNew = FindViewById<ImageButton> (Resource.Id.btnNew);
			_btnEdit = FindViewById<ImageButton> (Resource.Id.btnEdit);
			_btnSave = FindViewById<ImageButton> (Resource.Id.btnSave);
			_btnDelete = FindViewById<ImageButton> (Resource.Id.btnDelete);
			_leftLayout = FindViewById<LinearLayout> (Resource.Id.leftLayout);
			_btnOffline = FindViewById<ImageButton> (Resource.Id.btnOffline);
			_btnUebersicht = FindViewById<Button> (Resource.Id.btnUebersicht);
			_btnCharts = FindViewById<Button> (Resource.Id.btnCharts);
            _btnTasks = FindViewById<Button> (Resource.Id.btnTasks);
            _btnAngebot = FindViewById<Button> (Resource.Id.btnAngebot);
            _btnAuftrag = FindViewById<Button> (Resource.Id.btnAuftrag);
            _tvTelefon = FindViewById<TextView>(Resource.Id.tvTelefon);
            _ImageViewRecord = FindViewById<ImageView>(Resource.Id.ImageViewRecord);


			_btnAnsprechpartner = FindViewById<Button> (Resource.Id.btnAnsprechpartner);
			_btnMap = FindViewById<Button> (Resource.Id.btnMap);
			_edSearch = FindViewById<EditText> (Resource.Id.edSearch);

			// Set the Buttons
			// Disable the New - Edit - Save - Delete Button
			_btnNew.Enabled 		= false;
			_btnEdit.Enabled 		= false;
			_btnSave.Enabled 		= false;
			_btnDelete.Enabled 		= false;

			_btnOffline.Enabled = false;


			// Set the eventhandlers of the controls:
			// Buttons + listview
			_list.ItemClick += (sender, args) =>
			{
				ListItemClickAsync (args);
			};

            // Eventhandler for the Search button on the keyboard
            _edSearch.EditorAction += (object sender, TextView.EditorActionEventArgs e) => 
                {
                    if (e.ActionId == Android.Views.InputMethods.ImeAction.Search)
                    {
                        BtnSearchAsync();
                    }

                };

			_btnSearch.Click += (sender, e) => 
			{
				BtnSearchAsync ();
			};

			_btnNew.Click += (sender, e) => 
			{
				BtnNewClick ();
			};

			_btnEdit.Click += (sender, e) => 
			{
				BtnEditClick ();
			};

			// BtnSave Event must be handled here 
			_btnSave.Click += (sender, e) => 
			{
				BtnSaveClickAsync ();
			};

			_btnDelete.Click += (sender, e) => 
			{
				BtnDeleteClick ();
			};

			_btnUebersicht.Click += (sender, e) => 
			{
				BtnUebersichtClick ();
			};

			_btnMap.Click += (sender, e) => 
			{
				BtnMapClickAsync ();
			};

			
			_btnAnsprechpartner.Click += (sender, e) => 
			{
				BtnAnsprechpartnerClickAsync();
			};

			_btnTasks.Click += (sender, e) => {
				BtnTasksClickAsync ();
			};

            _btnAngebot.Click += (sender, e) => {

                BtnAngebotClickAsync();
            };

            _btnAuftrag.Click += (sender, e) => {

                BtnAuftragClickAsync();
            };

			_btnCharts.Click += (sender, e) => {
				BtnChartsClick();
			};

			_btnOffline.Click += (sender, e) => {

                BtnOfflineClickAsync();

			};

            // set the main tabbar according to the permissions
            this.setMainTabbar();

            // Hide the keyboard except the user clickes on it
            Console.WriteLine("Window.SetSoftInputMode (SoftInput.StateAlwaysHidden); Hide keyboard");
            Window.SetSoftInputMode (SoftInput.StateAlwaysHidden);

            // Set the MainColor 
            FindViewById<TableLayout>(Resource.Id.AM_ColoredTableLayout).SetBackgroundResource(DataAccessLayer.Utilities.MainColor);

		}