Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            model = new MenuPDVsModel
            {
                modelGeneric = modelActivity
            };
            SetContentView(Resource.Layout.menu_pdvs);

            var layoutManager = new GridLayoutManager(this, 1, LinearLayoutManager.Vertical, false);

            model.camera        = new Camera(ApplicationContext);
            model.msg           = FindViewById <RelativeLayout>(Resource.Id.linearMessageListPDV);
            model.userName      = FindViewById <TextView>(Resource.Id.txtUserName);
            model.txtMetaDiaria = FindViewById <TextView>(Resource.Id.txtMetaDiaria);
            model.cardList      = FindViewById <RecyclerView>(Resource.Id.card_list_pdv);
            model.cardList.SetLayoutManager(layoutManager);
            model.cardList.HasFixedSize = false;
            model.profileAvatar         = FindViewById <CircleImageView>(Resource.Id.profile_image_pdv);
            model.barMetaDiaria         = FindViewById <ProgressBar>(Resource.Id.pBarMetaDiaria);
            model.progressBar           = FindViewById <ProgressBar>(Resource.Id.progressPDV);
            model.pdvs          = new List <CardMenuPDVsModel>();
            model.adapter       = new MapMenuPDVsAdapter();
            model.dbPdvs        = new MenuPdvsDA(SQLite_Android.DB.dataBase);
            model.infoUsuario   = model.dbPdvs.GetUserInfoLogged();
            model.userName.Text = model.infoUsuario[0].NOME;
            model.cardList.SetAdapter(model.adapter);
            if (model.infoUsuario[0].AVATAR != null)
            {
                model.profileAvatar.SetImageBitmap(model.camera.GetBitMap(model.infoUsuario[0].AVATAR));
            }
            controller = new MenuPdvsCon(model);
            HockeyApp.Android.CrashManager.Register(this, "1a94f1b2048b497e815bd97f36cbc3e9", new HockeyCrashManagerSettings(model.infoUsuario[0].ID, model.infoUsuario[0].SERVIDOR));
            PopulateProgressBar();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var modelGeneric = new GenericModel
            {
                dbGenericActivity = new GenericActDA(Sqlite_IOS.DB.dataBase)
            };

            genController = new GenericCon(modelGeneric);
            modelPCL      = new MenuPdvsModel
            {
                dbGenericActivity = new GenericActDA(Sqlite_IOS.DB.dataBase),
                dbPdvs            = new MenuPdvsDA(Sqlite_IOS.DB.dataBase)
            };
            modelPCL.infoUsuario = modelPCL.dbPdvs.GetUserInfoLogged();
            controllerPCL        = new MenuPdvsCon(modelPCL);

            var userInfo = modelPCL.dbPdvs.GetUserInfoLogged();

            nomeUsuario.Text   = userInfo[0].NOME;
            cargoPromotor.Text = userInfo[0].CARGO;
            if (userInfo[0].AVATAR != null)
            {
                profileAvatar.SetImage(GetBitMap(userInfo[0].AVATAR), UIControlState.Normal);
            }
            profileAvatar.Layer.CornerRadius    = profileAvatar.Frame.Size.Width / 2;
            profileAvatar.Layer.BorderWidth     = 1.0f;
            profileAvatar.Layer.BorderColor     = UIColor.White.CGColor;
            profileAvatar.ClipsToBounds         = true;
            profileAvatar.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill;

            profileAvatar.TouchDown -= ClickCamera();
            profileAvatar.TouchDown += ClickCamera();

            tabBarMenuPdvs.ItemSelected -= ClickTabBar();
            tabBarMenuPdvs.ItemSelected += ClickTabBar();

            headerView.Layer.ShadowColor   = UIColor.Black.CGColor;
            headerView.Layer.ShadowOffset  = new CGSize(0.0f, 2.6f);
            headerView.Layer.ShadowOpacity = 0.6f;
            PopulateProgressBar(false);
            UpdateData();
        }