私はC#とXamarinの新機能ですが、私はこの解決策を間違って行っているかもしれませんが、ユーザ入力0-10の数値ではなく、負の数値ではない小数点以下の値を宣言しています。それは基本的な算術演算a/b * c =答えを行います...私はvar C(答え)を表示し、それを使用して最終的にタイマー間隔を変更します。しかし、今のところ、コードを自分のテキストを表示するためのテキストとして表示するのは苦労しています....下のコードを見てください。C#Xamarinでの計算、答えを表示する。
[Activity(Label = "Infusion Calculator")]
public class infusionact : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Infusion);
// Create your application here
var volume = FindViewById<EditText>(Resource.Id.boxvolume);
var drip = FindViewById<EditText>(Resource.Id.boxdrip);
var dripmins = FindViewById<EditText>(Resource.Id.boxmins);
var answermins = (Resource.Id.boxvolume/Resource.Id.boxmins * Resource.Id.boxdrip);
Button button = FindViewById<Button>(Resource.Id.btncalculate);
TextView textView1 = (TextView)FindViewById(Resource.Id.textView1);
button.Click += delegate
{
// NEED TO FIGURE OUT HOW TO SET TXT LABEL WITH VAR ANSWERMINS ON CLICK
textView1.SetText(answermins);
};
}
}