public static StringBuilder Receive() { var buffer = new byte[256]; int size = 0; var textFromServer = new StringBuilder(); do { try { size = TcpSocket.tcpSocket.Receive(buffer); } catch (Exception ex) { AlertMessages.Show(ex.Message); TcpSocket.tcpSocket.Shutdown(SocketShutdown.Both); TcpSocket.tcpSocket.BeginDisconnect(true, new AsyncCallback(DisconnectCallback), TcpSocket.tcpSocket); IsConnected = false; ReceiveExceptionAction?.Invoke(); //_windowsViewModel.ChangeView(0); } textFromServer.Append(Encoding.UTF8.GetString(buffer, 0, size)); } while (TcpSocket.tcpSocket.Available > 0); return(textFromServer); }
async void btn_delete(object sender, System.EventArgs e) { try { var item = (MenuItem)sender; Ids = item.CommandParameter.ToString(); var deletedItem = ((GetLicenceView)this.BindingContext).LicensesDataListView.FirstOrDefault(d => d.id == Ids); var answer = await DisplayAlert("Confirmation message", AlertMessages.DeleteConfirmation(deletedItem.typeText), "Yes", "No"); if (answer == true) { if (await delet.deleteData(Ids, URLConfig.DeleteLicence)) { ((GetLicenceView)this.BindingContext).LicensesDataListView.Remove(deletedItem); mydata.ItemsSource = ((GetLicenceView)this.BindingContext).LicensesDataListView; await EmployeeProfileHelper.RefreshEmployeeCurrentProfile(true); } } } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in mylicence.xaml.cs", ex); await logged.LoggAPI(); } }
async void btn_delet(object sender, System.EventArgs e) { try { delet = new DeleteResume(); var item = (MenuItem)sender; id = item.CommandParameter.ToString(); var deletedItem = ((ResumeViewModel)this.BindingContext).ResumeViewList.FirstOrDefault(d => d.id == id); var answer = await DisplayAlert("Confirmation message", AlertMessages.DeleteConfirmation(deletedItem.@as), "Yes", "No"); if (answer == true) { await delet.deleteResume(id, URLConfig.DeleteResumes); ((ResumeViewModel)this.BindingContext).ResumeViewList.Remove(deletedItem); explist.ItemsSource = ((ResumeViewModel)this.BindingContext).ResumeViewList; await EmployeeProfileHelper.RefreshEmployeeCurrentProfile(true); } } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in myexperince.xaml.cs", ex); await logged.LoggAPI(); } }
async void Delete(object sender, System.EventArgs e) { var item = (MenuItem)sender; ids = item.CommandParameter.ToString(); var deletedItem = ((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule2.FirstOrDefault(d => d.Id == ids); var ans = await DisplayAlert("Confirmation message", AlertMessages.DeleteConfirmation(deletedItem.SpecificDateFormatted), "Yes", "No"); if (ans == true) { var succeed = await deletebutton.deleteData(ids, URLConfig.DeleteSchdeualurl); if (succeed) { ((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule2.Remove(deletedItem); EmployeeScheduleViewmodel.tempschadual.Remove(deletedItem); EmployeeProfileHelper.EmployeeCurrentProfile.EmployeeScheduels.Remove(deletedItem); EmployeeProfileHelper.RefreshEmployeeCurrentProfile(true); await DisplayAlert(AlertMessages.Success, AlertMessages.DelteMessage, AlertMessages.OkayTitle); MonthlyControlHelper.forceReload = true; //TODO : Ash test MonthlyControlHelper.ReloadAPIData(); //TODO: Added by Ashraf to refresh the data ((EmployeeScheduleViewmodel)this.BindingContext).loadData(); if (((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule2 == null) { ((EmployeeScheduleViewmodel)this.BindingContext).SlideLeft.Execute(null); } daylist.ItemsSource = ((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule2; } } }
public void Send() { _messageContent.MessageText = SendText; _messageContent.MessageTime = DateTime.Now.ToShortTimeString(); _messageContent.MessageColour = SenderReceiwer.Send; if (!_messageContent.PictureChanged) { _messageContent.MessagePicture = UserGender.GetUserGender(); } _messageContent.Name = UserInfo.Name; _messageContent.Id = User.Id; if (UserInfo.AddedPicture != null) { _messageContent.Pic = ConvertImage.ToByte(UserInfo.AddedPicture); _messageContent.MessagePicture = @"C:\Users\X\Downloads\ChatData\ChatImage" + _messageContent.Id + ".jpg"; _messageContent.PictureChanged = true; } var messageInBytes = ConverData.ToSend(_messageContent); try { TcpSocket.tcpSocket.BeginSend(messageInBytes, 0, messageInBytes.Length, SocketFlags.None, new AsyncCallback(SendCallback), TcpSocket.tcpSocket); } catch (Exception ex) { AlertMessages.Show(ex.Message); OnlineUsers.UserList.Clear(); TcpSocket.tcpSocket.Shutdown(SocketShutdown.Both); TcpSocket.tcpSocket.Disconnect(true); _windowsViewModel.ChangeView(0); return; } SendText = ""; UserInfo.AddedPicture = null; _messageContent.Pic = null; }
private static void ConnectCallback(IAsyncResult ar) { Socket client = (Socket)ar.AsyncState; try { client.EndConnect(ar); } catch (Exception) { AlertMessages.Show("Server not available! :( We are working on this issue, please try again later."); } connectDone.Set(); }
public static StudentPersonal CreateStudentPersonal() { StudentPersonal sp = new StudentPersonal(); AlertMessages alm = new AlertMessages(); alm.AddAlertMessage(AlertMessageType.LEGAL, "This is the Legal Alert for Joe Student"); sp.AlertMessages = alm; // TODO: Consider adding helper methods to the ADK that allow // list elements to be set or gotten from the parent? OtherIdList oidList = new OtherIdList(); oidList.AddOtherId(OtherIdType.SIF1x_OTHER, "P00001"); oidList.AddOtherId(OtherIdType.SIF1x_HEATH_RECORD, "WB0025"); oidList.AddOtherId(OtherIdType.SIF1x_SSN, "123-45-6789"); sp.OtherIdList = oidList; Name name = new Name(NameType.BIRTH, "Student", "Joe"); name.MiddleName = ""; name.PreferredName = "Joe"; sp.Name = name; EmailList elist = new EmailList(); elist.AddEmail(EmailType.PRIMARY, "*****@*****.**"); sp.EmailList = elist; sp.OnTimeGraduationYear = 1982; Demographics demo = new Demographics(); demo.BirthDate = new DateTime(1981, 12, 20); demo.SetCitizenshipStatus(CitizenshipStatus.USCITIZEN); CountriesOfCitizenship countries = new CountriesOfCitizenship(); countries.AddCountryOfCitizenship(CountryCode.US); countries.AddCountryOfCitizenship(CountryCode.Wrap("CA")); demo.CountriesOfCitizenship = countries; demo.SetCountryOfBirth(CountryCode.US); CountriesOfResidency cre = new CountriesOfResidency(new Country(CountryCode.IE)); demo.CountriesOfResidency = cre; demo.SetStateOfBirth(StatePrCode.AK); sp.Demographics = demo; Address addr = new Address(); addr.City = "Salt Lake City"; addr.SetStateProvince(StatePrCode.UT); addr.SetCountry(CountryCode.US); addr.PostalCode = "84102"; Street str = new Street(); str.Line1 = "1 IBM Plaza"; str.ApartmentNumber = "2000"; str.Line2 = "Suite 2000"; str.Line3 = "Salt Lake City, UT 84102"; str.StreetName = "IBM"; str.StreetNumber = "1"; str.StreetType = "Plaza"; str.ApartmentType = "Suite"; addr.Street = str; sp.AddAddressList(PickupOrDropoff.NA, "MoTuWeThFrSaSu", addr); PhoneNumberList plist = new PhoneNumberList(); plist.AddPhoneNumber(PhoneNumberType.SIF1x_HOME_PHONE, "(312) 555-1234"); sp.PhoneNumberList = plist; // Test changing the name sp.SetName(NameType.BIRTH, "STUDENT", "JOE"); return(sp); }
private async void btn_delet(object sender, EventArgs e) { try { var item = (MenuItem)sender; var selectedItem = ((DocumentsReports)this.BindingContext).FileName.FirstOrDefault(d => d.id == item.CommandParameter.ToString()); deleteLicences deletebutton = new deleteLicences(); var answer = await DisplayAlert("Confirmation message", AlertMessages.DeleteConfirmation(selectedItem.title), "Yes", "No"); if (answer == true) { await deletebutton.deleteData(item.CommandParameter.ToString(), URLConfig.DeleteAsyncurl); ((DocumentsReports)this.BindingContext).BindingMethod((int)DocumentType.MedicalReports); await EmployeeProfileHelper.RefreshEmployeeCurrentProfile(true); } } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in medicalcheck.xaml.cs", ex); await logged.LoggAPI(); } }
private async void SaveMethod() { //var result = await this.DisplayAlert("Warning", "Sure to save the User ?", "Yes", "No"); //if (result) //{ //Add Data to local storage; _userprofile.Name = txtname.Text; _userprofile.DOB = TbDob.Date.ToString(); _userprofile.Email = txtemail.Text; _userprofile.phone = txtphone.Text; _userprofile.MartialStatusId = SelectedMaritalStatusId; _userprofile.NationalityId = SelectedNationalityId; if (string.IsNullOrEmpty(_userprofile.Name) || string.IsNullOrEmpty(_userprofile.Name)) { AlertMessages.ShowAlert("please Enter Name"); return; } if (_userprofile.DOB == null) { AlertMessages.ShowAlert("please Enter Date of Birth"); return; } if (string.IsNullOrEmpty(_userprofile.Email) || string.IsNullOrEmpty(_userprofile.Email)) { AlertMessages.ShowAlert("please Enter Email"); return; } if (string.IsNullOrEmpty(_userprofile.phone) || string.IsNullOrEmpty(_userprofile.phone)) { AlertMessages.ShowAlert("please Enter phone"); return; } if (_userprofile.MartialStatusId == 0 || _userprofile.MartialStatusId == null) { AlertMessages.ShowAlert("please Select Martial Status"); return; } if (_userprofile.NationalityId == 0 || _userprofile.NationalityId == null) { AlertMessages.ShowAlert("please Select Nationality"); return; } //CommonData.CommonAppData._listUserProfile.RemoveAt() if (ItemId == 0) { var listUserProfile = new UserProfileRepository().GetAllusers(); var lastvalue = listUserProfile.Last <UserProfile>(); var NewId = lastvalue.Id + 1; _userprofile.Id = NewId; } else { _userprofile.Id = ItemId; } _userprofile.IsActive = true; if (profileimg == null) { _userprofile.image = "defaultavatar.png"; } else { _userprofile.image = profileimg; } var result = JsonConvert.SerializeObject(_userprofile); var result1 = new UserProfileRepository().AddItem(_userprofile); await Navigation.PushModalAsync(new MasterDetail()); //new NavigationPage(new UsersListView()); //} }
public AlertGroup() { Messages = new AlertMessages(); }