Esempio n. 1
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Resource.Id.share:
         SendPostFormula(CubeSolver.Zip(String.Join(" ", new CubeSolver(cb.state).GetSolution())));
         return(true);
     }
     return(base.OnContextItemSelected(item));
 }
Esempio n. 2
0
 private void button_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < b.Length; i++)
     {
         if (sender == b[i])
         {
             Intent intent = new Intent(this, typeof(Cube));
             intent.PutExtra("type", "algo");
             intent.PutExtra("state", CubeSolver.StateToArray(states[i]));
             intent.PutExtra("formula", formulas[i]);
             StartActivityForResult(intent, 11);
             break;
         }
     }
 }
Esempio n. 3
0
 public void OnMaskClick(object sender, EventArgs args)
 {
     photoOutput.SaveCurSide();
     mask.OnClick();
     if (photoOutput.IsAllSidesFilled)
     {
         Intent intent = new Intent(this, typeof(Cube));
         var    temp   = CubeSolver.StateToArray(photoOutput.GetState());
         intent.PutExtra("type", "photo");
         intent.PutExtra("state", temp);
         StartActivityForResult(intent, 3);
         Finish();
     }
     //mCamera.TakePicture(null, null, null, )
 }
Esempio n. 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Title = "Сборка";
            SetContentView(Resource.Layout.CubeActivityLayout);
            mLayout = FindViewById <LinearLayout>(Resource.Id.cubeLayout);
            cb      = new CubeAnimationView(this);

            string type = Intent.GetStringExtra("type");

            switch (type)
            {
            case "photo":
                cb.SetState(Intent.GetIntArrayExtra("state"));
                cb.SolveCurrentState();
                break;

            case "server":
                var cs = new CubeSolver();

                string f = CubeSolver.Backward(CubeSolver.Unzip(Intent.GetStringExtra("server")));
                cs.DoFormula(f);
                cb.SetState(cs.GetState());
                cb.SolveCurrentState();
                break;

            case "algo":

                cb.SetState(Intent.GetIntArrayExtra("state"));
                cb.DoFormulas(new string[1] {
                    Intent.GetStringExtra("formula")
                });
                break;
            }

            //cb.SetState(Intent.GetIntArrayExtra("state"));

            cb.LayoutParameters = new ViewGroup.LayoutParams
                                  (
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent
                                  );
            mLayout.AddView(cb);
        }