private async void GetDataForChart(DateTime startDate, bool dataType = true) { try { if (dataType) { _bloodPressureDataList.Clear(); string bloodPressureResult = await WebServices.WebServices.Post($"{Constants.PublicServerAddress}/api/getUsersDataSharing", new JSONObject().Put("dataType", "bloodPressure").Put("imei", _imei) .Put("date", startDate.ToString("yyyy-MM-dd")), Utils.GetDefaults("Token")); if (!string.IsNullOrEmpty(bloodPressureResult)) { var dataArray = new JSONArray(bloodPressureResult); for (var i = 0; i < dataArray.Length(); i++) { _bloodPressureDataList.Add(JsonConvert.DeserializeObject <PressureModel>(dataArray.GetJSONObject(i).ToString())); } } CreateBloodPresureChart(); verticalScrollLinearLayout.RemoveAllViewsInLayout(); horizontalScrollLinearLayout.RemoveAllViewsInLayout(); LoadDataInScrollLayouts(DateTime.Now); } else { _bloodGlucoseDataList.Clear(); string bloodGlucoseResult = await WebServices.WebServices.Post($"{Constants.PublicServerAddress}/api/getUsersDataSharing", new JSONObject().Put("dataType", "bloodGlucose").Put("imei", _imei) .Put("date", startDate.ToString("yyyy-MM-dd")), Utils.GetDefaults("Token")); if (!string.IsNullOrEmpty(bloodGlucoseResult)) { var dataArray = new JSONArray(bloodGlucoseResult); for (var i = 0; i < dataArray.Length(); i++) { _bloodGlucoseDataList.Add(JsonConvert.DeserializeObject <GlucoseModel>(dataArray.GetJSONObject(i).ToString())); } } CreateGlucoseChart(); verticalScrollLinearLayout.RemoveAllViewsInLayout(); horizontalScrollLinearLayout.RemoveAllViewsInLayout(); LoadDataInScrollLayouts(DateTime.Now, false); } } catch (Exception e) { Console.WriteLine(e); } }
/// <summary> /// Retrieves and displays the list of APKs hosted on the web service. /// Each APK is represented by a button. /// </summary> void RefreshAppList() { try { if (settings != null) { if (!busy) { busy = true; serviceIsReachable = false; serviceStatus = "Status: Refreshing"; linAppList.RemoveAllViewsInLayout(); packages = new List <PackageDetails>(); packages = webServiceControl.GetPackageList(); foreach (var a in webServiceControl.GetPackageList()) { Button btn = new Button(ApplicationContext) { Tag = packages.FindIndex(x => x.Name == a.Name && x.Version == a.Version), LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1f) { TopMargin = 10, BottomMargin = 10, LeftMargin = 0, RightMargin = 0 } }; btn.SetBackgroundResource(Resource.Drawable.Button); btn.SetTextColor(Color.ParseColor(Resources.GetString(Resource.Color.ButtonTextColor))); btn.SetShadowLayer(10, 0, 0, Color.Black); btn.Text = a.Name + " " + a.Version; btn.SetAllCaps(true); btn.Click += delegate { DownloadApp(btn); }; linAppList.AddView(btn); } } else { Toast.MakeText(this, "No hosted applications found.", ToastLength.Long).Show(); } busy = false; CheckForNewerMobuVersion(); } } catch (Exception e) { Log.Info("MobuAndroid", "Error while refreshing application list.", e.Message); busy = false; } }
private void UpdateWorkTimeList() { LinearLayout mainll = FindViewById <LinearLayout> (Resource.Id.lstDD); mainll.RemoveAllViewsInLayout(); //lstWorkTime.RemoveAllViewsInLayout(); workTimeItems.Clear(); if (doctor.wtKind == WorkTime_Kind.Days) { workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Понедельник", doctor.wtDays.Mon_From, WorkTime_Type.Mon_From, doctor.wtDays.Mon_Till, WorkTime_Type.Mon_Till)); workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Вторник ", doctor.wtDays.Tue_From, WorkTime_Type.Tue_From, doctor.wtDays.Tue_Till, WorkTime_Type.Tue_Till)); workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Среда ", doctor.wtDays.Wed_From, WorkTime_Type.Wed_From, doctor.wtDays.Wed_Till, WorkTime_Type.Wed_Till)); workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Четверг ", doctor.wtDays.Thu_From, WorkTime_Type.Thu_From, doctor.wtDays.Thu_Till, WorkTime_Type.Thu_Till)); workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Пятница ", doctor.wtDays.Fri_From, WorkTime_Type.Fri_From, doctor.wtDays.Fri_Till, WorkTime_Type.Fri_Till)); // workTimeItems.Add(new Tuple<String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Суббота ", doctor.wtDays.Sut_From, WorkTime_Type.Sut_From, doctor.wtDays.Sut_Till, WorkTime_Type.Sut_Till)); // workTimeItems.Add(new Tuple<String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Воскресенье", doctor.wtDays.Sun_From, WorkTime_Type.Sun_From, doctor.wtDays.Sun_Till, WorkTime_Type.Sun_Till)); } else { workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Четная дата ", doctor.wtOddEven.Even_From, WorkTime_Type.Even_From, doctor.wtOddEven.Even_Till, WorkTime_Type.Even_Till)); workTimeItems.Add(new Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>("Нечетная дата", doctor.wtOddEven.Odd_From, WorkTime_Type.Odd_From, doctor.wtOddEven.Odd_Till, WorkTime_Type.Odd_Till)); } //lstWorkTime.Adapter = new WorkTimeListAdapter(this, workTimeItems, doctor, TimePickerCallback); for (int i = 0; i <= workTimeItems.Count - 1; i++) { var view = this.LayoutInflater.Inflate(Resource.Layout.WorkTimeListItem, null); var item = workTimeItems[i]; view.FindViewById <TextView> (Resource.Id.txtDayOrOddEven).Text = item.Item1; var btnWorkTimeFromValue = view.FindViewById <Button> (Resource.Id.btnWorkTimeFromValue); btnWorkTimeFromValue.Text = item.Item2.ToString("t"); btnWorkTimeFromValue.Click += (object sender, EventArgs e) => { doctor.chooseNwtType = item.Item3; var timepickDialog = new TimePickerDialog(this, TimePickerCallback, item.Item2.Hour, item.Item2.Minute, true); timepickDialog.SetTitle(item.Item1); timepickDialog.Show(); }; var btnWorkTimeTillValue = view.FindViewById <Button> (Resource.Id.btnWorkTimeTillValue); btnWorkTimeTillValue.Text = item.Item4.ToString("t"); btnWorkTimeTillValue.Click += (object sender, EventArgs e) => { doctor.chooseNwtType = item.Item5; var timepickDialog = new TimePickerDialog(this, TimePickerCallback, item.Item4.Hour, item.Item4.Minute, true); timepickDialog.SetTitle(item.Item1); timepickDialog.Show(); }; mainll.AddView(view); } }
private void addPageButtons(int pageCount, int activePage) { _scrollContentLayout.RemoveAllViewsInLayout(); for (int i = 1; i <= pageCount; i++) { ViewerPageButton b = new ViewerPageButton(Context); b.PageNumber = i; b.OnClick += handlePageBtnClick; if (i == activePage) { _activeBtn = b; } b.SetActive(_activeBtn == b); _scrollContentLayout.AddView(b); } }
/// <summary> /// Sets up references to UI components, controls and settings. /// </summary> void SetupActivity() { try { txtInstance = FindViewById <TextView>(Resource.Id.txtMobuInstance); txtServiceStatus = FindViewById <TextView>(Resource.Id.txtMobuWebStatus); linAppList = FindViewById <LinearLayout>(Resource.Id.linAppList); linAppList.RemoveAllViewsInLayout(); settingsControl = new SettingsControl(); if (!settingsControl.SettingsProfilesExist() || !settingsControl.CurrentSettingsExist()) { settingsControl.GenerateDefaultSettings(); } ProcessOldSettings(); if (!settingsControl.CurrentSettingsExist()) { var profiles = settingsControl.GetSettingsProfiles(); settings = profiles.First(); settingsControl.SaveCurrentSettings(settings); } else { settings = settingsControl.GetCurrentSettings(); } webServiceControl = new WebServiceControl(settings); if (settings.IsTestInstance) { txtInstance.SetBackgroundResource(Resource.Drawable.ContainerBackgroundRed); txtInstance.Text = "Instance: Test"; } else { txtInstance.SetBackgroundResource(Resource.Drawable.ContainerBackground); txtInstance.Text = "Instance: Production"; } busy = false; serviceIsReachable = false; serviceStatus = "Status: Waiting"; statusIndicator = "."; packages = new List <PackageDetails>(); RunUiIndicator(); RunUpdateServiceStatus(); RunUpdateStatus(); RunAutomaticRefresh(); AccuirePermissions(); } catch (Exception e) { Log.Info("MobuAndroid", "Error while setting up main activity.", e.Message); FinishAndRemoveTask(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); Window.AddFlags (WindowManagerFlags.KeepScreenOn); SetContentView (Resource.Layout.previewSoundFX); if (MessageReceivedUtil.userFrom != null) { UserDB user = UserDB.ConvertFromUser (MessageReceivedUtil.userFrom); Header.headertext = user.FirstName + " " + user.LastName; MessageReceivedUtil.userFrom = null; } else { if (MessagePlaybackUtil.recipients != null) { for (int i = 0; i < MessagePlaybackUtil.recipients.Count; ++i) { if (MessagePlaybackUtil.recipients [i] != null) { Header.headertext = MessagePlaybackUtil.recipients [i].FirstName + " " + MessagePlaybackUtil.recipients [i].LastName; break; } } //} } else Header.headertext = "Ann Onymouse"; } linView = FindViewById<LinearLayout> (Resource.Id.linearHolder); context = linView.Context; ImageView btns = FindViewById<ImageView> (Resource.Id.imgNewUserHeader); TextView header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader); RelativeLayout relLayout = FindViewById<RelativeLayout> (Resource.Id.relativeLayout1); ImageHelper.setupTopPanel (btns, header, relLayout, header.Context); Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; parent = linView; //preview = FindViewById<ImageView> (Resource.Id.imgComicon); progress = FindViewById<ProgressBar> (Resource.Id.prgPreview); co = base.Intent.GetIntExtra ("position", 0); counter = MessagePlaybackUtil.messageSteps.Count; dbm = wowZapp.LaffOutOut.Singleton.dbm; isPlaying = false; stepID = Guid.Empty; #if DEBUG System.Diagnostics.Debug.WriteLine ("number of steps = {0}", counter); #endif linView.RemoveAllViewsInLayout (); t = new System.Timers.Timer (); t.Interval = 2500; t.Elapsed += new System.Timers.ElapsedEventHandler (t_Elapsed); increments = 100 / (counter + 1); if (co != 0) { RunOnUiThread (() => progress.Progress = co * increments); increments *= co + co; } if (MessagePlaybackUtil.markAsRead) { ThreadPool.QueueUserWorkItem (delegate { Guid messageID = MessagePlaybackUtil.messageSteps [0].MessageID; LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.MessageMarkReadCompleted += Service_MessageMarkReadCompleted; service.MessageMarkReadAsync (messageID, AndroidData.CurrentUser.AccountID, AndroidData.NewDeviceID, new Guid (AndroidData.ServiceAuthToken), messageID); }); } ImageButton btnPreAdd = FindViewById<ImageButton> (Resource.Id.imgAdd); btnPreAdd.Tag = 1; ImageButton btnBack = FindViewById<ImageButton> (Resource.Id.btnBack); btnBack.Tag = 0; btnBack.Click += delegate { Window.ClearFlags (WindowManagerFlags.KeepScreenOn); Finish (); }; LinearLayout bottom = FindViewById<LinearLayout> (Resource.Id.bottomHolder); ImageButton[] buttons = new ImageButton[2]; buttons [0] = btnBack; buttons [1] = btnPreAdd; ImageHelper.setupButtonsPosition (buttons, bottom, context); if (MessageReceivedUtil.readOnly) btnPreAdd.Visibility = ViewStates.Invisible; else btnPreAdd.Click += delegate { StartActivity (typeof(ComposeMessageChooseContent)); }; #if DEBUG int m = 0; foreach (MessageStep eachMessageStep in MessagePlaybackUtil.messageSteps) System.Diagnostics.Debug.WriteLine ("step {0} = {1}", m++, eachMessageStep.StepType.ToString ()); #endif RunOnUiThread (delegate { PrepareViews (co); }); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_stopWatch, container, false); progressCircle = rootView.FindViewById <ProgressCircle>(Resource.Id.stopwatch_circle_progress); txtTimer = rootView.FindViewById <TextView>(Resource.Id.stopwatch_txtTimer); btnStart = rootView.FindViewById <Button>(Resource.Id.stopwatch_btnStart); btnStop = rootView.FindViewById <Button>(Resource.Id.stopwatch_btnStop); btnReset = rootView.FindViewById <Button>(Resource.Id.stopwatch_btnReset); btnLap = rootView.FindViewById <Button>(Resource.Id.stopwatch_btnLap); container_row = rootView.FindViewById <LinearLayout>(Resource.Id.container_row); StartState(); //sec = 55;// //progressCircle.SetProgressWithoutAnimation(55);// btnStart.Click += delegate { timer = new Timer(); timer.Interval = 100; //0.1 second timer.Elapsed += Timer_Elapsed; timer.Start(); btnStart.Enabled = false; btnStop.Enabled = true; btnReset.Enabled = false; btnLap.Enabled = true; running = true; ButtonsStateColor(); }; btnStop.Click += delegate { timer.Dispose(); timer = null; btnStart.Enabled = true; btnStop.Enabled = false; btnReset.Enabled = true; btnLap.Enabled = false; running = false; ButtonsStateColor(); }; btnReset.Click += delegate { hour = 0; min = 0; sec = 0; milisec = 0; txtTimer.Text = "00:00:00:0"; progressCircle.SetProgress(0, 0); btnStart.Enabled = true; btnStop.Enabled = false; btnReset.Enabled = false; btnLap.Enabled = false; running = false; container_row.RemoveAllViewsInLayout(); ButtonsStateColor(); }; btnLap.Click += delegate { LayoutInflater inflater_row = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); View addView = inflater_row.Inflate(Resource.Layout.fragment_stopWatch_row, null); TextView textContent = addView.FindViewById <TextView>(Resource.Id.stopWatch_txtRow); textContent.Text = txtTimer.Text; container_row.AddView(addView); }; if (running == false) { btnStart.Enabled = true; btnStop.Enabled = false; btnReset.Enabled = false; btnLap.Enabled = false; } if (running == true) { btnStart.Enabled = false; btnStop.Enabled = true; btnReset.Enabled = false; btnLap.Enabled = true; } return(rootView); }