private void StartService() { if (permissionGranted) { //start Service if (UtilityClass.IsLocationEnabled(mContext)) { StartServiceAndBind(); stopService.Enabled = true; stopService.Click += StopServiceListener; } else { /* * In case the user has his location service turned off we prompt the user * to start the service * */ Android.Support.V7.App.AlertDialog dialog = UtilityClass.ShowAlertDialog(this, mContext.Resources.GetString(Resource.String.turn_on_location), "OK", "Cancel"); Button btnPositive = dialog.GetButton((int)DialogButtonType.Positive); btnPositive.Click += (s, e) => { Intent myIntent = new Intent(Android.Provider.Settings.ActionLocationSourceSettings); StartActivity(myIntent); dialog.Dismiss(); }; Button btnNegative = dialog.GetButton((int)DialogButtonType.Negative); btnNegative.Click += (s, e) => { dialog.Dismiss(); }; } } }
public void DismissDialog() { mAlertDialog.Dismiss(); mSelection.Visibility = ViewStates.Invisible; mLocationName.Visibility = ViewStates.Invisible; mInfo.Visibility = ViewStates.Invisible; CheckForWaitingParty(); }
void DismissNewCredentialsDialog() { if (NewCredentialsDialog != null) { NewCredentialsDialog.Dismiss(); } }
void DismissCurrentCredentialsDialog() { if (CurrentCredentialsDialog != null) { CurrentCredentialsDialog.Dismiss(); } }
void DismissDataDialog() { if (ClearDataDialog != null) { ClearDataDialog.Dismiss(); } }
internal void SetSearchResultOnMap(IList <Huawei.Hms.Site.Api.Model.Site> sites) { hMap.Clear(); if (searchMarkers != null && searchMarkers.Count > 0) { foreach (var item in searchMarkers) { item.Remove(); } } searchMarkers = new List <Marker>(); //foreach cause an issue, not added markers properly on map for (int i = 0; i < sites.Count; i++) { MarkerOptions marker1Options = new MarkerOptions() .InvokePosition(new LatLng(sites[i].Location.Lat, sites[i].Location.Lng)) .InvokeTitle(sites[i].Name).Clusterable(true); hMap.SetInfoWindowAdapter(new MapInfoWindowAdapter(this)); var marker1 = hMap.AddMarker(marker1Options); searchMarkers.Add(marker1); RepositionMapCamera(sites[i].Location.Lat, sites[i].Location.Lng); } hMap.SetMarkersClustering(true); alert.Dismiss(); }
public void DismissDialog() { if (mAlertDialog != null) { mAlertDialog.Dismiss(); mAlertDialog = null; } }
public void CloseProgressDialog() { if (alertDialog != null) { alertDialog.Dismiss(); alertDialog = null; builder = null; } }
private void CloseProgressDialogue() { if (_alert != null) { _alertDialog.Dismiss(); _alertDialog = null; _alert = null; } }
void CloseProgressDialogue() { if (alert != null) { alertDialog.Dismiss(); alertDialog = null; alert = null; } }
private void CloseProgressDialogue() { if (_alert == null) { return; } _alertDialog.Dismiss(); _alertDialog = null; _alert = null; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.TopperLayout); Button button = FindViewById <Button>(Resource.Id.buttonRank); EditText editRank = FindViewById <EditText>(Resource.Id.editRank); IsConnectedToNetwork = CrossConnectivity.Current.IsConnected; if (IsConnectedToNetwork == false) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); } button.Click += delegate { topperList = new List <String>(); active_session_names = new List <string>(); Console.WriteLine("RANK IS " + editRank.Text); displayTopper(Convert.ToInt32(editRank.Text)); }; CrossConnectivity.Current.ConnectivityChanged += delegate { if (CrossConnectivity.Current.IsConnected != true) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); IsConnectedToNetwork = false; } if (CrossConnectivity.Current.IsConnected == true) { if (alertDialog.IsShowing) { alertDialog.Dismiss(); } } }; }
void CloseProgressDialog() { if (alert != null) { alertDialog.Dismiss(); alert.Dispose(); alertDialog = null; alert = null; player.Stop(); player.Dispose(); player = null; } }
/* * Creates an outgoing conversation UI dialog */ private void showCallDialog() { var participantEditText = new EditText(this); alertDialog = Dialog.CreateCallParticipantsDialog(participantEditText, delegate { /* * Make outgoing invite */ var participant = participantEditText.Text; if (!string.IsNullOrEmpty(participant) && conversationsClient != null) { stopPreview(); // Create participants set (we support only one in this example) var participants = new List <string> (); participants.Add(participant); // Create local media var localMedia = setupLocalMedia(); // Create outgoing invite outgoingInvite = conversationsClient.SendConversationInvite(participants, localMedia, new ConversationCallback { ConversationHandler = (c, err) => { if (err == null) { // Participant has accepted invite, we are in active conversation this.conversation = c; conversation.ConversationListener = conversationListener(); } else { Android.Util.Log.Error(TAG, err.Message); hangup(); reset(); } } }); setHangupAction(); } else { Android.Util.Log.Error(TAG, "invalid participant call"); conversationStatusTextView.Text = "call participant failed"; } }, delegate { setCallAction(); alertDialog.Dismiss(); }, this); alertDialog.Show(); }
/* * Creates an connect UI dialog */ private void ShowConnectDialog() { EditText roomEditText = new EditText(this); alertDialog = dialog.Dialog.CreateConnectDialog(roomEditText, (sender, args) => { ConnectToRoom(roomEditText.Text); }, (sender, args) => { IntializeUi(); alertDialog.Dismiss(); }, this); alertDialog.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); IsConnectedToNetwork = CrossConnectivity.Current.IsConnected; SetContentView(Resource.Layout.CreateSessionLayout); if (IsConnectedToNetwork == false) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); } else { addSession(); } CrossConnectivity.Current.ConnectivityChanged += delegate { if (CrossConnectivity.Current.IsConnected != true) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); IsConnectedToNetwork = false; } if (CrossConnectivity.Current.IsConnected == true) { if (alertDialog.IsShowing) { alertDialog.Dismiss(); } addSession(); IsConnectedToNetwork = true; } }; }
private void RepeatLayout_Click(object sender, EventArgs e) { var builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetTitle("Choose a repeat interval"); builder.SetSingleChoiceItems(_items, _selectedRepeatIndex, (s, ev) => { _selectedRepeatIndex = ev.Which; repeatSelectedTextView.Text = _items[ev.Which]; _dialog.Dismiss(); }); _dialog = builder.Create(); _dialog.Show(); }
private void SetAlarm(DateTime sentAt) { Intent i = new Intent(AlarmClock.ActionSetAlarm); TimeSpan span = sentAt.TimeOfDay; span = span.Subtract(TimeSpan.FromMinutes(AvailableTime[time])); i.PutExtra(AlarmClock.ExtraHour, span.Hours); i.PutExtra(AlarmClock.ExtraMinutes, span.Minutes); i.PutExtra(AlarmClock.ExtraSkipUi, true); i.PutExtra(AlarmClock.ExtraMessage, Resources.GetString(Resource.String.app_name) + " " + AvailableTime[time].ToString() + " " + Resources.GetString(Resource.String.mins) + " " + Resources.GetString(Resource.String.Left)); i.PutExtra(AlarmClock.ExtraVibrate, true); StartActivity(i); alertDialog.Dismiss(); }
public void ShowHelp() { Android.Support.V7.App.AlertDialog.Builder helpBuild = new Android.Support.V7.App.AlertDialog.Builder(this); helpBuild.SetTitle("Help"); helpBuild.SetMessage("Guess the word by selecting the letters.\n\n" + "You only have 6 wrong selections then it's game over!"); helpBuild.SetPositiveButton("OK", (c, v) => { helpAlert.Dismiss(); }); helpAlert = helpBuild.Create(); helpBuild.Show(); }
private async void SetQuality(PopupWindow window, EZConstants.EZVideoLevel level) { window.Dismiss(); if (!ConnectionDetector.IsNetworkAvailable(this)) { // 提示没有连接网络 Utils.ShowToast(this, Resource.String.realplay_set_fail_network); return; } Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetCancelable(false); builder.SetMessage(Resource.String.setting_video_level); Android.Support.V7.App.AlertDialog dialog = builder.Show(); var result = await CameraHelpers.SetVideoLevel(camera.DeviceSerial, camera.CameraNo, level); dialog.Dismiss(); if (result.Model) { camera.SetVideoLevel(videoLevel.Ordinal()); if (level == EZConstants.EZVideoLevel.VideoLevelHd) { btnVideoLevel.Text = GetString(Resource.String.quality_hd); } else if (level == EZConstants.EZVideoLevel.VideoLevelBalanced) { btnVideoLevel.Text = GetString(Resource.String.quality_balanced); } else if (level == EZConstants.EZVideoLevel.VideoLevelFlunet) { btnVideoLevel.Text = GetString(Resource.String.quality_flunet); } else { btnVideoLevel.Text = GetString(Resource.String.quality_flunet); } } else if (result.HasError) { Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show(); } player.StopPlay(); SystemClock.Sleep(500); player.StartPlay(); }
/// <summary> /// Closes the dialog. /// </summary> private void PositiveButton_Click(object sender, EventArgs e) { if (_infoDialogNeutralButton != null) { _infoDialogNeutralButton.Click -= NeutralButton_Click; } if (_infoDialogPositiveButton != null) { _infoDialogPositiveButton.Click -= PositiveButton_Click; } if (_infoDialog != null) { _infoDialog.Dismiss(); } _infoDialogNeutralButton = null; _infoDialogPositiveButton = null; _infoDialog = null; _infoDialogValueToCopy = null; }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.SearchFragmentRow, parent, false); ExerciseSearchViewHolder viewHolder = new ExerciseSearchViewHolder(itemView, OnClick); viewHolder.addButton.Click += (sender, e) => { //adding a exercise to a playlist var pos = viewHolder.AdapterPosition; var exerciseName = exercises[pos].name; View addView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.SearchListViewDialog, null); Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(parent.Context); builder.SetView(addView); Android.Support.V7.App.AlertDialog alertDialog = builder.Create(); ListView listView = addView.FindViewById <ListView>(Resource.Id.searchLV); ListViewAdapter adapter = new ListViewAdapter(activity, playlistNames); listView.Adapter = adapter; listView.ItemClick += (s, item) => { var tempName = listView.GetItemAtPosition(item.Position).ToString(); dataBase.addExerciseFromPlaylist(tempName, exerciseName); alertDialog.Dismiss(); Toast.MakeText(parent.Context, "Exercise Added.", ToastLength.Short).Show(); }; alertDialog.Show(); }; viewHolder.deleteButton.Click += (sender, e) => { var pos = viewHolder.AdapterPosition; var name = exercises[pos].name; //make popup menu for confirmation of deleting from database View deleteView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.DeleteItem, null); Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(parent.Context); builder.SetView(deleteView); Android.Support.V7.App.AlertDialog alertDialog = builder.Create(); Button deleteButton = deleteView.FindViewById <Button>(Resource.Id.btnDelete); Button cancelButton = deleteView.FindViewById <Button>(Resource.Id.btnCancel); TextView txtTitle = deleteView.FindViewById <TextView>(Resource.Id.titleDelete); txtTitle.Text = "Delete Exercise?"; deleteButton.Click += delegate { dataBase.deleteExercise(name); Toast.MakeText(parent.Context, name + " deleted", ToastLength.Short).Show(); exercises.RemoveAt(pos); NotifyDataSetChanged(); alertDialog.Dismiss(); }; cancelButton.Click += delegate { //close window alertDialog.Dismiss(); }; alertDialog.Show(); }; return(viewHolder); }
private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { selectedScheme = schemes[e.Position].Id; txtPricingScheme.Text = schemes[e.Position].Name; alertDialog.Dismiss(); }
private async void ShowScanDialog() { View view = View.Inflate(this, Resource.Layout.Scan, null); TextView ScaningDetail = view.FindViewById <TextView>(Resource.Id.ScaningDetail); AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetView(view) .SetCancelable(false) .Create(); AlertDialog show = alertDialog.Show(); var token = scanCTS.Token; Task t1 = Task.Run(() => { try { NetworkManager.GetNetworkIpAndMask(out IPAddress ip, out IPAddress sub); var networkAddress = NetworkManager.CalNetworkAddress(ip, sub).ToString(); networkAddress = networkAddress.Substring(0, networkAddress.Length - 1); for (int i = 2; i <= 254; i = i + 1) { string addr = $"{networkAddress}{i}"; UdpClient udp = new UdpClient(addr, 23452); udp.Send(new byte[] { 0 }, 1); ScaningDetail.Text = addr; } } catch (Exception) { } }, token); await t1; TaskScheduler csc = TaskScheduler.FromCurrentSynchronizationContext(); await t1.ContinueWith((t) => { var raw = NetworkManager.GetClientMac(); foreach (var item in raw) { DeviceInfo device = new DeviceInfo { Name = item[0], MacAddress = item[1], IpAddress = item[0], BroadcastAddress = NetworkManager.CalBroadcast(IPAddress.Parse(item[0]), NetworkManager.CalSubnetMask(IPAddress.Parse(item[0]))).ToString(), Port = 7, SendingCount = 1, }; bool isEqual = false; foreach (var d in data) { if (d.IpAddress == device.IpAddress) { isEqual = true; } } if (!isEqual) { sqlite.Insert(device); } } data = sqlite.QueryAll(); adapter = new DeviceListAdapter(this, Resource.Layout.device_list_item, data); DeviceList.Adapter = adapter; if (data.Count != 0) { DeviceList.Visibility = ViewStates.Visible; Tips.Visibility = ViewStates.Gone; } show.Dismiss(); }, token, TaskContinuationOptions.AttachedToParent, csc); }
private void ImgButtonOnClick(ReactionsClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (UserDetails.SoundControl) { Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("reaction.mp3"); } Reaction data = MReactionPack[e.Position]; UpdateReactButtonByReaction(data); MReactAlertDialog.Dismiss(); PostData.NewsFeedClass.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); if (data.GetReactText() == ReactConstants.Like) { PostData.NewsFeedClass.Reaction.Type = "1"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Like").Value?.Id ?? "1"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Love) { PostData.NewsFeedClass.Reaction.Type = "2"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Love").Value?.Id ?? "2"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.HaHa) { PostData.NewsFeedClass.Reaction.Type = "3"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "HaHa").Value?.Id ?? "3"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Wow) { PostData.NewsFeedClass.Reaction.Type = "4"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Wow").Value?.Id ?? "4"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Sad) { PostData.NewsFeedClass.Reaction.Type = "5"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Sad").Value?.Id ?? "5"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Angry) { PostData.NewsFeedClass.Reaction.Type = "6"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Angry").Value?.Id ?? "6"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } if (PostData.NewsFeedClass.Reaction.IsReacted != null && !PostData.NewsFeedClass.Reaction.IsReacted.Value) { PostData.NewsFeedClass.Reaction.IsReacted = true; PostData.NewsFeedClass.Reaction.Count++; if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.LikeText1); if (likeCount != null && (!likeCount.Text.Contains("K") && !likeCount.Text.Contains("M"))) { var x = Convert.ToInt32(likeCount.Text); x++; likeCount.Text = Convert.ToString(x, CultureInfo.InvariantCulture); } } else { var dataGlobal = NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostData.NewsFeedClass.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let index = NativeFeedAdapter.ListDiffer.IndexOf(dataClass) where index > -1 select dataClass) { dataClass.PostData = PostData.NewsFeedClass; if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { dataClass.PostData.PostLikes = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { dataClass.PostData.PostLikes = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } NativeFeedAdapter.NotifyItemChanged(NativeFeedAdapter.ListDiffer.IndexOf(dataClass), "reaction"); } } var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.Likecount); if (likeCount != null) { likeCount.Text = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public override bool OnOptionsItemSelected(IMenuItem item) { //Setup the view and click event for adding an exercise to the database //reuse the axml from editExercise View view = LayoutInflater.Inflate(Resource.Layout.EditExerciseDialog, null); Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(Context); builder.SetView(view); Android.Support.V7.App.AlertDialog alertDialog = builder.Create(); Button okButton = view.FindViewById <Button>(Resource.Id.btnCreate); Button cancelButton = view.FindViewById <Button>(Resource.Id.btnCancel); EditText txtName = view.FindViewById <EditText>(Resource.Id.txtExerciseName); EditText txtSets = view.FindViewById <EditText>(Resource.Id.txtSets); EditText txtReps = view.FindViewById <EditText>(Resource.Id.txtReps); EditText txtWeight = view.FindViewById <EditText>(Resource.Id.txtWeight); EditText txtEquipment = view.FindViewById <EditText>(Resource.Id.txtEquipment); EditText txtTargetArea = view.FindViewById <EditText>(Resource.Id.txtTargetArea); TextView txtTitle = view.FindViewById <TextView>(Resource.Id.titlePlaylist); txtTitle.Text = "Create Exercise"; okButton.Click += delegate { //Need a valid name, the rest can be 0 or N/A if (string.IsNullOrEmpty(txtName.Text)) { Toast.MakeText(Context, "Please enter a valid name.", ToastLength.Short).Show(); } if (string.IsNullOrEmpty(txtSets.Text)) { txtSets.Text = "0"; } if (string.IsNullOrEmpty(txtReps.Text)) { txtReps.Text = "0"; } if (string.IsNullOrEmpty(txtWeight.Text)) { txtWeight.Text = "N/A"; } if (string.IsNullOrEmpty(txtEquipment.Text)) { txtEquipment.Text = "N/A"; } if (string.IsNullOrEmpty(txtTargetArea.Text)) { txtTargetArea.Text = "Other"; } dbExercise newExercise = new dbExercise { name = txtName.Text, sets = txtSets.Text, reps = txtReps.Text, weight = txtWeight.Text, equipment = txtEquipment.Text, targetArea = txtTargetArea.Text }; if (db.InsertIntoTableExercise(newExercise)) { Toast.MakeText(Context, "Exercise added.", ToastLength.Short).Show(); //update exercise in recyclerview list to add to the recyclerview list adapter.addItem(newExercise, adapter.ItemCount); alertDialog.Dismiss(); } else { Toast.MakeText(Context, "Name is taken.", ToastLength.Short).Show(); } }; cancelButton.Click += delegate { alertDialog.Dismiss(); }; alertDialog.Show(); return(true); }
//search button press private async void FabOnClick(object sender, EventArgs eventArgs) { //fetch localized strings (these get passed to adapters) var busy = Resources.GetText(Resource.String.busy); var free = Resources.GetText(Resource.String.free); try { CloseKeyboard(); if (!CrossConnectivity.Current.IsConnected) //connection check, to see if worth calling API { var errorConnectionMessage = Resources.GetText(Resource.String.errorConnectionMessage); var errorConnectionTitle = Resources.GetText(Resource.String.errorConnectionTitle); CreateAlert(AlertType.Error, errorConnectionMessage, errorConnectionTitle); return; } List <Welcome> results = new List <Welcome>(); //API SEARCH ALL ROOM NUMBERS AND SHOW IF FREE NOW if (queryString == null) { var searchAll = Resources.GetText(Resource.String.searchAll); CreateAlert(AlertType.Load, searchAll, ""); //type of search results = await timetableAPI.GetAllRooms(); var roomOrder = results.OrderBy(c => c.Room.RoomNo); //sort by room num using LINQ results = roomOrder.ToList(); List <int> roomNum = new List <int>(); //used to further refine and add to below list List <int> roomNumOrdered = new List <int>(); List <bool> isRoomBusy = new List <bool>(); //get unique room numbers foreach (Welcome result in results) { if (!roomNum.Contains((int)result.Room.RoomNo)) { roomNum.Add((int)result.Room.RoomNo); } } //sort by room where has a timetable for right now var orderByTimeNow = results .OrderBy(c => c.Room.RoomNo) .Where(c => c.StartTime.Day.ToString() == DayToSearch && c.StartTime.Hour == DateTime.UtcNow.Hour); results = orderByTimeNow.ToList(); //if true, labs have timetables scheduled for right now if (results.Count != 0) { for (int i = 0; i < roomNum.Count; i++) { foreach (Welcome result in results) { if (result.Room.RoomNo == roomNum[i]) { //we add to the lists similtaniously to keep the pair in order roomNumOrdered.Add((int)result.Room.RoomNo); isRoomBusy.Add(result.Room.isBusy); } } } for (int i = 0; i < roomNum.Count; i++) { //for rooms not already in the list if (!roomNumOrdered.Contains(roomNum[i])) { roomNumOrdered.Add(roomNum[i]); isRoomBusy.Add(false); } } } //no timetable data == the room is definetly free else { for (int i = 0; i < roomNum.Count; i++) { roomNumOrdered.Add(roomNum[i]); isRoomBusy.Add(false); } } //create list of room nums and their status + pass localized busy & free strings to adapter var adapterRoomNum = new ListView_RoomNumAdapter(this, roomNumOrdered, isRoomBusy, busy, free); listTimetable.Adapter = adapterRoomNum; if (dialog.IsShowing) { dialog.Dismiss(); } return; } else if (queryString != null) //GET specific room timetable for TODAY { var searchSpecificRoom1 = Resources.GetText(Resource.String.searchSpecificRoom1); var searchSpecificRoom2 = Resources.GetText(Resource.String.searchSpecificRoom2); CreateAlert(AlertType.Load, searchSpecificRoom1 + " " + queryString + searchSpecificRoom2 + " " + DayToSearch, ""); results = await timetableAPI.GetRoomOnDay(queryInt, DayToSearch); var roomOrder = results.OrderBy(c => c.StartTime.Hour); //sort by start time using LINQ results = roomOrder.ToList(); if (results.Count == 0) //if room doesn't exist, display alert { dialog.Dismiss(); var errorRoomNotExistMessage = Resources.GetText(Resource.String.errorRoomNotExistMessage); var errorRoomNotExistTitle = Resources.GetText(Resource.String.errorRoomNotExistTitle); CreateAlert(AlertType.Error, errorRoomNotExistMessage + " " + DayToSearch, errorRoomNotExistTitle); return; } } var adapter = new ListView_TimetableAdapter(this, results, busy, free); listTimetable.Adapter = adapter; if (dialog.IsShowing) { dialog.Dismiss(); } } catch (Exception ex) { Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show(); } /* * View view = (View)sender; * Snackbar.Make(view, "Replace with your own action", Snackbar.LengthLong) * .SetAction("Action", (Android.Views.View.IOnClickListener)null).Show(); */ }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); //Set your main view here SetContentView(Resource.Layout.MainLayout); IsConnectedToNetwork = CrossConnectivity.Current.IsConnected; //check the initial state of connection Console.WriteLine("SESSION COUNT : " + session_names.Count); if (session_names.Count == 0) { if (IsConnectedToNetwork == false) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); } else { await refreshSession(); } } else { if (Intent.GetStringExtra("FromAddActivtiy") != "" && IsConnectedToNetwork) { session_names.Add(Intent.GetStringExtra("FromAddActivtiy")); listView = FindViewById <SwipeableListView>(Resource.Id.listView); myCustomAdapter = new CustomAdapter(this, session_names, active_session_position);//,sessionsRating); listView.Adapter = myCustomAdapter; } else { listView.Adapter = null; } } //to check whether the device is connected to network CrossConnectivity.Current.ConnectivityChanged += async delegate { if (CrossConnectivity.Current.IsConnected != true) { string message = "Please Check your Internet Connection And Try Again."; displayProgressDialog(message); IsConnectedToNetwork = false; } if (CrossConnectivity.Current.IsConnected == true) { if (alertDialog.IsShowing) { alertDialog.Dismiss(); } await refreshSession(); IsConnectedToNetwork = true; } }; }
/// <summary> /// Change Password /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ResetPassword_Click(object sender, EventArgs e) { LayoutInflater inflater = LayoutInflater.From(this); View view = inflater.Inflate(Resource.Layout.dialog_reset_password, null); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetView(view); var newPassword = view.FindViewById <EditText>(Resource.Id.dialog_reset_pass); var passwordRpt = view.FindViewById <EditText>(Resource.Id.dialog_reset_pass_rpt); var passwordError = view.FindViewById <TextView>(Resource.Id.dialog_reset_pass_error); alertBuilder.SetTitle("Reset Password") .SetPositiveButton("Submit", delegate { try { var user = auth.CurrentUser.UpdatePassword(newPassword.Text); Toast.MakeText(this, "Done!", ToastLength.Long).Show(); //signout } catch (Exception ex) { Toast.MakeText(this, "An error occured. Sorry.", ToastLength.Long).Show(); } }) .SetNegativeButton("Cancel", delegate { alertBuilder.Dispose(); }); AlertDialog alertDialog = alertBuilder.Create(); alertDialog.Show(); var submit = alertDialog.GetButton((int)DialogButtonType.Positive); submit.Click += delegate { if (!passwordRpt.Text.Equals(newPassword.Text)) { passwordError.Text = "Passwords must match"; } else { //update current user var user = auth.CurrentUser; if (user != null) { user.UpdatePassword(newPassword.Text); Toast.MakeText(this, "Done!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "You are not logged in!", ToastLength.Long).Show(); } alertDialog.Dismiss(); } }; }