Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            //create a new dialog
            dialog = CustomProgressDialog.CreateDialog(this);
            dialog.OnWindowFocusChanged(true);

            Button btnGO = FindViewById <Button>(Resource.Id.go);

            btnGO.Click += (s, e) =>
            {
                int result = 0;
                //show the dialog
                dialog.Show();
                //do some things
                Task task = new Task(() =>
                {
                    for (int i = 0; i < 100; i++)
                    {
                        result += i;
                    }
                });
                task.ContinueWith(t =>
                {
                    Intent intent = new Intent(this, typeof(LastActivity));
                    intent.PutExtra("name", result.ToString());
                    StartActivity(intent);
                });
                task.Start();
            };
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here


            //使用加载等待页面
            dialog = CustomProgressDialog.CreateDialog(this);
            dialog.OnWindowFocusChanged(true);


            LoginSystemType = Intent.GetStringExtra("LoginSystemType");
            username        = Intent.GetStringExtra("username");

            EditText sampCount = FindViewById <EditText>(Resource.Id.sampCount);

            readIc        = FindViewById <ToggleButton>(Resource.Id.btReadic);
            readIc.Click += icRead;

            dialog.Show();

            //地点下拉菜单
            sampAdressName = bsinf.selectAdress();
            sp_adresssname = FindViewById <Spinner>(Resource.Id.sampAdress);
            //填充数据库数据
            ArrayAdapter <string> adapter_adressName = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sampAdressName);

            adapter_adressName.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            sp_adresssname.Adapter       = adapter_adressName;
            sp_adresssname.ItemSelected += adress_ItemSelected;

            //业务类型
            samp_mode = FindViewById <Spinner>(Resource.Id.sampMode);
            //填充xml文件数据
            ArrayAdapter adapter_mode = ArrayAdapter.CreateFromResource(this, Resource.Array.SampMode, Android.Resource.Layout.SimpleSpinnerItem);

            adapter_mode.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            samp_mode.Adapter       = adapter_mode;
            samp_mode.Prompt        = "请选择";
            samp_mode.ItemSelected += selectMode_ItemSelected;

            //数量
            samp_weight = FindViewById <EditText>(Resource.Id.sampCount);
            if (samp_weight.Text == "")
            {
                samp_weight.Text = "0.00";
            }
            else
            {
                sampWeight = Convert.ToDouble(samp_weight.Text);
            }

            //单位
            samp_util = FindViewById <Spinner>(Resource.Id.sampunilt);
            sampUtile = bsinf.selectUtil();
            //填充数据
            ArrayAdapter adapter_utile = ArrayAdapter.CreateFromResource(this, Resource.Array.SampUtile, Android.Resource.Layout.SimpleSpinnerItem);

            adapter_utile.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            samp_util.Adapter = adapter_utile;
            //sp_goodsname.ItemSelected += TargetSpinner_ItemSelected;

            //萤石取样位置
            samp_yshi = FindViewById <Spinner>(Resource.Id.sampYshi);
            ArrayAdapter adpter_yshi = ArrayAdapter.CreateFromResource(this, Resource.Array.SampYshi, Android.Resource.Layout.SimpleSpinnerItem);

            adpter_yshi.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            samp_yshi.Adapter = adpter_yshi;
        }