Exemple #1
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     if ((requestCode == 0) && (resultCode == Result.Ok) && (data != null))
     {
         List <BigDaysItemModel> items = MainActivity._BDDB.SelectBDItems();
         BigDaysItemModel        item  = MainActivity._BDDB.GetLastAddItem();
         BitmapHelpers.LoadImage(this, item);
         MainActivity._BDitems.Add(item);
         MainActivity._BDitems = MainActivity._BDitems.OrderBy(o => o._EndDate).ToList();
         _BigDaysListAdapter.Clear();
         _BigDaysListAdapter.Update(MainActivity._BDitems.ToArray());
         _BigDaysListAdapter.NotifyDataSetChanged();
     }
 }
Exemple #2
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if ((requestCode == (int)BigDays.Enums.RequestCode.List_BigDays || requestCode == (int)BigDays.Enums.RequestCode.Edit_BigDay) && (resultCode == Result.Ok))
            {
                _BDDB.CheckRepeats();
                _CurrentItem = _BDDB.GetCurrentItem();
                _infoBoxControl.Visibility = ViewStates.Visible;
                if (requestCode == (int)BigDays.Enums.RequestCode.Edit_BigDay)
                {
                    for (int i = 0; i < _BDitems.Count; i++)
                    {
                        if (_BDitems[i]._ID == _CurrentItem._ID)
                        {
                            BigDaysItemModel item = _BDDB.SelectItem(_CurrentItem._ID);
                            BitmapHelpers.LoadImage(this, item);
                            _BDitems[i] = item;
                            ShowImage(item);
                        }
                    }
                    if (_BDitems.Count == 0)
                    {
                        ShowDefImage();
                        _infoBoxControl.Visibility = ViewStates.Gone;
                    }
                }
                else
                {
                    foreach (var i in _BDitems)
                    {
                        if (i._ID == _CurrentItem._ID)
                        {
                            ShowImage(i);
                        }
                    }
                }

                _ActiveBD = _BDitems.FirstOrDefault(x => x._Active == true);
                if (_ActiveBD == null)
                {
                    _ActiveBD = _BDitems.FirstOrDefault();
                }

                if (_infoBoxControl.Visibility != ViewStates.Gone)
                {
                    _infoBoxControl.Title = _CurrentItem._Name;

                    if (_ActiveBD._ChangePos)
                    {
                        RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                        infoBoxParams.LeftMargin         = _ActiveBD._PosLeft;
                        infoBoxParams.TopMargin          = _ActiveBD._PosTop;
                        _infoBoxControl.LayoutParameters = infoBoxParams;
                    }
                    else
                    {
                        RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                        infoBoxParams.LeftMargin = 0;
                        infoBoxParams.AddRule(LayoutRules.CenterVertical);
                        _infoBoxControl.LayoutParameters = infoBoxParams;
                    }
                }
            }
            else if ((requestCode == (int)BigDays.Enums.RequestCode.AddNew_BigDay) && (resultCode == Result.Ok))
            {
                BigDaysItemModel item = _BDDB.GetLastAddItem();
                BitmapHelpers.LoadImage(this, item);
                _BDitems.Add(item);
                _infoBoxControl.Visibility = ViewStates.Visible;
                if (_BDitems.Count == 1)
                {
                    ShowImage(_BDitems[0]);
                }
                _CurrentItem = _BDDB.GetCurrentItem();

                _ActiveBD = _BDitems.FirstOrDefault(x => x._Active == true);
                if (_ActiveBD == null)
                {
                    _ActiveBD = _BDitems.FirstOrDefault();
                }

                if (_infoBoxControl.Visibility != ViewStates.Gone)
                {
                    if (_ActiveBD._ChangePos)
                    {
                        RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                        infoBoxParams.LeftMargin         = _ActiveBD._PosLeft;
                        infoBoxParams.TopMargin          = _ActiveBD._PosTop;
                        _infoBoxControl.LayoutParameters = infoBoxParams;
                    }
                    else
                    {
                        RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                        infoBoxParams.LeftMargin = 0;
                        infoBoxParams.AddRule(LayoutRules.CenterVertical);
                        _infoBoxControl.LayoutParameters = infoBoxParams;
                    }
                }
            }
        }