コード例 #1
0
ファイル: ItemFragment.cs プロジェクト: greg9898/RetailMobile
        public static ItemFragment NewInstance(long objId)
        {
            var detailsFrag = new ItemFragment {
                Arguments = new Bundle()
            };

            detailsFrag.Arguments.PutLong("ObjectId", objId);
            return(detailsFrag);
        }
コード例 #2
0
        void btnAddItem_Click(object sender, EventArgs e)
        {
            if (isTablet)
            {
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.detailInfo_fragment, ItemFragment.NewInstance(0));
                ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                ft.Commit();

                this.Activity.FindViewById <FrameLayout>(Resource.Id.details_fragment).Visibility = ViewStates.Gone;
            }
            else
            {
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.content_phone_fragment, ItemFragment.NewInstance(0));
                ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                ft.Commit();
            }
        }
コード例 #3
0
        public void ShowDetails(int index)
        {
            if (index == -1)
            {
                return;
            }


            // We can display everything in place with fragments.
            // Have the list highlight this item and show the data.
            ListView.SetItemChecked(index, true);
            int currentFragmentID = 0;
            var detailFragment    = (BaseFragment)FragmentManager.FindFragmentById(Resource.Id.fragment3);

            currentFragmentID = Resource.Id.fragment3;
            if (detailFragment == null)
            {
                detailFragment    = (BaseFragment)FragmentManager.FindFragmentById(Resource.Id.fragment1);
                currentFragmentID = Resource.Id.fragment1;
            }

            switch (ParentObjId)
            {
            case (int)MainMenu.MenuItems.Items:
                long itemId = ((ItemsInfoAdapter)ListAdapter).GetItem(index).ItemId;
                // long itemId = (long)((Library.ItemInfoList)_list)[index].ItemId;

                if (detailFragment == null || detailFragment.ObjectId != itemId)
                {
                    var ft = FragmentManager.BeginTransaction();
                    ft.Replace(currentFragmentID, ItemFragment.NewInstance(itemId));
                    ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                    ft.Commit();
                }
                break;

            case (int)MainMenu.MenuItems.Customers:
                long custId = (long)((Library.CustomerInfoList)_list)[index].CustID;

                if (detailFragment == null || detailFragment.ObjectId != custId)
                {
                    Library.CustomerInfoList custList = (Library.CustomerInfoList)_list;
                    System.Collections.Generic.List <string> custNamesList = new System.Collections.Generic.List <string>(custList.Count);
                    custList.ForEach(c => custNamesList.Add(c.Name));
                    var ft = FragmentManager.BeginTransaction();
                    ft.Replace(currentFragmentID, CustomerFragment.NewInstance(custId, custNamesList.ToArray()));
                    ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                    ft.Commit();
                }
                break;

            case (int)MainMenu.MenuItems.Invoices:
                //long invoiceId = (long)((Library.TransHedList)_list)[index].HtrnId;//?
                long invoiceId = (long)((TransHedAdapter)this.ListView.Adapter).GetItem(index).HtrnId;

                if (detailFragment == null || detailFragment.ObjectId != invoiceId)
                {
                    var ft = FragmentManager.BeginTransaction();
                    //ft.Replace(Resource.Id.detailInfo_fragment, InvoiceFragment.NewInstance(invoiceId));
                    InvoiceInfoFragment invoiceFragment = InvoiceInfoFragment.NewInstance(invoiceId);
                    ft.Replace(currentFragmentID, invoiceFragment);
                    ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                    ft.Commit();

                    invoiceFragment.InvoiceSaved += new InvoiceInfoFragment.InvoiceSavedDelegate(InvoiceSaved);
                }
                break;
            }
        }
コード例 #4
0
        void btnListItems_Click(object sender, EventArgs e)
        {
            LinearLayout l2 = this.Activity.FindViewById <LinearLayout>(Resource.Id.layout2);

            l2.Visibility = ViewStates.Visible;

            RelativeLayout f1 = Activity.FindViewById <RelativeLayout>(Resource.Id.fragment1);
            RelativeLayout f2 = Activity.FindViewById <RelativeLayout>(Resource.Id.fragment2);
            RelativeLayout f3 = Activity.FindViewById <RelativeLayout>(Resource.Id.fragment3);

            if (f2 != null && f3 != null)
            {
                DetailsFragment fragmentDetails = DetailsFragment.NewInstance((int)MainMenu.MenuItems.Items);
                var             ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.fragment2, fragmentDetails);
                ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                ft.Commit();

                ItemFragment fragmentItem = ItemFragment.NewInstance(0);
                ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.fragment3, fragmentItem);
                ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                ft.Commit();

                //fragmentInvoice.InvoiceSaved += new InvoiceInfoFragment.InvoiceSavedDelegate(fragmentDetails.InvoiceSaved);
            }
            else
            {
                DetailsFragment fragmentDetails = DetailsFragment.NewInstance((int)MainMenu.MenuItems.Items);
                var             ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.fragment1, fragmentDetails);
                ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
                ft.Commit();
            }

            /*if (isTablet)
             * {
             *  FrameLayout f = this.Activity.FindViewById<FrameLayout>(Resource.Id.details_fragment);
             *  f.Visibility = ViewStates.Visible;
             *
             *  var ft = FragmentManager.BeginTransaction();
             *  ft.Replace(Resource.Id.details_fragment, DetailsFragment.NewInstance((int)MainMenu.MenuItems.Items));
             *  ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
             *  ft.Commit();
             *
             *  ft = FragmentManager.BeginTransaction();
             *  ft.Replace(Resource.Id.detailInfo_fragment, ItemFragment.NewInstance(0));
             *  ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
             *  ft.Commit();
             *
             *  this.Activity.FindViewById<FrameLayout>(Resource.Id.details_fragment).Visibility = ViewStates.Visible;
             *  this.Activity.FindViewById<LinearLayout>(Resource.Id.layoutDetails).Visibility = ViewStates.Visible;
             *  this.Activity.FindViewById<LinearLayout>(Resource.Id.layoutList).Visibility = ViewStates.Visible;
             *
             *  if (isPopupMenu)
             *  {
             *      this.Activity.FindViewById<RelativeLayout>(Resource.Id.popup_mainmenu_inner).Visibility = ViewStates.Gone;
             *  }
             * }
             * else
             * {
             *  DetailsFragment details = DetailsFragment.NewInstance((int)MainMenu.MenuItems.Items);
             *  var ft = FragmentManager.BeginTransaction();
             *  ft.Replace(Resource.Id.content_phone_fragment, details);
             *  ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
             *  ft.Commit();
             * }*/
        }