コード例 #1
0
        private void PrepareUI()
        {
            try
            {
                PrepareGestureRecognizerEvents();
                uiviewtwo.Hidden = true;
                uiviewStudentInfo.BackgroundColor = UIColor.White;
                lblAttendanceReport.TextColor     = UIColor.White;

                StaticMethods.SetPadding(txtFrom, 30);
                StaticMethods.SetPadding(txtTo, 30);

                var type = StaticMethods.DeviceType();
                if (type != "ipad")
                {
                    uiviewCalender.Frame = new CoreGraphics.CGRect(uiviewCalender.Frame.X,
                                                                   uiviewCalender.Frame.Y + 50,
                                                                   uiviewCalender.Frame.Width,
                                                                   uiviewCalender.Frame.Height);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
 private void PrepareUI()
 {
     try
     {
         StaticMethods.SetPadding(txtEmail, 20);
         StaticMethods.SetTextFieldLeftIcon(txtEmail, "email.png");
         txtEmail.Layer.BorderColor = UIColor.LightGray.CGColor;
         txtEmail.Layer.BorderWidth = 1;
     }
     catch (Exception ex)
     {
     }
 }
コード例 #3
0
 private void PrepareUI()
 {
     try
     {
         txtWritehere.Layer.BorderWidth = 4;
         txtWritehere.Layer.BorderColor = new UIColor(red: 1f, green: 0.79f, blue: 0f, alpha: 1.0f).CGColor;
         StaticMethods.SetPadding(txtWritehere, 10);
         typingimage_frame = imgTyping.Frame;
     }
     catch (Exception ex)
     {
     }
 }
コード例 #4
0
        private void PrepareUI()
        {
            try
            {
                txtDropdown.Layer.BorderColor = UIColor.LightGray.CGColor;
                txtDropdown.Layer.BorderWidth = 1;
                StaticMethods.SetPadding(txtDropdown, 40);

                txtReason.Layer.BorderColor = UIColor.LightGray.CGColor;
                txtReason.Layer.BorderWidth = 1;
                StaticMethods.SetPadding(txtReason, 40);

                lblDescription.TextColor           = UIColor.LightGray;
                txtDropdown.UserInteractionEnabled = true;


                lblYearTitle.Text = DateTime.Now.ToString("Y").Trim(',');
            }
            catch (Exception ex)
            {
            }
        }
コード例 #5
0
        public void PrepareDatePicker(UITextField textfield)
        {
            try
            {
                UIDatePicker datepicker = new UIDatePicker();
                datepicker.Mode = UIDatePickerMode.Date;

                // Setup the toolbar
                UIToolbar toolbar = new UIToolbar();
                toolbar.BarStyle        = UIBarStyle.BlackOpaque;
                toolbar.BackgroundColor = new UIColor(red: 0f, green: 0.687f, blue: 0.495f, alpha: 1.0f);
                toolbar.Translucent     = true;
                toolbar.SizeToFit();

                // Create a 'done' button for the toolbar and add it to the toolbar
                UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                                                 (s, e) =>
                {
                    textfield.ResignFirstResponder();
                });
                doneButton.TintColor = UIColor.White;
                toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);

                // Tell the textbox to use the picker for input
                textfield.InputView = datepicker;
                StaticMethods.SetPadding(textfield, 35);
                // Display the toolbar over the pickers
                textfield.InputAccessoryView = toolbar;
                datepicker.ValueChanged     += (sender, e) =>
                {
                    var date = Convert.ToDateTime((sender as UIDatePicker).Date.ToString()).ToString("yyyy-MM-dd");
                    textfield.Text = date.ToString();
                };
            }
            catch (Exception ex)
            {
            }
        }
コード例 #6
0
        private void PrepareUI()
        {
            try
            {
                //StaticMethods.SetTextFieldLeftIcon(txtCurrentPassword, "password.png");
                txtCurrentPassword.Layer.BorderColor = UIColor.LightGray.CGColor;
                txtCurrentPassword.Layer.BorderWidth = 1;
                StaticMethods.SetPadding(txtCurrentPassword, 40);

                StaticMethods.SetPadding(txtNewPassword, 40);
                //StaticMethods.SetTextFieldLeftIcon(txtNewPassword, "password.png");
                txtNewPassword.Layer.BorderColor = UIColor.LightGray.CGColor;
                txtNewPassword.Layer.BorderWidth = 1;

                StaticMethods.SetPadding(txtConfirmPassword, 40);
                //StaticMethods.SetTextFieldLeftIcon(txtConfirmPassword, "password.png");
                txtConfirmPassword.Layer.BorderColor = UIColor.LightGray.CGColor;
                txtConfirmPassword.Layer.BorderWidth = 1;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NSUrl url = new NSUrl(SocketUrl + StaticDataModel.UserId);

            webSocket = new WebSocket(url);
            webSocket.Open();
            ap = new AppDelegate();
            tableviewActualSize             = tblConversation.Frame;
            textfield                       = new UITextField(new RectangleF((float)txtWritehere.Frame.X, 30, (float)txtWritehere.Frame.Width, (float)txtWritehere.Frame.Height));
            textfield.BackgroundColor       = UIColor.White;
            textfield.Layer.CornerRadius    = 14;
            textfield.Layer.BorderWidth     = 4;
            textfield.Layer.BorderColor     = new UIColor(red: 1f, green: 0.79f, blue: 0f, alpha: 1.0f).CGColor;
            textfield.AttributedPlaceholder = new NSAttributedString("Write here", null, UIColor.DarkGray);
            textfield.Font                  = txtWritehere.Font;
            textfield.BorderStyle           = UITextBorderStyle.RoundedRect;
            StaticMethods.SetPadding(textfield, 5);

            textfield.ShouldReturn += (textField) =>
            {
                textField.ResignFirstResponder();

                return(true);
            };

            txtWritehere.ShouldReturn += (textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };

            UIKeyboard.Notifications.ObserveWillShow((sender, e) =>
            {
                textfield.BecomeFirstResponder();
                if (StaticMethods.DeviceType() == "ipad")
                {
                    imgTyping.Frame = new CoreGraphics.CGRect(typingimage_frame.X,
                                                              typingimage_frame.Y - 300,
                                                              typingimage_frame.Width,
                                                              typingimage_frame.Height);
                }
                else
                {
                    imgTyping.Frame = new CoreGraphics.CGRect(typingimage_frame.X,
                                                              typingimage_frame.Y - 200,
                                                              typingimage_frame.Width,
                                                              typingimage_frame.Height);
                }
            });
            UIKeyboard.Notifications.ObserveWillHide((sender, e) =>
            {
                textfield.BecomeFirstResponder();
                tblConversation.Frame = tableviewActualSize;
                txtWritehere.Text     = textfield.Text;
                imgTyping.Frame       = typingimage_frame;
            });

            txtWritehere.AttributedPlaceholder = new NSAttributedString("Write here", null, UIColor.DarkGray);

            this.txtWritehere.ShouldChangeCharacters = (textField, range, replacementString) =>
            {
                SendSocketMessage("type");
                return(true);
            };
            GetStudentConversation();
            // Create request for remote resource

            webSocket.WebSocketOpened += (sender, e) =>
            {
                // the socket was opened, so we can start using it
                IsConnected = true;
                SendSocketMessage("read");
            };


            webSocket.ReceivedMessage += (sender, e) =>
            {
                JObject jObj = JObject.Parse(e.Message.ToString());
                Console.WriteLine(e.Message.ToString());
                StaticDataModel.SocketSessionId = jObj["sessionId"].ToString();
                StaticDataModel.SocketFlag      = jObj["flag"].ToString();
                if (StaticDataModel.SocketFlag == "message")
                {
                    var id      = jObj["user_id"].ToString();
                    var message = jObj["message"].ToString();
                    //if (message != "1" && message != "read_unread_check")
                    //{
                    if (id == StaticDataModel.UserId.ToString())
                    {
                        if (message == "1")
                        {
                            imgTyping.Hidden = false;
                            Console.WriteLine("Typing....");
                        }
                        else if (message == "read_unread_check")
                        {
                            Console.WriteLine("Seen....");
                            model.Select(c => { c.status = 1; return(c); }).ToList();
                            RefreshTableview();
                            imgTyping.Hidden = true;
                        }
                        else
                        {
                            addCurrentMessagesTotableview(0, 0, message);
                            SendSocketMessage("read");
                            imgTyping.Hidden = true;
                        }
                    }
                    //}
                }
            };
            PrepareUI();
            SetData();


            imgBack.AddGestureRecognizer(new UITapGestureRecognizer(ro =>
            {
                if (!StaticDataModel.isFromNotification)
                {
                    this.DismissModalViewController(false);
                }
                else
                {
                    if (StaticDataModel.CurrentLanguage == "en")
                    {
                        Home home = ap.MainStoryboard.InstantiateViewController("Home") as Home;
                        UIApplication.SharedApplication.KeyWindow.RootViewController = home;
                        //StaticMethods.ChangeLocalization("en")
                    }
                    else
                    {
                        Home home = ap.Main_ArabicStoryboard.InstantiateViewController("Home") as Home;
                        UIApplication.SharedApplication.KeyWindow.RootViewController = home;
                        //StaticMethods.ChangeLocalization("ar");
                    }
                }
            }));

            txtWritehere.EditingDidBegin += TxtWritehere_EditingDidBegin;
        }