Пример #1
0
        private void IsMain(bool isInit = true, bool isReq = false)
        {
            SetContentView(Resource.Layout.Main);
            baseModel.Content = CurrentContent.Main;
            TabHost tabHost = (TabHost)FindViewById(Resource.Id.tabHost);

            tabHost.Setup();

            Android.Widget.TabHost.TabSpec spec1 = tabHost.NewTabSpec("Tab 1");
            spec1.SetIndicator("Todo");
            spec1.SetContent(Resource.Id.tab1);

            Android.Widget.TabHost.TabSpec spec2 = tabHost.NewTabSpec("Tab 2");
            spec2.SetIndicator("Waiting");
            spec2.SetContent(Resource.Id.tab2);

            Android.Widget.TabHost.TabSpec spec3 = tabHost.NewTabSpec("Tab 3");
            spec3.SetIndicator("Done");
            spec3.SetContent(Resource.Id.tab3);

            add        = (Button)FindViewById(Resource.Id.Add);
            add.Click += Main_Button_Click;

            tab1Content = (ScrollView)FindViewById(Resource.Id.tab1Content);
            tab2Content = (ScrollView)FindViewById(Resource.Id.tab2Content);
            tab3Content = (ScrollView)FindViewById(Resource.Id.tab3Content);
            tabHost.AddTab(spec1);
            tabHost.AddTab(spec2);
            tabHost.AddTab(spec3);
            AddToContent(isInit, isReq);
        }
Пример #2
0
        private void CreateTab(Type activityType, string tag, string label)
        {
            Intent intent = new Intent(this, activityType);

            intent.AddFlags(ActivityFlags.ClearTop);

            spec = TabHost.NewTabSpec(tag);
            spec.SetIndicator(label);
            spec.SetContent(intent);

            TabHost.AddTab(spec);
            TabHost.TabWidget.SetBackgroundColor(Android.Graphics.Color.ParseColor("#3597d4"));
            TabHost.TabChanged += TabHost_TabChanged;

            InventoryType = prefs.GetLong("InventoryType", 0);
            TextView  tabTextHeader = FindViewById <TextView>(Resource.Id.tabTextHeader);
            ImageView imgsearchicon = FindViewById <ImageView>(Resource.Id.imgsearchicon);
            ImageView imgflashicon  = FindViewById <ImageView>(Resource.Id.imgflashicon);

            if (InventoryType > 0)
            {
                if (InventoryType == 1)
                {
                    TabHost.CurrentTab = 0;
                    tabTextHeader.SetText("Manual Entry Inventory", TextView.BufferType.Normal);
                    imgflashicon.Visibility = ViewStates.Visible;
                    if (camera != null)
                    {
                        parameters           = camera.GetParameters();
                        parameters.FlashMode = Camera.Parameters.FlashModeOff;
                        camera.SetParameters(parameters);
                        camera.StopPreview();
                        camera.Release();
                    }
                }
                if (InventoryType == 2)
                {
                    TabHost.CurrentTab = 1;
                    tabTextHeader.SetText("Voice Dictation Inventory", TextView.BufferType.Normal);
                    imgflashicon.Visibility = ViewStates.Visible;
                    if (camera != null)
                    {
                        parameters           = camera.GetParameters();
                        parameters.FlashMode = Camera.Parameters.FlashModeOff;
                        camera.SetParameters(parameters);
                        camera.StopPreview();
                        camera.Release();
                    }
                }
                if (InventoryType == 3)
                {
                    TabHost.CurrentTab = 2;
                    tabTextHeader.SetText("Barcode Entry Inventory", TextView.BufferType.Normal);
                    imgflashicon.Visibility = ViewStates.Visible;
                    if (camera != null)
                    {
                        camera.StopPreview();
                        camera.Release();
                    }
                }
            }
            else
            {
                TabHost.CurrentTab = 0;
                tabTextHeader.SetText("Manual Entry Inventory", TextView.BufferType.Normal);
                imgflashicon.Visibility = ViewStates.Visible;
                if (camera != null)
                {
                    parameters           = camera.GetParameters();
                    parameters.FlashMode = Camera.Parameters.FlashModeOff;
                    camera.SetParameters(parameters);
                    camera.StopPreview();
                    camera.Release();
                }
            }
        }