Пример #1
0
 private void SetMaxLength(cxEntry view)
 {
     try{
         Control.SetFilters(new IInputFilter[] { new global::Android.Text.InputFilterLengthFilter(view.MaxLength) });
     }
     catch (System.Exception ex)
     {
         Insights.Send("SetMaxLength", ex);
     }
 }
Пример #2
0
 private void SetBorder(cxEntry view)
 {
     try{
         this.Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
     }
     catch (System.Exception ex)
     {
         Insights.Send("SetBorder", ex);
     }
 }
Пример #3
0
    void UpdateUi(cxEntry view)
    {
        try{
            if (!string.IsNullOrEmpty(view.FontFamily))
            {
                string filename = view.FontFamily;

                if (filename.LastIndexOf(".", System.StringComparison.Ordinal) != filename.Length - 4)
                {
                    filename = string.Format("{0}.ttf", filename);
                }

                Control.Typeface = TrySetFont(filename);
            }

            if (view.FontSize > 0)
            {
                Control.TextSize = (float)view.FontSize;
            }

            if (view.PlaceholderTextColor != Xamarin.Forms.Color.Default)
            {
                Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());
            }

            if (view.HasBorder != false)
            {
                //return;
            }

            switch (view.Alignment)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterHorizontal;
                break;

            case Xamarin.Forms.TextAlignment.End:
                Control.Gravity = GravityFlags.End;
                break;

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Start;
                break;
            }
        }
        catch (System.Exception ex)
        {
            Insights.Send("UpdateUi", ex);
        }
    }
Пример #4
0
 private void SetMaxLength(cxEntry view)
 {
     try{
         this.Control.ShouldChangeCharacters = (textField, range, replacementString) =>
         {
             var newLength = textField.Text.Length + replacementString.Length - range.Length;
             return(newLength <= view.MaxLength);
         };
     }
     catch (System.Exception ex)
     {
         Insights.Send("SetMaxLength", ex);
     }
 }
Пример #5
0
    private void UpdateUi(cxEntry view)
    {
        try{
            if (view.FontSize > 0)
            {
                this.Control.Font = UIFont.FromName(this.Control.Font.Name, (float)view.FontSize);
            }

            if (!string.IsNullOrEmpty(view.FontFamily))
            {
                var fontName = Path.GetFileNameWithoutExtension(view.FontFamily);

                var font = UIFont.FromName(fontName, this.Control.Font.PointSize);

                if (font != null)
                {
                    this.Control.Font = font;
                }
            }

            if (string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderTextColor != Color.Default)
            {
                NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes()
                {
                    ForegroundColor = view.PlaceholderTextColor.ToUIColor()
                });
                this.Control.AttributedPlaceholder = placeholderString;
            }

            switch (view.Alignment)
            {
            case TextAlignment.Center:
                Control.TextAlignment = UITextAlignment.Center;
                break;

            case TextAlignment.End:
                Control.TextAlignment = UITextAlignment.Right;
                break;

            case TextAlignment.Start:
                Control.TextAlignment = UITextAlignment.Left;
                break;
            }
        }
        catch (System.Exception ex)
        {
            Insights.Send("UpdateUi", ex);
        }
    }
Пример #6
0
    private void SetView(cxEntry view)
    {
        try{
            if (view == null)
            {
                return;
            }

            if (view != null)
            {
                this.UpdateUi(view);
                this.SetBorder(view);
                this.SetMaxLength(view);
                LayoutSubviews();
                return;
            }
            LayoutSubviews();
        }
        catch (System.Exception ex)
        {
            Insights.Send("SetView", ex);
        }
    }
Пример #7
0
        public ProfilePage()
        {
            try{
                Title = "Profil Pengguna";

                imgLogo = new Image()
                {
                    Source        = Shared.Classes.Optimizer.Image.FromFile("ic_profile"),
                    Aspect        = Aspect.AspectFit,
                    HeightRequest = 100,
                    WidthRequest  = 100
                };

                txtUid = new cxLabel {
                    Text              = "",
                    FontSize          = 24,
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseBoldSemi,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    TextColor         = Color.White
                };

                txtUname = new cxLabel {
                    Text              = "",
                    FontSize          = Shared.Settings.Styles.Sizes.Font.Base,
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseBoldSemi,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    TextColor         = Color.White,
                };

                txtBluetoothport = new cxEntry {
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight,
                    FontSize             = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor            = Color.Black,
                    Alignment            = TextAlignment.Center,
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.Start,
                    BackgroundColor      = Color.White,
                    Placeholder          = "Port",
                    PlaceholderTextColor = Color.Gray,
                    Text = ""
                };

                txtTimerLogout = new cxEntry {
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight,
                    FontSize             = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor            = Color.Black,
                    Alignment            = TextAlignment.Center,
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.Start,
                    BackgroundColor      = Color.White,
                    Placeholder          = "durasi (menit)",
                    PlaceholderTextColor = Color.Gray,
                    Keyboard             = Keyboard.Numeric,
                    Text = ""
                };

                lblBluetoothPort = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(10, 10, 10, 10),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        new StackLayout     {
                            Spacing           = 0,
                            Padding           = new Thickness(0, 0, 0, 0),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            Children          =
                            {
                                new cxLabel {
                                    Text              = "Bluetooth Port",
                                    FontSize          = Shared.Settings.Styles.Sizes.Font.DrawerTitle,
                                    FontFamily        = Shared.Settings.Styles.Fonts.BaseBoldSemi,
                                    HorizontalOptions = LayoutOptions.Center,
                                    VerticalOptions   = LayoutOptions.Start,
                                    TextColor         = Color.Black
                                }
                            }
                        },
                        new StackLayout     {
                            Spacing           = 0,
                            Padding           = new Thickness(30, 0, 30, 0),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            Children          =
                            {
                                txtBluetoothport,
                                Shared.Settings.Styles.Pages.LayoutLine.borderX(Color.Blue, 1)
                            }
                        }
                    }
                };

                lblTimerLogout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(10, 10, 10, 10),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        new StackLayout     {
                            Spacing           = 3,
                            Padding           = new Thickness(30, 0, 30, 0),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            Children          =
                            {
                                new cxLabel {
                                    Text              = "Timer Logout",
                                    FontSize          = Shared.Settings.Styles.Sizes.Font.DrawerTitle,
                                    FontFamily        = Shared.Settings.Styles.Fonts.BaseBoldSemi,
                                    HorizontalOptions = LayoutOptions.Center,
                                    VerticalOptions   = LayoutOptions.Start,
                                    TextColor         = Color.Black
                                },
                                new cxLabel {
                                    Text              = "Rentang waktu aplikasi akan logout otomatis",
                                    FontSize          = 14,
                                    FontFamily        = Shared.Settings.Styles.Fonts.BaseLight,
                                    HorizontalOptions = LayoutOptions.Center,
                                    VerticalOptions   = LayoutOptions.Start,
                                    TextColor         = Color.Black
                                },
                            }
                        },
                        new StackLayout     {
                            Spacing           = 0,
                            Padding           = new Thickness(30, 0, 30, 0),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            Children          =
                            {
                                txtTimerLogout,
                                Shared.Settings.Styles.Pages.LayoutLine.borderX(Color.Blue, 1)
                            }
                        }
                    }
                };

                headerLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 0, 0, 0),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        new StackLayout {
                            Spacing           = 0,
                            Padding           = new Thickness(0, 15, 0, 15),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                            Children          =
                            {
                                imgLogo,
                                txtUid,
                                txtUname
                            }
                        },
                        lblBluetoothPort,
                        lblTimerLogout
                    }
                };

                var Simpan = new cxLabel
                {
                    Text              = "Simpan",
                    TextColor         = Color.White,
                    FontSize          = 20,
                    FontFamily        = Settings.Styles.Fonts.BaseBoldSemi,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand
                };

                btnSimpan = new StackLayout
                {
                    HeightRequest     = 40,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.End,
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                    Padding           = new Thickness(0, 5, 0, 5),
                    Children          =
                    {
                        Simpan
                    }
                };

                Content = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 0, 0, 0),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        headerLayout,
                        btnSimpan
                    }
                };

                var btnLanjutTap = new TapGestureRecognizer();
                btnLanjutTap.NumberOfTapsRequired = 1;
                btnLanjutTap.Tapped += async(s, e) => {
                    MessagingCenter.Send <ParamPasser> (new ParamPasser()
                    {
                        DateParameter = DateTime.Now
                    }, "Timer");
                    SaveChanges();
                };
                btnSimpan.GestureRecognizers.Add(btnLanjutTap);
            }catch (Exception ex) {
                Shared.Services.Logs.Insights.Send("Layout", ex);
            }
        }
Пример #8
0
        public LoginPage()
        {
            try
            {
                AbsoluteLayout peakLayout = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.Transparent
                };

                imgBG = new Image()
                {
                    Source = Shared.Classes.Optimizer.Image.FromFile("coffee_mug.9"),
                    Aspect = Aspect.AspectFill,
                };

                imgLogo = new Image()
                {
                    Source        = Shared.Classes.Optimizer.Image.FromFile("ic_logo"),
                    Aspect        = Aspect.AspectFit,
                    HeightRequest = 120,
                    WidthRequest  = 170
                };

                pasarPicker = new cxPicker {
                    Title             = "Pilih Pasar",
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseBoldSemi,
                    Alignment         = TextAlignment.Center,
                    FontSize          = Shared.Settings.Styles.Sizes.Font.DrawerTitle,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    TextColor         = Color.White,
                    BackgroundColor   = Color.FromHex("7fffffff"),
                };

                #region Username
                var boxImgUsername = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                };

                var boxUsername = new BoxView()
                {
                    Color             = Color.FromHex("7fffffff"),
                    HeightRequest     = 60,
                    WidthRequest      = 60,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                imgUsername = new Image()
                {
                    Source = Shared.Classes.Optimizer.Image.FromFile("username_icon"),
                    Aspect = Aspect.AspectFill
                };

                AbsoluteLayout.SetLayoutFlags(boxUsername, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(boxUsername, new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                AbsoluteLayout.SetLayoutFlags(imgUsername, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(imgUsername, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                boxImgUsername.Children.Add(boxUsername);
                boxImgUsername.Children.Add(imgUsername);

                var boxTxtUsername = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                };

                var BoxLabelUsername = new BoxView()
                {
                    Color             = Color.FromHex("7fffffff"),
                    HeightRequest     = 60,
                    WidthRequest      = 200,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                txtUsername = new cxEntry()
                {
                    Placeholder          = "Username",
                    TextColor            = Color.Black,
                    WidthRequest         = Device.OnPlatform(175, 195, 0),
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight,
                    PlaceholderTextColor = Color.Black,
                    FontSize             = 20,
                    MaxLength            = 30,
                };

                AbsoluteLayout.SetLayoutFlags(BoxLabelUsername, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(BoxLabelUsername, new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                AbsoluteLayout.SetLayoutFlags(txtUsername, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(txtUsername, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                boxTxtUsername.Children.Add(BoxLabelUsername);
                boxTxtUsername.Children.Add(txtUsername);

                var UsernameLayout = new StackLayout()
                {
                    Spacing           = 4,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        boxImgUsername,
                        boxTxtUsername
                    }
                };
                #endregion

                #region Password
                var boxImgPassword = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                };

                var boxPassword = new BoxView()
                {
                    Color             = Color.FromHex("7fffffff"),
                    HeightRequest     = 60,
                    WidthRequest      = 60,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                imgPassword = new Image()
                {
                    Source = Shared.Classes.Optimizer.Image.FromFile("password_icon"),
                    Aspect = Aspect.AspectFill
                };

                AbsoluteLayout.SetLayoutFlags(boxPassword, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(boxPassword, new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                AbsoluteLayout.SetLayoutFlags(imgPassword, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(imgPassword, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                boxImgPassword.Children.Add(boxPassword);
                boxImgPassword.Children.Add(imgPassword);

                var boxTxtPassword = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                };

                var BoxLabelPassword = new BoxView()
                {
                    Color             = Color.FromHex("7fffffff"),
                    HeightRequest     = 60,
                    WidthRequest      = 200,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                txtPassword = new cxEntry()
                {
                    Placeholder          = "Password",
                    TextColor            = Color.Black,
                    WidthRequest         = Device.OnPlatform(175, 195, 0),
                    IsPassword           = true,
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight,
                    PlaceholderTextColor = Color.Black,
                    FontSize             = 20,
                    MaxLength            = 30,
                };

                AbsoluteLayout.SetLayoutFlags(BoxLabelPassword, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(BoxLabelPassword, new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                AbsoluteLayout.SetLayoutFlags(txtPassword, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(txtPassword, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                boxTxtPassword.Children.Add(BoxLabelPassword);
                boxTxtPassword.Children.Add(txtPassword);

                var PasswordLayout = new StackLayout()
                {
                    Spacing           = 4,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        boxImgPassword,
                        boxTxtPassword
                    }
                };
                #endregion

                #region button
                BtnLogin = new cxButton
                {
                    Text            = "LOGIN",
                    TextColor       = Color.White,
                    FontSize        = 20,
                    FontFamily      = Shared.Settings.Styles.Fonts.Base,
                    BackgroundColor = Shared.Settings.Styles.Colors.Background.LightBlue,
                    HeightRequest   = 50,
                    WidthRequest    = 265,
                };
                #endregion

                var fields = new StackLayout()
                {
                    Spacing           = 8,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Children          =
                    {
                        pasarPicker,
                        UsernameLayout,
                        PasswordLayout
                    }
                };

                versionLabel = new cxLabel
                {
                    Text              = "",
                    FontSize          = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor         = Color.White,
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseLight,
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center,
                };

                var buttons = new StackLayout()
                {
                    Spacing           = 8,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Children          =
                    {
                        BtnLogin,
                        versionLabel
                    }
                };

                AbsoluteLayout.SetLayoutFlags(imgBG, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(imgBG, new Rectangle(0, 0, 1f, 1f));

                AbsoluteLayout.SetLayoutFlags(imgLogo, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(imgLogo,
                                               new Rectangle(0.5, 0.15, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                AbsoluteLayout.SetLayoutFlags(fields, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(fields,
                                               new Rectangle(0.5, 0.55, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                AbsoluteLayout.SetLayoutFlags(buttons, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(buttons,
                                               new Rectangle(0.5, 0.9, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

                peakLayout.Children.Add(imgBG);
                peakLayout.Children.Add(imgLogo);
                peakLayout.Children.Add(fields);
                peakLayout.Children.Add(buttons);

                var MainLayout = new StackLayout {
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.Accent,
                    Spacing           = 0,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Children          =
                    {
                        peakLayout
                    }
                };

                Content = new StackLayout()
                {
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                    Spacing           = 0,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Children          =
                    {
                        peakLayout
                    }
                };

                pasarPicker.SelectedIndexChanged += (sender, e) => {
                    if (pasarPicker.SelectedIndex != -1)
                    {
                        strKdPasar = contPasar[pasarPicker.SelectedIndex].kdpasar.ToString();
                    }
                };

                txtUsername.Completed += (sender, e) => {
                    txtPassword.Focus();
                };

                txtPassword.Completed += (sender, e) => {
                    if (pasarPicker.SelectedIndex != -1)
                    {
                        Login(txtUsername.Text.Trim(), txtPassword.Text.Trim());
                    }
                    else
                    {
                        Shared.Settings.Panels.Alert.Display("Mohon pilih pasar yang akan dituju", "Pasar Tidak Ditemukan", "OK");
                    }
                };

                BtnLogin.Clicked += (sender, e) =>
                {
                    if (pasarPicker.SelectedIndex != -1)
                    {
                        Login(txtUsername.Text.Trim(), txtPassword.Text.Trim());
                    }
                    else
                    {
                        Shared.Settings.Panels.Alert.Display("Mohon pilih pasar yang akan dituju", "Pasar Tidak Ditemukan", "OK");
                    }
                };
            }
            catch (Exception ex)
            {
                Shared.Services.Logs.Insights.Send("Layout", ex);
            }
        }
Пример #9
0
        public HomePage()
        {
            try{
                Title = "REKENING STAND";

                #region filter
                txtAlamatStand = new cxEntry {
                    Placeholder          = "Cari stand",
                    PlaceholderTextColor = Color.White,
                    TextColor            = Color.White,
                    FontSize             = Shared.Settings.Styles.Sizes.Font.Base,
                    BackgroundColor      = Color.Transparent,
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.Center,
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight
                };

                txtNmped = new cxEntry {
                    Placeholder          = "Cari pedagang",
                    PlaceholderTextColor = Color.White,
                    TextColor            = Color.White,
                    FontSize             = Shared.Settings.Styles.Sizes.Font.Base,
                    BackgroundColor      = Color.Transparent,
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.Center,
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight
                };

                btnCariStand = new cxButton {
                    Text              = "Cari",
                    TextColor         = Color.White,
                    FontSize          = 14,
                    HorizontalOptions = LayoutOptions.EndAndExpand,
                    VerticalOptions   = LayoutOptions.Center,
                    BackgroundColor   = Color.FromHex("7fffffff"),
                    BorderColor       = Color.White,
                    Alignment         = TextAlignment.Center,
                };

                cariStandLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(20, 5, 20, 5),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Start,
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                    Children          =
                    {
                        txtAlamatStand,
                        txtNmped
                    }
                };
                #endregion

                filterLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 0, 20, 0),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Start,
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        cariStandLayout,
                        btnCariStand
                    }
                };

                #region selected item
                txtSelectedItem = new cxLabel {
                    Text              = "0",
                    FontSize          = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor         = Color.Black,
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseLight,
                    FontAttributes    = FontAttributes.Bold,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center
                };

                txtSelectedItemDesc = new cxLabel {
                    Text              = " stand ditandai",
                    FontSize          = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor         = Color.Black,
                    FontFamily        = Shared.Settings.Styles.Fonts.BaseLight,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center
                };

                selectedItemLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 5, 0, 5),
                    BackgroundColor   = Color.White,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.End,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        txtSelectedItem,
                        txtSelectedItemDesc
                    }
                };
                #endregion

                #region btnNextLayout
                btnLanjutLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 5, 0, 5),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.End,
                    HeightRequest     = 50,
                    BackgroundColor   = Shared.Settings.Styles.Colors.Background.LightBlue,
                    Children          =
                    {
                        new Label {
                            Text              = "Lanjut",
                            FontSize          = 20,
                            TextColor         = Color.White,
                            FontFamily        = Shared.Settings.Styles.Fonts.BaseLight,
                            HorizontalOptions = LayoutOptions.Center,
                            VerticalOptions   = LayoutOptions.Center
                        }
                    }
                };
                btnLanjutLayout.IsVisible = false;
                #endregion

                StandSearchResultLV = new Shared.Classes.Components.ListViews.SearchResult(typeof(Shared.Modules.DataTemplates.RekeningStand.StandSearchResult));
                StandSearchResultLV.IsPullToRefreshEnabled = false;

                allLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(0, 0, 0, 0),
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        filterLayout,
                        new StackLayout {
                            Spacing           = 0,
                            Padding           = new Thickness(20,       0, 20, 0),
                            VerticalOptions   = LayoutOptions.FillAndExpand,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor   = Color.White,
                            Children          =
                            {
                                StandSearchResultLV
                            }
                        },
                        selectedItemLayout,
                        btnLanjutLayout
                    }
                };

                Content = allLayout;

                var tool = Shared.Classes.Components.Toolbar.Toolbar.Secondary(
                    "Reset",
                    "",
                    new Command(() =>
                {
                    txtAlamatStand.Text = "";
                    txtNmped.Text       = "";
                })
                    );

                var tool1 = Shared.Classes.Components.Toolbar.Toolbar.Secondary(
                    "Hapus Semua Tanda",
                    "",
                    new Command(() =>
                {
                    contSelectedStand.Clear();
                    txtSelectedItem.Text         = contSelectedStand.Count.ToString();
                    selectedItemLayout.IsVisible = false;
                })
                    );

                ToolbarItems.Add(tool);
                ToolbarItems.Add(tool1);

                StandSearchResultLV.ItemSelected += (sender, e) => {
                    OnSelection(sender, e);
                };

                btnCariStand.Clicked += async(sender, e) => {
                    MessagingCenter.Send <ParamPasser> (new ParamPasser()
                    {
                        DateParameter = DateTime.Now
                    }, "Timer");
                    cachedAccessCredential = await Shared.Classes.Cache.cxCache.AccessCredential.Collect();

                    GetRekStand(cachedAccessCredential.Kdpasar, txtAlamatStand.Text, txtNmped.Text);
                };


                var btnLanjutTap = new TapGestureRecognizer();
                btnLanjutTap.NumberOfTapsRequired = 1;
                btnLanjutTap.Tapped += async(s, e) => {
                    MessagingCenter.Send <ParamPasser> (new ParamPasser()
                    {
                        DateParameter = DateTime.Now
                    }, "Timer");
                    if (contSelectedStand.Count >= 1)
                    {
                        cachedAccessCredential = await Shared.Classes.Cache.cxCache.AccessCredential.Collect();

                        await Navigation.PushAsync(new Shared.Modules.Pages.RekeningStand.StandReview(contSelectedStand, cachedAccessCredential.Kdpasar, "", ""), true);
                    }
                    else
                    {
                        Shared.Settings.Panels.Alert.Display("Mohon tandai setidaknya satu stand", "Gagal Melanjutkan Proses", "OK");
                    }
                };
                btnLanjutLayout.GestureRecognizers.Add(btnLanjutTap);
            }catch (Exception ex) {
                Shared.Services.Logs.Insights.Send("Layout", ex);
                throw ex;
            }
        }
Пример #10
0
        public BluetoothPage(string kdpasar, string userid, string username, string password, DateTime datestart, DateTime dateend, string status, string tglclose)
        {
            try{
                Title = "Bluetooth Printer Port";

                strKdpasar  = kdpasar;
                strUserID   = userid;
                strUsername = username;
                strPassword = password;
                dateStart   = datestart;
                dateEnd     = dateend;
                Stts        = status;
                tgl_close   = tglclose;

                txtRemark = new cxEntry {
                    FontFamily           = Shared.Settings.Styles.Fonts.BaseLight,
                    FontSize             = Shared.Settings.Styles.Sizes.Font.Base,
                    TextColor            = Color.Black,
                    Alignment            = TextAlignment.Center,
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.Start,
                    BackgroundColor      = Color.White,
                    Placeholder          = "Port",
                    PlaceholderTextColor = Color.Gray,
                    Text = ""
                };

                remarkLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(15, 15, 15, 15),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Start,
                    BackgroundColor   = Color.White,
                    HeightRequest     = 150,
                    Children          =
                    {
                        txtRemark,
                        Shared.Settings.Styles.Pages.LayoutLine.borderX(Color.Blue, 1)
                    }
                };

                btnSubmit = new cxButton
                {
                    Text          = "SIMPAN",
                    TextColor     = Color.White,
                    FontSize      = 20,
                    FontFamily    = Shared.Settings.Styles.Fonts.Base,
                    HeightRequest = 50,
                    WidthRequest  = 265,
                };
                btnSubmit.BackgroundColor = Shared.Settings.Styles.Colors.Background.DarkRed;

                btnLayout = new StackLayout {
                    Spacing           = 0,
                    Padding           = new Thickness(10, 20, 10, 0),
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Start,
                    HeightRequest     = 50,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        btnSubmit
                    }
                };

                Content = new StackLayout {
                    Spacing           = 0,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        new StackLayout     {
                            Spacing           = 0,
                            Padding           = new Thickness(20, 10, 20, 10),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.Start,
                            BackgroundColor   = Color.White,
                            Children          =
                            {
                                new cxLabel {
                                    Text                    = "Silakan memasukkan Bluetooth Printer Port yang tertera pada printer Anda.",
                                    FontSize                = Shared.Settings.Styles.Sizes.Font.Base,
                                    FontFamily              = Shared.Settings.Styles.Fonts.BaseLight,
                                    TextColor               = Color.Black,
                                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                                    VerticalOptions         = LayoutOptions.CenterAndExpand,
                                    HorizontalTextAlignment = TextAlignment.Start,
                                    VerticalTextAlignment   = TextAlignment.Start
                                }
                            }
                        },
                        remarkLayout,
                        btnLayout
                    }
                };

                btnSubmit.Clicked += async(sender, e) => {
                    if (txtRemark.Text != "" && txtRemark.Text.Length > 0)
                    {
                        var data = Shared.Classes.Cache.cxCache.AccessCredential.container(strKdpasar, strUserID, strUsername, strPassword, dateStart.ToString("dd/MM/yyyy hh:mm:ss"), dateEnd.ToString("dd/MM/yyyy hh:mm:ss"), Stts, tgl_close, txtRemark.Text.Trim());
                        await Shared.Classes.Cache.cxCache.AccessCredential.Store(data);

                        await DependencyService.Get <Shared.Classes.Dependencies.Interfaces.ISaveAndLoad>().SaveTextAsync("PDPS_PRINTER_PORT.txt", txtRemark.Text.Trim());

                        MessagingCenter.Send <ParamPasser> (new ParamPasser()
                        {
                            boolParameter = true
                        }, "Update");
                        MessagingCenter.Send <ParamPasser> (new ParamPasser()
                        {
                            boolParameter = true
                        }, "Done");
                        MessagingCenter.Send <ParamPasser> (new ParamPasser()
                        {
                            stringParameter = strUsername
                        }, "User");
                        MessagingCenter.Send <ParamPasser> (new ParamPasser()
                        {
                            DateParameter = DateTime.Now
                        }, "Timer");
                        await Navigation.PopAsync(true);
                    }
                    else
                    {
                        Shared.Settings.Panels.Alert.Display("Mohon isi Bluetooth Printer Port", "Bluetooth Printer Port", "OK");
                    }
                };
            }catch (Exception ex) {
                Shared.Services.Logs.Insights.Send("Layout", ex);
            }
        }