protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            SetContentView(R.Layouts.ItemDetailActivity_Layout);

            var itemID = Intent.GetLongExtra("itemID", 0);
            var itemName = Intent.GetStringExtra("itemName");

            this.ActionBar.SetTitle(itemName);
            this.ActionBar.NavigationMode = ActionBar.NAVIGATION_MODE_TABS;

            detailsFragment = new ItemDetailsTabFragment(null);
            detailsTab = this.ActionBar.NewTab();
            detailsTab.SetText("Details");
            detailsTab.SetTabListener(this);
            detailsTab.SetTag(detailsFragment);
            this.ActionBar.AddTab(detailsTab);

            stocksFragment = new ItemStationStockTabFragment(null);
            stockTab = this.ActionBar.NewTab();
            stockTab.SetText("Stock");
            stockTab.SetTabListener(this);
            stockTab.SetTag(stocksFragment);
            this.ActionBar.AddTab(stockTab);

            producersFragment = new ItemProducersTabFragment(null);
            producersTab = this.ActionBar.NewTab();
            producersTab.SetText("Production");
            producersTab.SetTabListener(this);
            producersTab.SetTag(producersFragment);
            this.ActionBar.AddTab(producersTab);

            if (itemID == 0)
            {
                Android.Widget.Toast.MakeText(this, "Item ID Error!", Android.Widget.Toast.LENGTH_LONG).Show();
            }

            var itemDetail = LastNonConfigurationInstance as Item;
            if ((itemDetail != null) && (itemDetail.ItemID == itemID))
            {
                _savedInstance = itemDetail;
                PopulateItemDetail(itemDetail);
            }
            else
            {
                RefreshItemDetail(itemID);
            }
        }
			protected override void OnCreate (Bundle savedInstanceState) {
				base.OnCreate(savedInstanceState);
				base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
				brickController = BrickController.Instance;
				settings = RemoteSettings.Instance;
				SetContentView(Resource.Layout.tab);

				ActionBar actionBar = this.ActionBar;
				//actionBar.SetDisplayShowTitleEnabled (false);
				//actionBar.SetDisplayShowHomeEnabled (false);
				actionBar.NavigationMode = ActionBarNavigationMode.Tabs;
				
				vehicleTab = actionBar.NewTab ().SetText ("Vehicle");
				sensorTab = actionBar.NewTab ().SetText ("Sensor");
				motorTab = actionBar.NewTab ().SetText ("Motor");
				fileTab = actionBar.NewTab().SetText("Files");
				mailboxTab = actionBar.NewTab ().SetText ("Mailbox");
				
				vehicleFragment = new VehicleFragment();
				fileFragment = new FileListFragment();
				sensorFragment = new SensorFragment();
				Fragment empty = new Fragment ();

				vehicleTab.SetTabListener (new MyTabsListener(vehicleFragment)); 
				sensorTab.SetTabListener (new MyTabsListener(sensorFragment)); 
				motorTab.SetTabListener(new MyTabsListener(empty )); 
				fileTab.SetTabListener(new MyTabsListener(fileFragment)); 
				mailboxTab.SetTabListener (new MyTabsListener(empty));
				
				settings.Initialize(GetSharedPreferences ("RemoteSettings", 0));
				
				actionBar.AddTab(vehicleTab);
				actionBar.AddTab(sensorTab);
				//actionBar.AddTab(motorTab);
				actionBar.AddTab(fileTab);
				//actionBar.AddTab(mailboxTab);
				if(!hasSubscribed){
					brickController.NewBrick += delegate(MonoBrick.NXT.Brick<MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor> nxt) {
						nxt.Connection.Disconnected += OnDisconnected;
						nxt.Connection.Connected += OnConnected;
					};
					brickController.BrickException += OnBrickException;
					brickController.ThreadNotStarted += OnThreadOnstarted;
					hasSubscribed = true;
				}
			}
示例#3
0
        private void setMainTabbar()
        {
            // Now set the actionnbar with its tabs -> Kunden + Lieferanten + Interessenten + Artikeln
            ActionBar bar = ActionBar;

            if(_user.HasPermission(BusinessLayer.DAC_Object.Kunde, BusinessLayer.DAC_Permission.READ))
            {
                _tabKunden = this.ActionBar.NewTab ();
                _tabKunden.SetText(Resources.GetString(Resource.String.Kunden) );
                _tabKunden.SetIcon ( Resource.Drawable.ic_action_person);
                _tabKunden.SetTabListener (this);
                bar.AddTab (_tabKunden);
            }
            if (_user.HasPermission(BusinessLayer.DAC_Object.Lieferant, BusinessLayer.DAC_Permission.READ))
            {
                _tabLieferanten = this.ActionBar.NewTab();
                _tabLieferanten.SetText(Resources.GetString(Resource.String.Lieferanten));
                _tabLieferanten.SetIcon(Resource.Drawable.ic_action_lieferant);
                _tabLieferanten.SetTabListener(this);
                bar.AddTab(_tabLieferanten);
            }
            if (_user.HasPermission(BusinessLayer.DAC_Object.Interessent, BusinessLayer.DAC_Permission.READ))
            {
                _tabInteressenten = this.ActionBar.NewTab();
                _tabInteressenten.SetText(Resources.GetString(Resource.String.Interessenten));
                _tabInteressenten.SetIcon(Resource.Drawable.ic_action_Interessent);
                _tabInteressenten.SetTabListener(this);
                bar.AddTab(_tabInteressenten);
            }
            if (User.HasPermission(BusinessLayer.DAC_Object.Artikel, BusinessLayer.DAC_Permission.READ))
            {
                _tabArtikel = this.ActionBar.NewTab ();
                _tabArtikel.SetText (Resources.GetString(Resource.String.Artikeln) );
                _tabArtikel.SetIcon(Resource.Drawable.ic_action_article);
                _tabArtikel.SetTabListener (this);
                bar.AddTab (_tabArtikel);
            }

            var mActionBarView = LayoutInflater.Inflate (
                Resource.Layout.action_bar_custom, null);


            bar.CustomView = mActionBarView;
            bar.DisplayOptions = ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.UseLogo;
            bar.NavigationMode = ActionBarNavigationMode.Tabs;
            bar.SetDisplayShowHomeEnabled (true);
            ActionBar.SetHomeButtonEnabled(true);
        }