public static BaseEffects getAnimator(Effectstype type)
    {
		Type t=null;
 		switch (type) 
        {
			case Effectstype.Fadein:
                return new FadeIn();
            case Effectstype.Slideleft:
                return new SlideLeft();
            case Effectstype.Slidetop:
                return new SlideTop();

            case Effectstype.SlideBottom:
                return new SlideBottom();
            case Effectstype.Slideright:
                return new SlideRight();
            case Effectstype.Fall:
                return new Fall();
            case Effectstype.Newspager:
                return new NewsPaper();
            case Effectstype.Fliph:
                return new FlipH();
            case Effectstype.Flipv:
                return new FlipV();
            case Effectstype.RotateBottom:
                return new RotateBottom();
            case Effectstype.RotateLeft:
                return new RotateLeft();
            case Effectstype.Slit:
                return new Slit();
            case Effectstype.Shake:
                return new Shake();
            case Effectstype.Sidefill:
                return new SideFall();
        }
        return null; 
    }
 private void start(Effectstype type)
 {
     BaseEffects animator = EffectsHelper.getAnimator(type);
     if (mDuration != -1)
     {
         animator.setDuration(Math.Abs(mDuration));
     }
     animator.start(mRelativeLayoutView);
 }
 public NiftyDialogBuilder withEffect(Effectstype type)
 {
     this.type = type;
     return this;
 }
        private void init(Context context)
        {

            mDialogView = View.Inflate(context, R.Layout.dialog_layout, null);

            mLinearLayoutView = (LinearLayout)mDialogView.FindViewById(R.Id.parentPanel);
            mRelativeLayoutView = (RelativeLayout)mDialogView.FindViewById(R.Id.main);
            mLinearLayoutTopView = (LinearLayout)mDialogView.FindViewById(R.Id.topPanel);
            mLinearLayoutMsgView = (LinearLayout)mDialogView.FindViewById(R.Id.contentPanel);
            mFrameLayoutCustomView = (FrameLayout)mDialogView.FindViewById(R.Id.customPanel);

            mTitle = (TextView)mDialogView.FindViewById(R.Id.alertTitle);
            mMessage = (TextView)mDialogView.FindViewById(R.Id.message);
            mIcon = (ImageView)mDialogView.FindViewById(R.Id.icon);
            mDivider = mDialogView.FindViewById(R.Id.titleDivider);
            mButton1 = (Button)mDialogView.FindViewById(R.Id.button1);
            mButton2 = (Button)mDialogView.FindViewById(R.Id.button2);

            SetContentView(mDialogView);
            
            //this.setOnShowListener(new OnShowListener() {
            //    @Override
            //    public void onShow(DialogInterface dialogInterface) {

            //        mLinearLayoutView.Visibility=View.VISIBLE);
            //        if(type==null){
            //            type=Effectstype.Slidetop;
            //        }
            //        start(type);
            
            this.ShowEvent +=delegate{
                             mLinearLayoutView.Visibility=ViewStates.Visible;
                    if(type==null){
                        type=Effectstype.Slidetop;
                    }
                    start(type);  
        };

            //    }
            //});
            //mRelativeLayoutView.setOnClickListener(new View.OnClickListener() {
            //    @Override
            //    public void onClick(View view) {
            //        if (isCancelable)dismiss();
            //    }
            //});

            mRelativeLayoutView.Click += delegate
            {
                if (misCancelable)
                    Dismiss();
            };
        }
        public void dialogShow(View v)
        {

            NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(this);

            switch (v.Id)
            {
                case R.Id.fadein: effect = Effectstype.Fadein; break;
                case R.Id.slideright:effect=Effectstype.Slideright;break;
                case R.Id.slideleft: effect = Effectstype.Slideleft; break;
                case R.Id.slidetop: effect = Effectstype.Slidetop; break;
                case R.Id.slideBottom: effect = Effectstype.SlideBottom; break;
                case R.Id.newspager: effect = Effectstype.Newspager; break;
                case R.Id.fall: effect = Effectstype.Fall; break;
                case R.Id.sidefall: effect = Effectstype.Sidefill; break;
                case R.Id.fliph: effect = Effectstype.Fliph; break;
                case R.Id.flipv: effect = Effectstype.Flipv; break;
                case R.Id.rotatebottom: effect = Effectstype.RotateBottom; break;
                case R.Id.rotateleft: effect = Effectstype.RotateLeft; break;
                case R.Id.slit: effect = Effectstype.Slit; break;
                case R.Id.shake: effect = Effectstype.Shake; break;
            }


            dialogBuilder
                    .withTitle("Modal Dialog")                                  //.withTitle(null)  no title
                    .withTitleColor("#FFFFFF")                                  //def
                    .withDividerColor("#11000000")                              //def
                    .withMessage("This is a modal Dialog.")                     //.withMessage(null)  no Msg
                    .withMessageColor("#FFFFFFFF")                              //def  | withMessageColor(int resid)
                    .withDialogColor("#FFE74C3C")                               //def  | withDialogColor(int resid)                               //def
                    .withIcon(this.Resources.GetDrawable(R.Drawable.Icon))
                    .isCancelableOnTouchOutside(true)                           //def    | isCancelable(true)
                    .withDuration(700)                                          //def
                    .withEffect(effect)                                         //def Effectstype.Slidetop
                    .withButton1Text("OK")                                      //def gone
                    .withButton2Text("Cancel")                                  //def gone
                    .setCustomView(R.Layout.custom_view, v.Context);            //.setCustomView(View or ResId,context)
            dialogBuilder.Button1.Click += delegate
            {
                Toast.MakeText(this, "i'm btn1", ToastLength.Short).Show();
            };
            dialogBuilder.Button2.Click += delegate
            {
                Toast.MakeText(this, "i'm btn2", ToastLength.Short).Show();
            };

            //.setButton1Click(new View.OnClickListener() {
            //    @Override
            //    public void onClick(View v) {
            //        Toast.makeText(v.getContext(), "i'm btn1", Toast.LENGTH_SHORT).show();
            //    }
            //})
            //.setButton2Click(new View.OnClickListener() {
            //    @Override
            //    public void onClick(View v) {
            //        Toast.makeText(v.getContext(), "i'm btn2", Toast.LENGTH_SHORT).show();
            //    }
            //})
            dialogBuilder.Show();

        }