protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			ArrayAdapter<string> ad = new ArrayAdapter<string> (ActionBar.ThemedContext, Android.Resource.Layout.SimpleListItem1, listContent);
			DrawerLayout drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
			ListView list = FindViewById<ListView> (Resource.Id.drawer);
			list.SetAdapter (ad);

			transaction = SupportFragmentManager.BeginTransaction ();
			transaction.Add (Resource.Id.main,fragments [0]);
			transaction.Commit ();

			list.ItemClick += (sender, e) => {
				var item = sender as ListView;
				var position = item.CheckedItemPosition;
				transaction = SupportFragmentManager.BeginTransaction();
				transaction.Replace(Resource.Id.main,fragments[position]);
				transaction.Commit();
				drawer.CloseDrawer(item);
			};
		}
Beispiel #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.qs_root_fragment, container, false);

            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();

            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());

            trans.Commit();

            return(view);
        }
Beispiel #3
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     if (item.ItemId == Resource.Id.addPeople)
     {
         var newFragment = new ContactListFragment();
         Android.Support.V4.App.FragmentTransaction transaction = Activity.SupportFragmentManager.BeginTransaction();
         transaction.Replace(Resource.Id.content_frame, newFragment);
         transaction.AddToBackStack(null);
         transaction.Commit();
     }
     return(base.OnOptionsItemSelected(item));
 }
Beispiel #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V4.App.FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();
            var fragment = new FloatingActionButtonBasicFragment();

            transaction.Replace(Resource.Id.sample_content_fragment, fragment);
            transaction.Commit();
        }
        private void Cancel_Product(object sender, EventArgs e, Activity currentActivity)
        {
            btn_prd_cancel.Click -= (sndr, argus) => Cancel_Product(sndr, argus, currentActivity);

            try
            {
                currentActivity.RunOnUiThread(() =>
                {
                    Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(currentActivity);
                    alertDiag.SetTitle(Resource.String.DialogHeaderGeneric);
                    alertDiag.SetMessage("Are you sure you want to cancel?");
                    alertDiag.SetIcon(Resource.Drawable.alert);
                    alertDiag.SetPositiveButton(Resource.String.DialogButtonYes, (senderAlert, args) =>
                    {
                        var siteparam = new List <ItemPayloadModelWithBase64>();
                        siteparam.Add(objSelectedItem.FirstOrDefault());
                        Bundle utilBundle = new Bundle();
                        utilBundle.PutString("siteparam", Newtonsoft.Json.JsonConvert.SerializeObject(siteparam));
                        AddActivityFragment objFragment = new AddActivityFragment();
                        objFragment.Arguments           = utilBundle;
                        Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction();
                        tx.Replace(Resource.Id.m_main, objFragment, Constants.dashboard);
                        tx.Commit();
                    });
                    alertDiag.SetNegativeButton(Resource.String.DialogButtonNo, (senderAlert, args) =>
                    {
                        //btn_prd_cancel.Click += (sndr, argus) => Cancel_Product(sndr, argus, currentActivity);
                    });
                    Dialog diag = alertDiag.Create();
                    diag.Show();
                    diag.SetCanceledOnTouchOutside(false);
                });
            }
            catch (Exception ex)
            {
                currentActivity.RunOnUiThread(() =>
                {
                    Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(currentActivity);
                    alertDiag.SetTitle(Resource.String.DialogHeaderError);
                    alertDiag.SetMessage(ex.Message);
                    alertDiag.SetIcon(Resource.Drawable.alert);
                    alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) =>
                    {
                        //btn_prd_cancel.Click += (sndr, argus) => Cancel_Product(sndr, argus, currentActivity);
                    });
                    Dialog diag = alertDiag.Create();
                    diag.Show();
                    diag.SetCanceledOnTouchOutside(false);
                });
            }
        }
Beispiel #6
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            v4.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            int?titleId = null;

            v4.Fragment fragment = null;

            if (id == Resource.Id.nav_camera)
            {
                // Handle the camera action
            }
            else if (id == Resource.Id.nav_gallery)
            {
                titleId  = Resource.String.gallery_title;
                fragment = new Fragment1();
            }
            else if (id == Resource.Id.nav_slideshow)
            {
            }
            else if (id == Resource.Id.nav_manage)
            {
                titleId  = Resource.String.manage_title;
                fragment = new Fragment2();
            }
            else if (id == Resource.Id.nav_share)
            {
            }
            else if (id == Resource.Id.nav_send)
            {
            }

            if (titleId != null)
            {
                SupportActionBar.SetTitle((int)titleId);
            }

            if (fragment != null)
            {
                ft.Replace(Resource.Id.fragment_container, fragment);
                ft.AddToBackStack(null);
                ft.Commit();
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Beispiel #7
0
        public override async void OnListItemClick(ListView listView, View view, int position, long id)
        {
            FileSystemInfo fileSystemInfo = fileListadapter.GetItem(position);

            if (fileSystemInfo.IsFile())
            {
                CustomProgressDialog progressDialog = new CustomProgressDialog();
                progressDialog.Show(Activity, "Bestand uploaden. Een ogenblik geduld a.u.b.");

                try {
                    //get current folder path to add file to
                    int    numberOfDirectoriesOpened   = ExplorerFragment.openedDirectories.Count;
                    string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1];

                    string fullDestinationPath = System.IO.Path.Combine(directoryNameToUploadFileTo, fileSystemInfo.Name);
                    bool   uploadedSucceeded   = await DataLayer.Instance.UploadFile(fullDestinationPath, fileSystemInfo.FullName);

                    if (!uploadedSucceeded)
                    {
                        Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                    }
                    else
                    {
                        Toast.MakeText(Activity, "Bestand succesvol geupload", ToastLength.Short).Show();

                        Activity.Finish();
                    }
                } catch (Exception ex) {
                    Insights.Report(ex);
                    Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                }
                progressDialog.Hide();
            }
            else
            {
                // Dig into this directory, and display it's contents
                Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                //fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

                FileListFragment fileListFragment = new FileListFragment(fileSystemInfo.FullName);
                fragmentTransaction.Replace(Resource.Id.fragment_container_filepicker, fileListFragment, "fileListFragment");

                //Add fragment to stack - needed for back button functionality
                fragmentTransaction.AddToBackStack(null);

                // Start the animated transition.
                fragmentTransaction.Commit();
            }
            base.OnListItemClick(listView, view, position, id);
        }
        protected override void OnCreate(Bundle bundle)
        {
            SetTheme (Resource.Style.Theme_Sherlock);
            base.OnCreate (bundle);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            list = FindViewById<ListView> (Resource.Id.list);
            drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
            adapter = new CustomAdapter (this, list_text);
            list.Adapter = adapter;
            fragA = new FragmentA ();
            fragB = new FragmentB ();
            list.ItemClick += (sender, e) => {
                ListView item = sender as ListView;
                int pos = item.CheckedItemPosition;
                TextView t = (TextView) e.View.FindViewById(Resource.Id.textView1);
                string mess = t.Text;
                Bundle args = new Bundle();
                args.PutString("message", mess);
                transaction = SupportFragmentManager.BeginTransaction();
                switch (pos){
                case 0:
                    if(!fragA.IsVisible){
                        fragA.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragA);
                    }
                    break;
                case 1:
                    if(!fragB.IsVisible){
                        fragB.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragB);
                    }
                    break;

                }
                transaction.Commit();
                list.SetItemChecked(pos, true);
                drawer.CloseDrawer(list);

            };

            mDrawerToggle = new Android.Support.V4.App.ActionBarDrawerToggle(this, drawer,  Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close)
            {
            };
            drawer.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetHomeButtonEnabled(true);
            // Get our button from the layout resource,
            // and attach an event to it
        }
Beispiel #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //TODO: NEW RESOURCE LAYOUT FOR CHECKLIST WITH A FRAGMENT CONTAINER

            SetContentView(Resource.Layout.client_checklist_activity);

            v4App.FragmentTransaction ft       = SupportFragmentManager.BeginTransaction();
            v4App.Fragment            fragment = new ClientCheckListInstructionView();

            ft.Replace(Resource.Id.fragment_container, fragment);
            ft.Commit();
        }
Beispiel #10
0
        private void SignUpDialog_mOnSignUpComplete(object sender, OnSignUpEventArgs e)
        {
            // Request(e);
            userName  = e.FirstName;
            userEmail = e.Email;

            SetContentView(Resource.Layout.MainScreen);
            Android.Support.V4.App.FragmentManager     fragmentManager = SupportFragmentManager;
            Android.Support.V4.App.FragmentTransaction transaction     = fragmentManager.BeginTransaction();
            SlidingTabFragment fragment = new SlidingTabFragment();

            transaction.Replace(Resource.Id.sample_content_fragment, fragment);
            transaction.Commit();
        }
Beispiel #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            //TODO PALITAN UNG LAYOUT
            SetContentView(Resource.Layout.frame_layout_main);

            Window.SetSoftInputMode(SoftInput.StateHidden);

            v4App.FragmentTransaction ft       = SupportFragmentManager.BeginTransaction();
            v4App.Fragment            fragment = new LoginView();

            ft.Replace(Resource.Id.fragment_container, fragment);
            ft.Commit();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.register_fragment_layout);

            Window.SetSoftInputMode(SoftInput.StateHidden);

            v4App.FragmentTransaction ft       = SupportFragmentManager.BeginTransaction();
            v4App.Fragment            fragment = new RegisterView(AccountType.Consultant);

            ft.Replace(Resource.Id.register_frame, fragment);
            ft.Commit();
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            row = convertView;

            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            var myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID       = myAttributes.cfid;

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.favoritecompanieslistview_row, null, false);
            }

            TextView     companyName = row.FindViewById <TextView>(Resource.Id.companyName);
            ImageView    companyLogo = row.FindViewById <ImageView>(Resource.Id.companyLogo);
            LinearLayout info        = row.FindViewById <LinearLayout>(Resource.Id.ll_info);

            companyName.Text = mCompanies[position];
            string fileName   = companyName.Text.ToLower().Replace(" ", "");
            int    resourceId = (int)typeof(Resource.Drawable).GetField(fileName).GetValue(null);

            companyLogo.SetImageResource(resourceId);

            info.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = ((FragmentActivity)mContext).SupportFragmentManager.BeginTransaction();

                CompanyInfoFragment fragment = new CompanyInfoFragment();

                Bundle arguments = new Bundle();

                arguments.PutInt("CompanyInt", mItems[position]);

                arguments.PutString("Sender", "Profile");

                fragment.Arguments = arguments;

                trans.Replace(Resource.Id.profile_root_frame, fragment);

                //trans.AddToBackStack(null);

                trans.Commit();
            };

            return(row);
        }
Beispiel #14
0
        private v4.Fragment LoadFragment(v4.Fragment fragment)
        {
            try
            {
                _fragmentTransaction = SupportFragmentManager.BeginTransaction();
                _fragmentTransaction.Replace(Resource.Id.fragments_container, fragment);
                //_fragmentTransaction.AddToBackStack(null);
                _fragmentTransaction.Commit();

                return(fragment);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #15
0
        void LoadFragment(int id)
        {
            switch (id)
            {
            case Resource.Id.menu_home:
                Fragment_Home fragPacketHome = new Fragment_Home();

                using (Android.Support.V4.App.FragmentTransaction fragmentTx = SupportFragmentManager.BeginTransaction())
                {
                    fragmentTx.Replace(Resource.Id.content, fragPacketHome);
                    fragmentTx.Commit();
                }
                break;

            case Resource.Id.menu_add:
                Fragment_AddFriends fragPacketAdd = new Fragment_AddFriends();

                using (Android.Support.V4.App.FragmentTransaction fragmentTx = SupportFragmentManager.BeginTransaction())
                {
                    fragmentTx.Replace(Resource.Id.content, fragPacketAdd);
                    fragmentTx.Commit();
                }
                break;

            case Resource.Id.menu_chat:
                Fragment_Chat fragPacketChat = new Fragment_Chat();

                using (Android.Support.V4.App.FragmentTransaction fragmentTx = SupportFragmentManager.BeginTransaction())
                {
                    fragmentTx.Replace(Resource.Id.content, fragPacketChat);
                    fragmentTx.Commit();
                }
                break;

            case Resource.Id.menu_profile:
                Fragment_Profile fragPacketProfile = new Fragment_Profile();
                fragPacketProfile.SetName(personController.GetUsername());
                using (Android.Support.V4.App.FragmentTransaction fragmentTx = SupportFragmentManager.BeginTransaction())
                {
                    fragmentTx.Replace(Resource.Id.content, fragPacketProfile);
                    fragmentTx.Commit();
                }
                break;
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_notification:
                Android.Support.V4.App.Fragment fragment = new NotificationFragment();
                var fragmentManager = Activity.SupportFragmentManager;
                Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
                fragmentTransaction.Replace(Resource.Id.content_frame, fragment);
                fragmentTransaction.AddToBackStack("HomeFragment");
                fragmentTransaction.Commit();
                return(true);

            case Resource.Id.action_search:
                Activity.StartActivity(typeof(SearchActivity));
                return(true);
            }
            return(false);
        }
Beispiel #17
0
        public void NavigateTo(Android.Support.V4.App.Fragment newFragment)
        {
            try
            {
                Android.Support.V4.App.FragmentManager     mFragmentManager     = null;
                Android.Support.V4.App.FragmentTransaction mFragmentTransaction = null;

                _currentFragment     = newFragment;
                mFragmentManager     = SupportFragmentManager;
                mFragmentTransaction = mFragmentManager.BeginTransaction();
                mFragmentTransaction.Replace(Resource.Id.frame, _currentFragment);
                mFragmentTransaction.SetTransition((int)FragmentTransit.FragmentFade);
                mFragmentTransaction.CommitAllowingStateLoss();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #18
0
        public bool SetNavigationItem(int id)
        {
            v4App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            (int?titleId, v4App.Fragment fragment) = navMap.GetNavItem(id);

            if (titleId != null)
            {
                SupportActionBar.SetTitle((int)titleId);
            }

            if (fragment != null)
            {
                ft.Replace(Resource.Id.fragment_container, fragment);
                ft.Commit();
            }

            CloseNavDrawer();
            return(true);
        }
        //define action for tolbar icon press
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_ok:
                Toast.MakeText(this, "Ahora cree una nueva clave", ToastLength.Short).Show();

                ft2 = fm.BeginTransaction();
                ft2.Replace(Resource.Id.cambio_clave_container, new FragmentClaveNueva());
                ft2.Commit();
                return(true);

            case Android.Resource.Id.Home:
                Finish();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Beispiel #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            DAO             = new MarketplaceDatabase().DAO;
            DAO.UserChange += NavigationViewUserChanged;
            DAO.UserChange += PagerFragmentUserChanged;

            SetContentView(Resource.Layout.activity_main);

            toolbar = FindViewById <v7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Marketplace";
            SupportActionBar.SetHomeButtonEnabled(true);

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.navigationDrawerLayout);
            toggle       = new v7Toggle(this, drawerLayout, toolbar, Resource.String.open, Resource.String.close);
            drawerLayout.AddDrawerListener(toggle);
            toggle.SyncState();

            navigationView = FindViewById <NavigationView>(Resource.Id.navigationNavigationView);
            navigationView.SetNavigationItemSelectedListener(this);

            SupportFragmentManager.AddOnBackStackChangedListener(this);
            toolbar.NavigationClick += (sender, e) => OnNavigationClick();

            var dialog = new CallToAutorisationDialogFragment();

            dialog.DialogResultHandler += CallToRegisterDialogFinish;
            dialog.Show(SupportFragmentManager, "MainActivity");

            var pagerFragment = new PagerFragment(DAO);
            v4FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.mainFrameLayout, pagerFragment);
            fragmentTransaction.Commit();
        }
Beispiel #21
0
        private void CallTextFragment(string title, string text)
        {
            var textFragment = new TextFragment(title, text);
            v4FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.mainFrameLayout, textFragment);

            bool qwerty = SupportFragmentManager.PopBackStackImmediate("TextFragment", 0) ||
                          (SupportFragmentManager.FindFragmentByTag("TextFragment") == null);

            if (qwerty)
            {
                Log.Info(tag, "true");
                SupportFragmentManager.PopBackStack();
                fragmentTransaction.AddToBackStack("TextFragment");
            }
            else
            {
                Log.Info(tag, "false");
                fragmentTransaction.AddToBackStack("TextFragment");
            }

            fragmentTransaction.Commit();
        }
                public bool OnMenuItemClick(IMenuItem item)
                {
                    if (item.ItemId == Resource.Id.popup_Add_CoHost)
                    {
                        Android.Support.V4.App.Fragment fragment = new AddCoHostFragment();
                        var fragmentManager = activity.SupportFragmentManager;
                        Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
                        fragmentTransaction.Replace(Resource.Id.content_frame, fragment);
                        MainActivity.myBundle.PutLong("EventID", eventID);
                        fragmentTransaction.AddToBackStack("AddCoHostFragment");
                        fragmentTransaction.Commit();
                        return(true);
                    }

                    if (item.ItemId == Resource.Id.popup_Add_EventPhoto)
                    {
                        Intent intent = new Intent(activity, typeof(UploadEventProfilePic));
                        intent.PutExtra("strCapture", eventID);
                        intent.PutExtra("strCreatorId", creatorId);
                        activity.StartActivity(intent);
                        return(true);
                    }
                    return(false);
                }
Beispiel #23
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            row = convertView;

            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            var myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID       = myAttributes.cfid;

            string dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
            var    db_login     = new SQLiteConnection(dbPath_login);

            var        loginQueryResults = db_login.Query <LoginTable>("SELECT * FROM LoginTable WHERE email = ?", myAttributes.email);
            LoginTable myLogInInfo       = loginQueryResults.First();

            string favoritesFileName = "fav_" + myCFID.ToString() + "_" + myLogInInfo.id.ToString() + ".db3";
            string dbPath_favorites  = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), favoritesFileName);
            var    db_favorites      = new SQLiteConnection(dbPath_favorites);

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.companieslistview_row, null, false);
            }

            string fileName_companies = myCFID.ToString() + ".db3";
            string dbPath_companies   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_companies);
            var    db_companies       = new SQLiteConnection(dbPath_companies);

            int companyId = db_companies.Query <Companies>("SELECT * FROM Companies WHERE name = ?", mItems[position]).First().id;

            TextView     companyName = row.FindViewById <TextView>(Resource.Id.companyName);
            ImageView    companyLogo = row.FindViewById <ImageView>(Resource.Id.companyLogo);
            LinearLayout companyInfo = row.FindViewById <LinearLayout>(Resource.Id.companyInfo);
            LinearLayout favorite    = row.FindViewById <LinearLayout>(Resource.Id.favorite);
            LinearLayout q_ll        = row.FindViewById <LinearLayout>(Resource.Id.q_ll);
            ImageView    star        = row.FindViewById <ImageView>(Resource.Id.star);

            q_ll.Enabled = false;

            companyName.Text = mItems[position];
            string fileName   = companyName.Text.ToLower().Replace(" ", "");
            int    resourceId = (int)typeof(Resource.Drawable).GetField(fileName).GetValue(null);

            companyLogo.SetImageResource(resourceId);

            bool isFavorite = db_favorites.Get <SQLite_Tables.MyFavorites>(companyId).isFavorite;

            if (isFavorite == true)
            {
                star.SetImageResource(Resource.Drawable.starfilled);
            }
            else if (isFavorite == false)
            {
                star.SetImageResource(Resource.Drawable.starunfilled);
            }

            favorite.Click += (sender, e) =>
            {
                //bool isFavorite = db_favorites.Get<SQLite_Tables.MyFavorites>(position + 1).isFavorite;
                if (isFavorite == true)
                {
                    SQLite_Tables.MyFavorites newIsFavorite = new SQLite_Tables.MyFavorites();
                    newIsFavorite.id         = companyId;
                    newIsFavorite.isFavorite = false;
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    isFavorite = false;
                    db_favorites.Update(newIsFavorite);
                }
                else if (isFavorite == false)
                {
                    SQLite_Tables.MyFavorites newIsFavorite = new SQLite_Tables.MyFavorites();
                    newIsFavorite.id         = companyId;
                    newIsFavorite.isFavorite = true;
                    star.SetImageResource(Resource.Drawable.starfilled);
                    isFavorite = true;
                    db_favorites.Update(newIsFavorite);
                }
            };

            companyInfo.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = ((FragmentActivity)mContext).SupportFragmentManager.BeginTransaction();

                CompanyInfoFragment fragment = new CompanyInfoFragment();

                Bundle arguments = new Bundle();

                arguments.PutInt("CompanyInt", companyId);

                if (mSender == "CurrentQs")
                {
                    arguments.PutString("Sender", "CurrentQs");
                }
                else if (mSender == "PastQs")
                {
                    arguments.PutString("Sender", "PastQs");
                }
                fragment.Arguments = arguments;
                trans.Replace(Resource.Id.qs_root_frame, fragment);

                //trans.AddToBackStack(null);

                trans.Commit();
            };

            return(row);
        }
        async void ListView_OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ResetUIToBeginState(false);


            SslValidator.CertificateErrorRaised = false;

            //Set selected local box
            Waardes.Instance.GeselecteerdeBox = foundLocalBoxes[e.Position].Id;

            //Reset certificate validation check to default behavior

            /*
             * ServicePointManager.ServerCertificateValidationCallback = null;
             *
             * if (foundLocalBoxes[e.Position].OriginalSslCertificate != null) { //Selected localbox does have a ssl certificate
             *      //Set ssl validator for selected LocalBox
             *      SslValidator sslValidator = new SslValidator ();
             *      ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
             * }*/

            //Change action bar color to color of selected localbox
            if (DataLayer.Instance.GetSelectedOrDefaultBox().BackColor != null &&
                DataLayer.Instance.GetSelectedOrDefaultBox().BackColor.StartsWith("#"))
            {
                HomeActivity.colorOfSelectedLocalBox = DataLayer.Instance.GetSelectedOrDefaultBox().BackColor;
            }
            else
            {
                HomeActivity.colorOfSelectedLocalBox = Constants.lightblue;
            }
            SetCustomActionBarColor();

            //Change logo image to logo of selected local box
            if (DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl != null)
            {
                string logoUrl = DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl;

                string documentsPath = DocumentConstants.DocumentsPath;
                string pathToLogo    = System.IO.Path.Combine(documentsPath, logoUrl.Substring(logoUrl.LastIndexOf("/") + 1));

                if (File.Exists(pathToLogo))
                {                 //Verander logo
                    Android.Net.Uri uriLogo = Android.Net.Uri.Parse(pathToLogo);
                    //imageViewLogo.SetImageURI (uriLogo);
                }
                else                 //Default logo
                {
                    //imageViewLogo.SetImageResource (Resource.Drawable.beeldmerk_belastingdienst);
                }
            }

            //Update fragment data
            Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
            fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

            //Show progress dialog while loading
            ShowProgressDialog(Activity, null);

            try {
                HomeActivity homeActivity = (HomeActivity)Activity;

                ExplorerFragment explorerFragment = new ExplorerFragment(await DataLayer.Instance.GetFolder("/"), homeActivity);

                HomeActivity.openedExplorerFragments = new List <ExplorerFragment>();
                HomeActivity.openedExplorerFragments.Add(explorerFragment);

                //Add new directory to opened directories list
                ExplorerFragment.openedDirectories = new List <string>();
                ExplorerFragment.openedDirectories.Add("/");

                fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                //Clear fragment back stack
                int entryCount = Activity.SupportFragmentManager.BackStackEntryCount;

                while (entryCount > 0)
                {
                    Activity.SupportFragmentManager.PopBackStackImmediate();
                    entryCount = Activity.SupportFragmentManager.BackStackEntryCount;
                }

                //Add fragment to stack - needed for back button functionality
                fragmentTransaction.AddToBackStack(null);

                // Start the animated transition.
                fragmentTransaction.Commit();

                //Show hidden buttons
                RelativeLayout fragmentContainerExplorerBottom = Activity.FindViewById <RelativeLayout> (Resource.Id.fragment_container_explorer_blank);
                fragmentContainerExplorerBottom.Visibility = ViewStates.Visible;

                //Show shadow
                View shadowContainerExplorer = Activity.FindViewById <View> (Resource.Id.shadow_container_explorer);
                shadowContainerExplorer.Visibility = ViewStates.Visible;

                //Hide back button
                ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                buttonBackExplorer.Visibility = ViewStates.Invisible;

                HideProgressDialog();
            }
            catch (Exception ex) {
                Insights.Report(ex);
                HideProgressDialog();
                Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
            }
        }
Beispiel #25
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            row = convertView;

            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            var myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID       = myAttributes.cfid;

            int companyId = mCompanyIds[position];

            favoritesFileName = "fav_" + myCFID.ToString() + "_" + myAttributes.typeid.ToString();

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.companieslistview_row, null, false);
            }

            TextView     companyName  = row.FindViewById <TextView>(Resource.Id.companyName);
            ImageView    companyLogo  = row.FindViewById <ImageView>(Resource.Id.companyLogo);
            LinearLayout companyInfo  = row.FindViewById <LinearLayout>(Resource.Id.companyInfo);
            LinearLayout favorite     = row.FindViewById <LinearLayout>(Resource.Id.favorite);
            LinearLayout q_ll         = row.FindViewById <LinearLayout>(Resource.Id.q_ll);
            ImageView    star         = row.FindViewById <ImageView>(Resource.Id.star);
            TextView     timeText     = row.FindViewById <TextView>(Resource.Id.timeText);
            TextView     positionText = row.FindViewById <TextView>(Resource.Id.positionText);

            q_ll.Enabled = false;

            if (mSender == "CurrentQs")
            {
                timeText.Text     = mTimes[position];
                positionText.Text = mPositions[position];
            }
            else if (mSender == "PastQs")
            {
                timeText.Visibility     = ViewStates.Invisible;
                positionText.Visibility = ViewStates.Invisible;
            }

            companyName.Text = mItems[position];
            string fileName   = companyName.Text.ToLower().Replace(" ", "");
            int    resourceId = (int)typeof(Resource.Drawable).GetField(fileName).GetValue(null);

            companyLogo.SetImageResource(resourceId);

            isFavorite = mFavs[position];

            if (isFavorite == true)
            {
                star.SetImageResource(Resource.Drawable.starfilled);
            }
            else if (isFavorite == false)
            {
                star.SetImageResource(Resource.Drawable.starunfilled);
            }

            favorite.Click += (sender, e) =>
            {
                bool thisFavorite = mFavs[position];
                if (thisFavorite == true)
                {
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    bool newFavorite = false;
                    mFavs[position] = false;
                    UpdateIsFavorite(newFavorite, companyId);
                }
                else if (thisFavorite == false)
                {
                    star.SetImageResource(Resource.Drawable.starfilled);
                    bool newFavorite = true;
                    mFavs[position] = true;
                    UpdateIsFavorite(newFavorite, companyId);
                }
            };

            companyInfo.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = ((FragmentActivity)mContext).SupportFragmentManager.BeginTransaction();

                CompanyInfoFragment fragment = new CompanyInfoFragment();

                Bundle arguments = new Bundle();

                arguments.PutInt("CompanyInt", companyId);

                if (mSender == "CurrentQs")
                {
                    arguments.PutString("Sender", "CurrentQs");
                }
                else if (mSender == "PastQs")
                {
                    arguments.PutString("Sender", "PastQs");
                }
                fragment.Arguments = arguments;
                trans.Replace(Resource.Id.qs_root_frame, fragment);
                trans.Commit();
            };

            return(row);
        }
Beispiel #26
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.Qrow, null, false);
            }

            string           dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
            SQLiteConnection db_login     = new SQLiteConnection(dbPath_login);

            string           dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes     myAttributes      = db_attributes.Get <MyAttributes>(1);

            string           fileName_pastQs = "pastqs_" + myAttributes.attribute1 + ".db3";
            string           dbPath_pastQs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_pastQs);
            SQLiteConnection db_pastQs       = new SQLiteConnection(dbPath_pastQs);

            SQLite_Tables.PastQueue thisQueue = db_pastQs.Query <SQLite_Tables.PastQueue>("SELECT * FROM PastQueue WHERE studentid = ?", mItems[position]).First();

            StudentTable thisStudent = db_login.Get <StudentTable>(mItems[position]);

            TextView     candidateName = row.FindViewById <TextView>(Resource.Id.candidateName);
            ImageView    favorite      = row.FindViewById <ImageView>(Resource.Id.favorite);
            LinearLayout candidateRow  = row.FindViewById <LinearLayout>(Resource.Id.candidateRow);

            candidateName.Text = thisStudent.name;

            if (thisQueue.rating == 1)
            {
                favorite.SetImageResource(Resource.Drawable.starfilled);
            }

            else if (thisQueue.rating == 2)
            {
                favorite.SetImageResource(Resource.Drawable.heartfilled);
            }

            candidateRow.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = ((FragmentActivity)mContext).SupportFragmentManager.BeginTransaction();
                Bundle arguments = new Bundle();
                arguments.PutInt("StudentId", mItems[position]);

                arguments.PutString("Sender", mSender);

                Fragments.PastQStudentProfileView fragment = new Fragments.PastQStudentProfileView();
                fragment.Arguments = arguments;

                if (mSender == "Profile")
                {
                    trans.Replace(Resource.Id.profile_root_frame, fragment);
                }
                else if (mSender == "PastQs")
                {
                    trans.Replace(Resource.Id.qs_root_frame, fragment);
                }
                trans.Commit();
            };
            return(row);
        }
        private void SelectLibrary(Library library)
        {
            if (IsFinishing)
            {
                return;
            }

            App.STATE.CurrentLibrary = library;
            string tag = Enum.GetName(typeof(Library), library);

            FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();

            transaction.SetTransition((int)FragmentTransit.FragmentFade);
            Fragment fragment = SupportFragmentManager.FindFragmentByTag(tag);

            if (App.STATE.CanTranslate())
            {
                if (fragment == null)
                {
                    if (App.STATE.CurrentLibrary == Library.DailyText)
                    {
                        string date = App.FUNCTIONS.FormatDateTime(DateTime.Now);

                        fragment = new ArticleFragment(NavStruct.Parse(date), library);
                        fragment.RetainInstance = true;
                    }
                    //else if (App.STATE.CurrentLibrary == Library.Insight)
                    //{
                    //    fragment = new InsightLibraryFragment();
                    //    fragment.RetainInstance = true;
                    //}
                    else
                    {
                        fragment = new LibraryFragment();
                        fragment.RetainInstance = true;
                    }

                    if (SelectedFragment != null)
                    {
                        transaction.Detach(SelectedFragment);
                    }
                    transaction.Add(Resource.Id.content_frame, fragment, tag);
                    transaction.Commit();
                }
                else
                {
                    transaction.Detach(SelectedFragment);
                    transaction.Attach(fragment);
                    transaction.Commit();
                }

                SelectedFragment = fragment;

                int index = App.STATE.Libraries.IndexOf(library);
                list.SetItemChecked(index, true);
                list.SetSelection(index);

                drawer.CloseDrawer(list);
            }
            else
            {
                // Temporary HACK
                SupportFragmentManager.PopBackStack(null, (int)PopBackStackFlags.Inclusive);

                SelectedFragment = null;
                transaction.Replace(Resource.Id.content_frame, new Fragment()).Commit();
                RunOnUiThread(() =>
                {
                    list.Adapter = null;
                });
            }

            Console.WriteLine("Current LibraryMode is " + App.STATE.CurrentLibrary.ToString());
        }
Beispiel #28
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_contact_list, container, false);

            try
            {
                _contactListView = view.FindViewById <Android.Widget.ListView>(Resource.Id.contact_list);

                searchText = view.FindViewById <EditText>(Resource.Id.contact_list_searchview);

                _noEntryText = view.FindViewById <TextView>(Resource.Id.no_friends_textview);
                _noEntryText.TextFormatted = Html.FromHtml("To add friends you can type their name in the search bar and if they have enabled </br>\"Public Name\" they will appear here");

                searchText.TextChanged += (s, e) =>
                {
                    _adapter.Collection.SetSearch(searchText.Text);
                };

                _adapter = new FindFriendAdapter(this.Activity, _noEntryText, new UIHelper.FindContactObservableCollection(ChadderApp.UIHelper.Source));
                _contactListView.Adapter    = _adapter;
                _contactListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    var contact = _adapter[e.Position];
                    if (contact == null)
                    {
                        return;
                    }
                    if (contact.IsTemporary)
                    {
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                    else
                    {
                        SupportFragmentManager.PopBackStack();
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ChatFragment.OpenChat(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                };

                _menuManager = new ContextMenuManager <ChadderContact>(this, _contactListView);

                _menuManager.InsertItem("View profile", (ChadderContact contact) =>
                {
                    Android.Support.V4.App.FragmentTransaction transaction = this.Activity.SupportFragmentManager.BeginTransaction();
                    transaction.Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact));
                    transaction.AddToBackStack(null);
                    transaction.Commit();
                });

                _menuManager.InsertItem(c => c.Type == Chadder.Data.RelationshipType.BLOCKED ? "Unblock" : "Block",
                                        (ChadderContact contact) => ChadderUI.ToggleBlock(contact));

                _menuManager.InsertItem("Report",
                                        (ChadderContact contact) => ChadderUI.ReportContact(contact));
            }
            catch (Exception e)
            {
                Insight.Report(e);
            }

            return(view);
        }
 public void OnTabSelected(Android.Support.V7.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
 {
     Android.Support.V4.App.Fragment frag = _fragments[tab.Position];
     ft.Replace(Resource.Id.frameLayout1, frag);
 }
        async void ListView_OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            try {
                TreeNode clickedItem = foundTreeNodeChildren [e.Position];

                //Hide bottom menu for favorite file

                if (favoriteFolderOpened)
                {
                    parentActivity.HideBottomExplorerMenuItems();
                }
                else
                {
                    parentActivity.ShowBottomExplorerMenuItems();
                }

                //Show progress dialog while loading
                parentActivity.ShowProgressDialog(null);


                if (clickedItem.IsDirectory == true)                  //Folder aangeklikt (NIET "Lokale favorieten")
                {
                    Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                    fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                    ExplorerFragment explorerFragment = new ExplorerFragment(await DataLayer.Instance.GetFolder(clickedItem.Path), parentActivity);
                    HomeActivity.openedExplorerFragments.Add(explorerFragment);
                    fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                    //Add new directory to opened directories list
                    ExplorerFragment.openedDirectories.Add(clickedItem.Path);

                    //Used to determine custom context menu
                    if (ExplorerFragment.openedDirectories.Count == 2)
                    {
                        if (clickedItem.IsShare)
                        {
                            openedFolderIsShare = true;
                        }
                        else
                        {
                            openedFolderIsShare = false;
                        }
                    }

                    //Used to determine upload action and icon in listview item (encrypted or unencrypted folder)
                    if (ExplorerFragment.openedDirectories.Count == 2)
                    {
                        if (clickedItem.HasKeys)
                        {
                            openedFolderIsUnencrypted = false;
                        }
                        else
                        {
                            openedFolderIsUnencrypted = true;
                        }
                    }

                    //Add fragment to stack - needed for back button functionality
                    fragmentTransaction.AddToBackStack(null);

                    // Start the animated transition.
                    fragmentTransaction.Commit();

                    //Show hidden buttons
                    ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                    buttonBackExplorer.Visibility = ViewStates.Visible;
                }
                else if (clickedItem.Type.Equals("favorite"))                   //List item "Lokale favorieten" aangeklikt
                {
                    //Hide bottom menu for favorite folder
                    parentActivity.HideBottomExplorerMenuItems();

                    Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                    fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                    List <TreeNode> favorites = DataLayer.Instance.GetFavorites();

                    ExplorerFragment explorerFragment = new ExplorerFragment(favorites, parentActivity);
                    HomeActivity.openedExplorerFragments.Add(explorerFragment);
                    fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                    //Add new directory to opened directories list
                    ExplorerFragment.openedDirectories.Add(clickedItem.Path);

                    //Add fragment to stack - needed for back button functionality
                    fragmentTransaction.AddToBackStack(null);

                    // Start the animated transition.
                    fragmentTransaction.Commit();

                    //Show hidden buttons
                    ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                    buttonBackExplorer.Visibility = ViewStates.Visible;
                }
                else                    //Bestand aangeklikt
                //Afbeeldingen openen in webview - andere typen bestanden openen middels content provider

                {
                    string mimeTypeOfClickedItem = MimeTypeHelper.GetMimeType(clickedItem.Path);
                    clickedItem.Type = mimeTypeOfClickedItem;

                    if (mimeTypeOfClickedItem.Equals("image/jpeg") ||
                        mimeTypeOfClickedItem.Equals("image/png") ||
                        mimeTypeOfClickedItem.Equals("application/pdf") ||
                        mimeTypeOfClickedItem.Equals("application/vnd.oasis.opendocument.text") ||
                        mimeTypeOfClickedItem.Equals("text/html"))
                    {
                        lastShownTreeNodeId = clickedItem.Id;

                        Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                        fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                        DocumentFragment documentFragment = new DocumentFragment(await DataLayer.Instance.GetFilePath(clickedItem.Path), clickedItem.Name);
                        fragmentTransaction.Replace(Resource.Id.fragment_container_document, documentFragment, "documentFragment");

                        // Start the animated transition.
                        fragmentTransaction.Commit();
                    }
                    else if (mimeTypeOfClickedItem.Equals("video/mp4"))
                    {
                        var    videoPlayerActivity = new Intent(Activity, typeof(VideoPlayerActivity));
                        string pathToVideo         = await DataLayer.Instance.GetFilePath(clickedItem.Path);

                        videoPlayerActivity.PutExtra("PathToVideo", pathToVideo);

                        StartActivity(videoPlayerActivity);
                    }

                    //Disabled - reason: no license for PDFTron

                    /*else if(mimeTypeOfClickedItem.Equals("application/pdf")){
                     *
                     *      var pdfIntent = new Intent (Activity, typeof(PdfActivity));
                     *
                     *      string absolutePathOfPDF = await DataLayer.Instance.GetFilePath (clickedItem.Path);
                     *      pdfIntent.PutExtra ("absolutePathOfPDF", absolutePathOfPDF);
                     *      pdfIntent.PutExtra ("relativePathOfPDF", clickedItem.Path);
                     *      pdfIntent.PutExtra ("fileName", clickedItem.Name);
                     *
                     *      StartActivity (pdfIntent);
                     * }*/

                    else
                    {
                        //Open bestand in andere app
                        OpenFileIn(clickedItem);
                    }
                }
            } catch (Exception ex) {
                Insights.Report(ex);
                parentActivity.HideProgressDialog();
                Toast.MakeText(Activity, "Het openen is mislukt. Probeer het a.u.b. opnieuw", ToastLength.Short).Show();
            }
            parentActivity.HideProgressDialog();
        }
        private void SaveProduct(ProgressDialog dialog, Activity curActivity, CommonModuleResponse obj)
        {
            try
            {
                string mStringLoginInfo    = string.Empty;
                string mStringSessionToken = string.Empty;
                try
                {
                    objdb = new DBaseOperations();
                    var lstu = objdb.selectTable();
                    if (lstu != null && lstu.Count > default(int))
                    {
                        var uobj = lstu.FirstOrDefault();
                        if (uobj.Password == " ")
                        {
                            throw new Exception("Please login again");
                        }
                        mStringLoginInfo    = uobj.EmailId;
                        mStringSessionToken = uobj.AuthToken;
                    }
                }
                catch { }

                //var x = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                var client  = new RestClient(Common.UrlBase);
                var request = new RestRequest("Product/CreateSubCategory", Method.POST);
                request.AddHeader("Content-Type", "application/json");
                request.AddHeader("TokenKey", mStringSessionToken);
                //request.AddJsonBody(obj);
                request.AddParameter(new Parameter {
                    Name = "application/json", Type = ParameterType.RequestBody, Value = Newtonsoft.Json.JsonConvert.SerializeObject(obj, new NoColonIsoDateTimeConverter())
                });
                IRestResponse response    = client.Execute(request);
                var           content     = response.Content;
                var           responseObj = Newtonsoft.Json.JsonConvert.DeserializeObject <CommonModuleResponse>(content);
                if (responseObj != null && responseObj.productdata != null && !string.IsNullOrEmpty(responseObj.productdata.ProductId))
                {
                    curActivity.RunOnUiThread(() =>
                    {
                        Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(curActivity);
                        alertDiag.SetTitle(Resource.String.DialogHeaderGeneric);
                        alertDiag.SetMessage(string.Format("Your product '{0}' has been saved successfully", obj.productdata.ProductName));
                        alertDiag.SetIcon(Resource.Drawable.success);
                        alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) =>
                        {
                            var siteparam = new List <ItemPayloadModelWithBase64>();
                            siteparam.Add(objSelectedItem.FirstOrDefault());
                            Bundle utilBundle = new Bundle();
                            utilBundle.PutString("siteparam", Newtonsoft.Json.JsonConvert.SerializeObject(siteparam));
                            AddActivityFragment objFragment = new AddActivityFragment();
                            objFragment.Arguments           = utilBundle;
                            Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction();
                            tx.Replace(Resource.Id.m_main, objFragment, Constants.dashboard);
                            tx.Commit();
                        });
                        Dialog diag = alertDiag.Create();
                        diag.Show();
                        diag.SetCanceledOnTouchOutside(false);
                    });
                }
                else
                {
                    if (responseObj != null && !string.IsNullOrEmpty(responseObj.Error))
                    {
                        throw new Exception(responseObj.Error);
                    }
                    else
                    {
                        throw new Exception("Unable to save product right now. Please try again later");
                    }
                }
            }
            catch (Exception ex)
            {
                curActivity.RunOnUiThread(() =>
                {
                    Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(curActivity);
                    alertDiag.SetTitle(Resource.String.DialogHeaderError);
                    alertDiag.SetMessage(ex.Message);
                    alertDiag.SetIcon(Resource.Drawable.alert);
                    alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) =>
                    {
                    });
                    Dialog diag = alertDiag.Create();
                    diag.Show();
                    diag.SetCanceledOnTouchOutside(false);
                });
            }
            finally
            {
                if (dialog != null && dialog.IsShowing)
                {
                    dialog.Hide();
                    dialog.Dismiss();
                }
            }
        }