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)); }
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; } } }
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, ) }
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); }