Exemplo n.º 1
0
 private void processmsg_TakeEvaluation(msg_TakeEvaluation msg)
 {
     try
     {
         if (this.Activity == null || this.Activity.IsFinishing)
         {
             return;
         }
         //var viewfragment = new TakeEvaluationFragment(msg);
         //var ft = ChildFragmentManager.BeginTransaction();
         //ft.Replace(Resource.Id.dry_evalframelayout, viewfragment);
         //ft.Commit();
         var evalsfragment = new TakeEvaluationFragment(msg);
         var ft            = ChildFragmentManager.BeginTransaction();
         var fragment      = this.ChildFragmentManager.FindFragmentById(Resource.Id.dry_evalframelayout);
         if (fragment != null)
         {
             ft.Remove(fragment);
         }
         ft.Replace(Resource.Id.dry_evalframelayout, evalsfragment);
         ft.Commit();
     }
     catch (Exception ex)
     {
     }
 }
 public TakeEvaluationViewModel(IEvaluationService evaluationService, ILocalDbService localDbService,
                                IDialogService dialogService, ILocalEvaluationService localEvaluationService, msg_TakeEvaluation msgTakeEvaluation)
 {
     _evaluationService      = evaluationService;
     _localDbService         = localDbService;
     _dialogService          = dialogService;
     _localEvaluationService = localEvaluationService;
     _msgTakeEvaluation      = msgTakeEvaluation;
 }
        private readonly List <Binding> _bindings = new List <Binding>(); 

 public TakeEvaluationFragment(msg_TakeEvaluation _msg)
        {
            GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <msg_StartEvaluation>(this, processmsg_StartEvaluation);
            msg = _msg;
            var dialogservice    = ServiceLocator.Current.GetInstance <IDialogService>();
            var evalservice      = ServiceLocator.Current.GetInstance <IEvaluationService>();
            var localevalservice = ServiceLocator.Current.GetInstance <ILocalEvaluationService>();
            var localdbservice   = ServiceLocator.Current.GetInstance <ILocalDbService>();

            viewmodel = new TakeEvaluationViewModel(evalservice, localdbservice, dialogservice, localevalservice, msg);
        }
        private void Btntaketest_Click(object sender, EventArgs e)
        {
            Bundle args = new Bundle();

            args.PutInt("EvalID", msg_dto.evaluation_dto.Id);
            Vm.EvalId = msg_dto.evaluation_dto.Id;
            //Vm.OpenTakeEvaluationCommand.Execute(null);
            var newmsg = new msg_TakeEvaluation(msg_dto.evaluation_dto);

            try
            {
                if (this.Activity == null || this.Activity.IsFinishing)
                {
                    return;
                }
                if (this.ChildFragmentManager == null)
                {
                    return;
                }

                TakeEvaluationFragment frg = new TakeEvaluationFragment(newmsg);

                var ft2      = ChildFragmentManager.BeginTransaction();
                var fragment = this.ChildFragmentManager.FindFragmentById(Resource.Id.dry_evalframelayout);
                if (fragment != null)
                {
                    ft2.Remove(fragment);
                }
                ft2.Replace(Resource.Id.dry_evalframelayout, frg);
                ft2.Commit();
                //if (this.Activity == null || this.Activity.IsFinishing) return;
                //var viewfragment = new TakeEvaluationFragment();
                //var ft = ChildFragmentManager.BeginTransaction();
                //ft.Replace(Resource.Id.dry_evalframelayout, viewfragment);
                //ft.Commit();
            }
            catch (Exception ex)
            {
            }
        }