예제 #1
0
        public QuestionsCell()
        {
            MaterialFrame frame = new MaterialFrame();

            frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White);
            frame.HorizontalOptions = LayoutOptions.FillAndExpand;
            frame.VerticalOptions   = LayoutOptions.Start;
            frame.BackgroundColor   = Color.White;
            frame.Margin            = new Thickness(10, 0, 10, 10);
            frame.Padding           = new Thickness(18, 18, 18, 18);
            frame.CornerRadius      = 35;
            frame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frame.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);

            StackLayout container = new StackLayout();

            container.Orientation = StackOrientation.Vertical;

            title.TextColor      = Color.Black;
            title.FontAttributes = FontAttributes.Bold;
            title.FontSize       = 18;

            container.Children.Add(title);

            date.HorizontalOptions = LayoutOptions.Start;
            date.TextColor         = Color.Black;
            date.FontSize          = 12;
            date.IsVisible         = false;
            date.Margin            = new Thickness(0, -5, 0, 0);
            StackLayout containerCount = new StackLayout();

            containerCount.Orientation = StackOrientation.Horizontal;
            StackLayout containerOne = new StackLayout();

            containerOne.Orientation = StackOrientation.Horizontal;
            StackLayout containerTwo = new StackLayout();

            containerTwo.Orientation = StackOrientation.Horizontal;

            countQuestTitle.Text = $"{AppResources.QuestionsAmount}:";
            countQuestTitle.HorizontalOptions  = LayoutOptions.Start;
            countQuestTitle.FontSize           = 12;
            countAnsweredTitle.VerticalOptions = LayoutOptions.Center;
            countQuestTitle.TextColor          = Color.Black;

            countQuest.TextColor         = (Color)Application.Current.Resources["MainColor"];
            countQuest.HorizontalOptions = LayoutOptions.Start;
            countQuest.FontSize          = 12;
            countQuest.FontAttributes    = FontAttributes.Bold;

            containerOne.Children.Add(countQuestTitle);
            containerOne.Children.Add(countQuest);

            countAnsweredTitle.Text              = $"{AppResources.AnsweredAmount}:";
            countAnsweredTitle.TextColor         = Color.Black;
            countAnsweredTitle.HorizontalOptions = LayoutOptions.Start;
            countAnsweredTitle.VerticalOptions   = LayoutOptions.Center;
            countAnsweredTitle.FontSize          = 12;

            countAnswered.TextColor         = (Color)Application.Current.Resources["MainColor"];
            countAnswered.HorizontalOptions = LayoutOptions.Start;
            countAnswered.FontAttributes    = FontAttributes.Bold;
            countAnswered.FontSize          = 12;
            containerTwo.Children.Add(countAnsweredTitle);
            containerTwo.Children.Add(countAnswered);
            containerTwo.HorizontalOptions = LayoutOptions.End;

            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            // containerCount.Children.Add(containerOne);
            // containerCount.Children.Add(containerTwo);
            grid.Children.Add(containerOne, 0, 0);
            grid.Children.Add(containerTwo, 1, 0);

            container.Children.Add(date);
            container.Children.Add(grid);

            Frame frameBtn = new Frame();

            frameBtn.HorizontalOptions = LayoutOptions.FillAndExpand;
            frameBtn.VerticalOptions   = LayoutOptions.Start;
            frameBtn.BackgroundColor   = (Color)Application.Current.Resources["MainColor"];
            frameBtn.Margin            = new Thickness(0, 10, 0, 10);
            frameBtn.Padding           = 0;
            frameBtn.CornerRadius      = 10;
            frameBtn.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frameBtn.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);

            StackLayout containerBtn = new StackLayout();

            containerBtn.Spacing           = 0;
            containerBtn.Orientation       = StackOrientation.Horizontal;
            containerBtn.HorizontalOptions = LayoutOptions.CenterAndExpand;

            SvgCachedImage image = new SvgCachedImage();

            image.Source           = "resource://xamarinJKH.Resources.ic_questions2.svg";
            image.ReplaceStringMap = new Dictionary <string, string>
            {
                { "#000000", "#FFFFFF" }
            };
            // image.Margin = new Thickness(-40, 0, 0, 0);
            image.HeightRequest = 25;
            image.WidthRequest  = 25;

            // Label btn = new Label();
            // btn.Margin = new Thickness(-15, 0, 0, 0);
            // btn.TextColor = Color.White;
            // btn.FontAttributes = FontAttributes.Bold;
            // btn.Text = "Пройти опрос";


            // btn.Margin = new Thickness(-30, 0, 0, 0);
            btn.TextColor         = Color.White;
            btn.BackgroundColor   = Color.Transparent;
            btn.HorizontalOptions = LayoutOptions.Center;
            btn.Margin            = new Thickness(9, 13, 0, 13);
            btn.FontAttributes    = FontAttributes.Bold;
            btn.VerticalOptions   = LayoutOptions.Center;
            btn.FontSize          = 15;
            btn.Text = "Пройти опрос";

            containerBtn.Children.Add(image);
            containerBtn.Children.Add(btn);

            frameBtn.Content = containerBtn;

            container.Children.Add(frameBtn);
            Grid containerMain = new Grid();

            containerMain.Padding           = 0;
            containerMain.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = GridLength.Star
                },
                new ColumnDefinition {
                    Width = new GridLength(5)
                }
            };

            containerMain.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = new GridLength(5)
                },
                new RowDefinition {
                    Height = GridLength.Star
                }
            };

            containerMain.Children.Add(container);
            Grid.SetRowSpan(container, 2);
            Grid.SetColumnSpan(container, 2);

            ReadIndicator = new Frame
            {
                CornerRadius    = 5,
                BackgroundColor = Color.Red,
                IsVisible       = false
            };
            ReadIndicator.SetBinding(View.IsVisibleProperty, "Read", BindingMode.TwoWay);
            containerMain.Children.Add(ReadIndicator, 1, 0);

            frame.Content = containerMain;

            View = frame;
        }
예제 #2
0
        public AppCell()
        {
            MaterialFrame frame = new MaterialFrame();

            frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"],
                                   Color.White);
            frame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frame.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);
            frame.HorizontalOptions = LayoutOptions.FillAndExpand;
            frame.VerticalOptions   = LayoutOptions.Start;
            frame.BackgroundColor   = Color.White;
            frame.Margin            = new Thickness(10, 0, 10, 14);
            frame.Padding           = new Thickness(25, 15, 25, 20);
            frame.CornerRadius      = 40;

            StackLayout container = new StackLayout();

            container.Orientation = StackOrientation.Horizontal;

            StackLayout containerData = new StackLayout();

            containerData.HorizontalOptions = LayoutOptions.FillAndExpand;


            var arrow = new SvgCachedImage();

            arrow.Source = "resource://xamarinJKH.Resources.ic_arrow_forward.svg";
            Color hex = (Color)Application.Current.Resources["MainColor"];

            arrow.ReplaceStringMap = new System.Collections.Generic.Dictionary <string, string> {
                { "#000000", $"#{Settings.MobileSettings.color}" }
            };
            arrow.HeightRequest     = 25;
            arrow.WidthRequest      = 25;
            arrow.VerticalOptions   = LayoutOptions.CenterAndExpand;
            arrow.HorizontalOptions = LayoutOptions.End;

            numberAndDate.TextColor         = Color.Black;
            numberAndDate.FontSize          = 12;
            numberAndDate.VerticalOptions   = LayoutOptions.StartAndExpand;
            numberAndDate.HorizontalOptions = LayoutOptions.StartAndExpand;

            LabelDate.TextColor = Color.Black;
            LabelDate.FontSize  = 15;
            LabelDate.Margin    = new Thickness(0, -5, 0, 0);

            StackLayout status = new StackLayout();

            status.Orientation       = StackOrientation.Horizontal;
            status.HorizontalOptions = LayoutOptions.FillAndExpand;
            arrow.ReplaceStringMap   = new System.Collections.Generic.Dictionary <string, string> {
                { "#000000", $"#{Settings.MobileSettings.color}" }
            };
            ImageStatus.Source          = "resource://xamarinJKH.Resources.ic_status_new.svg";
            ImageStatus.HeightRequest   = 15;
            ImageStatus.VerticalOptions = LayoutOptions.End;
            ImageStatus.WidthRequest    = 15;
            ImageStatus.Margin          = new Thickness(0, 0, 0, 0);

            LabelStatus.TextColor             = Color.Black;
            LabelStatus.FontSize              = 15;
            LabelStatus.VerticalTextAlignment = TextAlignment.Center;
            LabelStatus.VerticalOptions       = LayoutOptions.Center;


            // status.Children.Add(ImageStatus);
            // status.Children.Add(LabelStatus);

            LabelText.TextColor               = Color.Black;
            LabelText.HorizontalOptions       = LayoutOptions.Start;
            LabelText.FontSize                = 15;
            LabelText.HorizontalTextAlignment = TextAlignment.Start;
            LabelText.VerticalOptions         = LayoutOptions.Start;
            LabelText.FontAttributes          = FontAttributes.Bold;

            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            // status.Children.Add(numberAndDate);
            // status.Children.Add(LabelText);

            grid.Children.Add(numberAndDate, 0, 0);

            StackLayout stackLayoutStatus = new StackLayout();

            stackLayoutStatus.Orientation = StackOrientation.Horizontal;
            // stackLayoutStatus.Spacing = 0;

            stackLayoutStatus.Children.Add(ImageStatus);
            stackLayoutStatus.Children.Add(LabelStatus);

            containerData.Children.Add(grid);
            containerData.Children.Add(LabelDate);
            containerData.Children.Add(stackLayoutStatus);

            Frame readindicator = new Frame
            {
                BackgroundColor = Color.Red,
                CornerRadius    = 5
            };

            Grid containerMain = new Grid();

            containerMain.Padding           = 0;
            containerMain.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = GridLength.Star
                },
                new ColumnDefinition {
                    Width = new GridLength(5)
                }
            };

            containerMain.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = new GridLength(5)
                },
                new RowDefinition {
                    Height = GridLength.Star
                }
            };

            container.Children.Add(containerData);
            container.Children.Add(arrow);

            containerMain.Children.Add(container);
            Grid.SetRowSpan(container, 2);
            Grid.SetColumnSpan(container, 2);


            ReadIndicator = new Frame
            {
                CornerRadius    = 5,
                BackgroundColor = Color.Red,
                IsVisible       = false
            };
            ReadIndicator.SetBinding(View.IsVisibleProperty, "Read", BindingMode.TwoWay);
            containerMain.Children.Add(ReadIndicator, 1, 0);
            frame.Content = containerMain;

            var stackLMain = new StackLayout()
            {
                Margin = new Thickness(0, 2)
            };

            stackLMain.Children.Add(frame);
            View = stackLMain;
            //View = frame;

            MessagingCenter.Subscribe <Object, int>(this, "SetAppRead", (sender, args) =>
            {
                if (this.ID == args)
                {
                    ReadIndicator.IsVisible = false;
                }
            });
        }
예제 #3
0
        public MetersThreeCell(/*List<MeterValueInfo> Values, int DecimalPoint, int MeterID, bool IsDisabled, string Resource, string Address,
                                * string CustomName, string UniqueNum, string Units, string CheckupDate, string RecheckInterval,*/MeterInfo mInfo)
        {
            meterInfo = mInfo;

            frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"],
                                   Color.White);
            frame.HorizontalOptions = LayoutOptions.FillAndExpand;
            frame.VerticalOptions   = LayoutOptions.Start;
            frame.BackgroundColor   = Color.White;
            frame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frame.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);
            frame.Margin       = new Thickness(10, 0, 10, 10);
            frame.Padding      = new Thickness(15, 15, 15, 15);
            frame.CornerRadius = 30;

            StackLayout container = new StackLayout();

            container.Orientation = StackOrientation.Vertical;

            StackLayout header = new StackLayout();

            header.Orientation       = StackOrientation.Horizontal;
            header.HorizontalOptions = LayoutOptions.Center;

            resource.FontSize  = 15;
            resource.TextColor = Color.Black;
            resource.HorizontalTextAlignment = TextAlignment.Center;

            img.WidthRequest = 25;
            // imgEdit.WidthRequest = 20;
            // imgEdit.HeightRequest = 20;
            // imgEdit.Source = "edit";
            // imgEdit.Foreground = (Color)Application.Current.Resources["MainColor"];

            Edit = new SvgCachedImage();
            Edit.WidthRequest     = 25;
            Edit.HeightRequest    = 25;
            Edit.ReplaceStringMap = new Dictionary <string, string> {
                { "#000000", $"#{Settings.MobileSettings.color}" }
            };
            Edit.Source = "resource://xamarinJKH.Resources.edit.svg";

            header.Children.Add(img);
            header.Children.Add(resource);
            header.Children.Add(Edit);

            StackLayout addressStack = new StackLayout();

            addressStack.Orientation       = StackOrientation.Horizontal;
            addressStack.HorizontalOptions = LayoutOptions.FillAndExpand;


            StackLayout grid = new StackLayout();

            grid.Orientation       = StackOrientation.Horizontal;
            grid.HorizontalOptions = LayoutOptions.FillAndExpand;


            StackLayout grid0 = new StackLayout();

            grid0.Orientation       = StackOrientation.Horizontal;
            grid0.HorizontalOptions = LayoutOptions.FillAndExpand;
            grid0.VerticalOptions   = LayoutOptions.Start;


            Label adressLbl = new Label();

            adressLbl.Text      = $"{AppResources.Adress}:";
            adressLbl.FontSize  = 15;
            adressLbl.TextColor = Color.FromHex("#A2A2A2");
            adressLbl.HorizontalTextAlignment = TextAlignment.Start;
            adressLbl.HorizontalOptions       = LayoutOptions.Fill;
            adressLbl.MinimumWidthRequest     = 60;

            grid0.Children.Add(adressLbl);

            BoxView b = new BoxView();

            b.VerticalOptions     = LayoutOptions.Center;
            b.HeightRequest       = 1;
            b.Margin              = new Thickness(0, 2, 0, 0);
            b.HorizontalOptions   = LayoutOptions.FillAndExpand;
            b.Color               = Color.LightGray;
            b.MinimumWidthRequest = 10;

            grid0.Children.Add(b);

            grid.Children.Add(grid0);


            adress.FontSize  = 15;
            adress.TextColor = Color.Black;
            adress.HorizontalTextAlignment = TextAlignment.End;
            adress.HorizontalOptions       = LayoutOptions.Fill;
            adress.MaxLines = 3;
            if (Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width < 700)
            {
                adress.WidthRequest = 450;
                adressLbl.FontSize  = 13;
                adress.FontSize     = 13;
            }
            else if (Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width < 800)
            {
                adress.WidthRequest = 500;
                adressLbl.FontSize  = 14;
                adress.FontSize     = 14;
            }
            else
            {
                adress.WidthRequest = Convert.ToInt32(Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width * 0.7);
            }


            grid.Children.Add(adress);

            container.Children.Add(header);
            container.Children.Add(grid);

            StackLayout numberStack = new StackLayout();

            numberStack.Orientation       = StackOrientation.Horizontal;
            numberStack.HorizontalOptions = LayoutOptions.FillAndExpand;
            Label numberLbl = new Label();

            numberLbl.Text      = AppResources.FacNum;
            numberLbl.FontSize  = 12;
            numberLbl.TextColor = Color.FromHex("#A2A2A2");
            numberLbl.HorizontalTextAlignment = TextAlignment.Start;
            numberLbl.HorizontalOptions       = LayoutOptions.Start;
            numberLbl.MaxLines = 1;

            number.FontSize                = 12;
            number.HorizontalOptions       = LayoutOptions.End;
            number.TextColor               = Color.Black;
            number.HorizontalTextAlignment = TextAlignment.End;
            number.MaxLines                = 1;

            Label linesNumb = new Label();

            linesNumb.HeightRequest     = 1;
            linesNumb.BackgroundColor   = Color.LightGray;
            linesNumb.Margin            = new Thickness(0, 2, 0, 0);
            linesNumb.VerticalOptions   = LayoutOptions.Center;
            linesNumb.HorizontalOptions = LayoutOptions.FillAndExpand;

            numberStack.Children.Add(numberLbl);
            numberStack.Children.Add(linesNumb);
            numberStack.Children.Add(number);
            container.Children.Add(numberStack);

            StackLayout checkupDateStack = new StackLayout();

            checkupDateStack.Orientation       = StackOrientation.Horizontal;
            checkupDateStack.HorizontalOptions = LayoutOptions.FillAndExpand;
            checkupDateStack.Margin            = new Thickness(0, -7, 0, 0);
            Label checkupDateLbl = new Label();

            checkupDateLbl.Text      = AppResources.LastCheck;
            checkupDateLbl.FontSize  = 12;
            checkupDateLbl.TextColor = Color.FromHex("#A2A2A2");
            checkupDateLbl.HorizontalTextAlignment = TextAlignment.Start;
            checkupDateLbl.HorizontalOptions       = LayoutOptions.Start;
            checkupDateLbl.MaxLines = 1;

            checkup_date.FontSize  = 12;
            checkup_date.TextColor = Color.Black;
            checkup_date.HorizontalTextAlignment = TextAlignment.End;
            checkup_date.HorizontalOptions       = LayoutOptions.End;
            checkup_date.MaxLines = 1;

            Label linesPover = new Label();

            linesPover.HeightRequest   = 1;
            linesPover.BackgroundColor = Color.LightGray;
            ;
            linesPover.VerticalOptions   = LayoutOptions.Center;
            linesPover.Margin            = new Thickness(0, 2, 0, 0);
            linesPover.HorizontalOptions = LayoutOptions.FillAndExpand;

            checkupDateStack.Children.Add(checkupDateLbl);
            checkupDateStack.Children.Add(linesPover);
            checkupDateStack.Children.Add(checkup_date);
            container.Children.Add(checkupDateStack);

            StackLayout recheckStack = new StackLayout();

            recheckStack.Orientation       = StackOrientation.Horizontal;
            recheckStack.HorizontalOptions = LayoutOptions.FillAndExpand;
            recheckStack.Margin            = new Thickness(0, -7, 0, 0);
            Label recheckLbl = new Label();

            recheckLbl.Text      = AppResources.CheckInterval;
            recheckLbl.FontSize  = 12;
            recheckLbl.TextColor = Color.FromHex("#A2A2A2");
            recheckLbl.HorizontalTextAlignment = TextAlignment.Start;
            recheckLbl.HorizontalOptions       = LayoutOptions.Start;
            recheckLbl.MaxLines = 1;
            // recheckLbl.WidthRequest = 150;
            recheckup.FontSize  = 12;
            recheckup.TextColor = Color.Black;
            recheckup.HorizontalTextAlignment = TextAlignment.End;
            recheckup.HorizontalOptions       = LayoutOptions.End;
            recheckup.MaxLines = 1;

            Label linesInterv = new Label();

            linesInterv.HeightRequest   = 1;
            linesInterv.BackgroundColor = Color.LightGray;
            ;
            linesInterv.VerticalOptions   = LayoutOptions.Center;
            linesInterv.Margin            = new Thickness(0, 2, 0, 0);
            linesInterv.HorizontalOptions = LayoutOptions.FillAndExpand;

            recheckStack.Children.Add(recheckLbl);
            recheckStack.Children.Add(linesInterv);
            recheckStack.Children.Add(recheckup);
            container.Children.Add(recheckStack);

            Label separator = new Label();

            separator.HeightRequest   = 1;
            separator.BackgroundColor = Color.LightGray;
            separator.Margin          = new Thickness(0, 5, 0, 5);
            container.Children.Add(separator);

            tarif1.FontSize  = 13;
            tarif1.TextColor = Color.FromHex("#A2A2A2"); //Color.Red;
            tarif1.HorizontalTextAlignment = TextAlignment.Center;

            if (mInfo.TariffNumberInt > 1)
            {
                tarif1.Text = string.IsNullOrWhiteSpace(mInfo.Tariff1Name) ? AppResources.tarif1 : mInfo.Tariff1Name;
            }
            else
            {
                tarif1.IsVisible = false;
            }

            //tarif1t2.FontSize = 13;
            //tarif1t2.TextColor = Color.FromHex("#A2A2A2"); //Color.Red;
            //tarif1t2.HorizontalTextAlignment = TextAlignment.Center;

            //tarif1t3.FontSize = 13;
            //tarif1t3.TextColor = Color.FromHex("#A2A2A2"); //Color.Red;
            //tarif1t3.HorizontalTextAlignment = TextAlignment.Center;


            //tarif2.FontSize = 13;
            //tarif2.TextColor = Color.FromHex("#A2A2A2");
            //tarif2.HorizontalTextAlignment = TextAlignment.Center;

            //tarif2.Text = string.IsNullOrWhiteSpace(mInfo.Tariff2Name) ? AppResources.tarif2 : mInfo.Tariff2Name;

            //tarif3.FontSize = 13;
            //tarif3.TextColor = Color.FromHex("#A2A2A2");
            //tarif3.HorizontalTextAlignment = TextAlignment.Center;

            //tarif3.Text = string.IsNullOrWhiteSpace(mInfo.Tariff3Name) ? AppResources.tarif3 : mInfo.Tariff3Name;

            count1Stack.Orientation       = StackOrientation.Horizontal;
            count1Stack.HorizontalOptions = LayoutOptions.FillAndExpand;

            counterDate1.FontSize  = 15;
            counterDate1.TextColor = Color.FromHex("#A2A2A2");
            counterDate1.HorizontalTextAlignment = TextAlignment.Start;
            counterDate1.HorizontalOptions       = LayoutOptions.Start;
            counterDate1.MaxLines = 1;

            count1.FontSize  = 15;
            count1.TextColor = Color.Black;
            count1.HorizontalTextAlignment = TextAlignment.End;
            count1.HorizontalOptions       = LayoutOptions.End;
            count1.VerticalOptions         = LayoutOptions.Start;
            count1.MaxLines = 1;

            count1t2.FontSize  = 15;
            count1t2.TextColor = Color.Black;
            count1t2.HorizontalTextAlignment = TextAlignment.End;
            count1t2.HorizontalOptions       = LayoutOptions.End;
            count1t2.VerticalOptions         = LayoutOptions.Start;
            count1t2.MaxLines = 1;


            //#if DEBUG
            //            count1t2.Text = "100500.111";
            //#endif

            count1t3.FontSize  = 15;
            count1t3.TextColor = Color.Black;
            count1t3.HorizontalTextAlignment = TextAlignment.End;
            count1t3.HorizontalOptions       = LayoutOptions.End;
            count1t3.VerticalOptions         = LayoutOptions.Start;
            count1t3.MaxLines = 1;


            //#if DEBUG
            //            count1t3.Text = "100502.213";
            //#endif

            BoxView lines = new BoxView();

            lines.HeightRequest = 1;
            //lines.BackgroundColor = Color.LightGray;
            lines.Color             = Color.LightGray;
            lines.VerticalOptions   = LayoutOptions.Center;
            lines.HorizontalOptions = LayoutOptions.FillAndExpand;

            count1Stack.Children.Add(counterDate1);
            count1Stack.Children.Add(lines);
            count1Stack.Children.Add(tarif1);
            count1Stack.Children.Add(count1);

            container.Children.Add(count1Stack);

            count1t2Stack.Orientation       = StackOrientation.Horizontal;
            count1t2Stack.HorizontalOptions = LayoutOptions.End;

            var t21 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t21.Text = string.IsNullOrWhiteSpace(mInfo.Tariff2Name) ? AppResources.tarif2 : mInfo.Tariff2Name;

            count1t2Stack.Children.Add(t21);
            count1t2Stack.Children.Add(count1t2);

            container.Children.Add(count1t2Stack);

            count1t3Stack.Orientation       = StackOrientation.Horizontal;
            count1t3Stack.HorizontalOptions = LayoutOptions.End;

            var t31 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t31.Text = string.IsNullOrWhiteSpace(mInfo.Tariff2Name) ? AppResources.tarif2 : mInfo.Tariff2Name;

            count1t3Stack.Children.Add(t31);
            count1t3Stack.Children.Add(count1t3);

            container.Children.Add(count1t3Stack);

            count2Stack.Orientation              = StackOrientation.Horizontal;
            count2Stack.HorizontalOptions        = LayoutOptions.FillAndExpand;
            counterDate2.FontSize                = 15;
            counterDate2.TextColor               = Color.FromHex("#A2A2A2");
            counterDate2.HorizontalTextAlignment = TextAlignment.Start;
            counterDate2.HorizontalOptions       = LayoutOptions.Start;
            counterDate2.MaxLines                = 1;
            // counterDate2.WidthRequest = 150;
            count2.FontSize  = 15;
            count2.TextColor = Color.Black;
            count2.HorizontalTextAlignment = TextAlignment.End;
            count2.HorizontalOptions       = LayoutOptions.End;
            count2.VerticalOptions         = LayoutOptions.Center;
            count2.MaxLines = 1;

            count2t2.FontSize  = 15;
            count2t2.TextColor = Color.Black;
            count2t2.HorizontalTextAlignment = TextAlignment.End;
            count2t2.HorizontalOptions       = LayoutOptions.End;
            count2t2.VerticalOptions         = LayoutOptions.Start;
            count2t2.MaxLines = 1;

//#if DEBUG
//            count2t2.Text = "200500.111";
//#endif

            count2t3.FontSize  = 15;
            count2t3.TextColor = Color.Black;
            count2t3.HorizontalTextAlignment = TextAlignment.End;
            count2t3.HorizontalOptions       = LayoutOptions.End;
            count2t3.VerticalOptions         = LayoutOptions.Start;
            count2t3.MaxLines = 1;
//#if DEBUG
//            count2t3.Text = "200502.213";
//#endif


            Label lines2 = new Label();

            lines2.HeightRequest     = 1;
            lines2.BackgroundColor   = Color.LightGray;
            lines2.VerticalOptions   = LayoutOptions.Center;
            lines2.HorizontalOptions = LayoutOptions.FillAndExpand;

            count2Stack.Children.Add(counterDate2);
            count2Stack.Children.Add(lines2);

            //count2Stack.Children.Add(tarif1);
            Label t1 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            if (mInfo.TariffNumberInt > 1)
            {
                if (!string.IsNullOrWhiteSpace(mInfo.Tariff1Name))
                {
                    t1.Text = string.IsNullOrWhiteSpace(mInfo.Tariff1Name) ? AppResources.tarif1 : mInfo.Tariff1Name;
                }
                else
                {
                    t1.IsVisible = false;
                }
            }

            count2Stack.Children.Add(t1);
            //tarif1.FontSize = 13;
            //tarif1.TextColor = Color.FromHex("#A2A2A2"); //Color.Red;
            //tarif1.HorizontalTextAlignment = TextAlignment.Center;

            //if (mInfo.TariffNumberInt > 1)
            //    if (!string.IsNullOrWhiteSpace(mInfo.Tariff1Name))
            //        tarif1.Text = string.IsNullOrWhiteSpace(mInfo.Tariff1Name) ? AppResources.tarif1 : mInfo.Tariff1Name;
            //    else
            //        tarif1.IsVisible = false;

            count2Stack.Children.Add(count2);
            container.Children.Add(count2Stack);

            count2t2Stack.Orientation       = StackOrientation.Horizontal;
            count2t2Stack.HorizontalOptions = LayoutOptions.End;

            var t22 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t22.Text = string.IsNullOrWhiteSpace(mInfo.Tariff2Name) ? AppResources.tarif2 : mInfo.Tariff2Name;

            count2t2Stack.Children.Add(t22);
            count2t2Stack.Children.Add(count2t2);

            container.Children.Add(count2t2Stack);

            count2t3Stack.Orientation       = StackOrientation.Horizontal;
            count2t3Stack.HorizontalOptions = LayoutOptions.End;

            var t32 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t32.Text = string.IsNullOrWhiteSpace(mInfo.Tariff3Name) ? AppResources.tarif3 : mInfo.Tariff3Name;

            count2t3Stack.Children.Add(t32);
            count2t3Stack.Children.Add(count2t3);

            container.Children.Add(count2t3Stack);


            count3Stack.Orientation              = StackOrientation.Horizontal;
            count3Stack.HorizontalOptions        = LayoutOptions.FillAndExpand;
            counterDate3.FontSize                = 15;
            counterDate3.TextColor               = Color.FromHex("#A2A2A2");
            counterDate3.HorizontalTextAlignment = TextAlignment.Start;
            counterDate3.HorizontalOptions       = LayoutOptions.Start;
            counterDate3.MaxLines                = 1;
            // counterDate3.WidthRequest = 150;
            count3.FontSize  = 15;
            count3.TextColor = Color.Black;
            count3.HorizontalTextAlignment = TextAlignment.End;
            count3.HorizontalOptions       = LayoutOptions.End;
            count3.VerticalOptions         = LayoutOptions.Center;
            count3.MaxLines = 1;

            count3t2.FontSize  = 15;
            count3t2.TextColor = Color.Black;
            count3t2.HorizontalTextAlignment = TextAlignment.End;
            count3t2.HorizontalOptions       = LayoutOptions.End;
            count3t2.VerticalOptions         = LayoutOptions.Start;
            count3t2.MaxLines = 1;

//#if DEBUG
//            count3t2.Text = "100500.111";
//#endif

            count3t3.FontSize  = 15;
            count3t3.TextColor = Color.Black;
            count3t3.HorizontalTextAlignment = TextAlignment.End;
            count3t3.HorizontalOptions       = LayoutOptions.End;
            count3t3.VerticalOptions         = LayoutOptions.Start;
            count3t3.MaxLines = 1;
//#if DEBUG
//            count3t3.Text = "100502.213";
//#endif

            Label lines3 = new Label();

            lines3.HeightRequest     = 1;
            lines3.BackgroundColor   = Color.LightGray;
            lines3.VerticalOptions   = LayoutOptions.Center;
            lines3.HorizontalOptions = LayoutOptions.FillAndExpand;

            count3Stack.Children.Add(counterDate3);
            count3Stack.Children.Add(lines3);

            Label t2 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            if (mInfo.TariffNumberInt > 1)
            {
                if (!string.IsNullOrWhiteSpace(mInfo.Tariff1Name))
                {
                    t2.Text = string.IsNullOrWhiteSpace(mInfo.Tariff1Name) ? AppResources.tarif1 : mInfo.Tariff1Name;
                }
                else
                {
                    t2.IsVisible = false;
                }
            }

            count3Stack.Children.Add(t2);

            //count3Stack.Children.Add(tarif1);
            count3Stack.Children.Add(count3);
            container.Children.Add(count3Stack);

            count3t2Stack.Orientation       = StackOrientation.Horizontal;
            count3t2Stack.HorizontalOptions = LayoutOptions.End;

            var t23 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t23.Text = string.IsNullOrWhiteSpace(mInfo.Tariff2Name) ? AppResources.tarif2 : mInfo.Tariff2Name;


            count3t2Stack.Children.Add(t23);
            count3t2Stack.Children.Add(count3t2);

            container.Children.Add(count3t2Stack);

            count3t3Stack.Orientation       = StackOrientation.Horizontal;
            count3t3Stack.HorizontalOptions = LayoutOptions.End;

            var t33 = new Label()
            {
                FontSize = 13, TextColor = Color.FromHex("#A2A2A2"), HorizontalTextAlignment = TextAlignment.Center
            };

            t33.Text = string.IsNullOrWhiteSpace(mInfo.Tariff3Name) ? AppResources.tarif3 : mInfo.Tariff3Name;

            count3t3Stack.Children.Add(t33);
            count3t3Stack.Children.Add(count3t3);

            container.Children.Add(count3t3Stack);

            //container.Children.Add(count3t2);
            //container.Children.Add(count3t3);

            frameBtn.HorizontalOptions = LayoutOptions.FillAndExpand;
            frameBtn.VerticalOptions   = LayoutOptions.Start;
            frameBtn.BackgroundColor   = (Color)Application.Current.Resources["MainColor"];
            frameBtn.CornerRadius      = 10;
            frameBtn.Margin            = new Thickness(0, 10, 0, 0);
            frameBtn.Padding           = 12;
            frameBtn.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frameBtn.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);

            containerBtn.Orientation       = StackOrientation.Horizontal;
            containerBtn.HorizontalOptions = LayoutOptions.CenterAndExpand;

            Label btn = new Label();

            btn.Margin                = new Thickness(0, 0, 0, 0);
            btn.TextColor             = Color.White;
            btn.FontAttributes        = FontAttributes.Bold;
            btn.VerticalTextAlignment = TextAlignment.Center;
            btn.FontSize              = 15;
            btn.Text = AppResources.PassPenance;
            containerBtn.Children.Add(new SvgCachedImage
            {
                Source           = "resource://xamarinJKH.Resources.ic_counter.svg",
                ReplaceStringMap = new Dictionary <string, string> {
                    { "#000000", "#FFFFFF" }
                },
                HeightRequest = 20
            });
            containerBtn.Children.Add(btn);

            frameBtn.Content = containerBtn;

            container.Children.Add(frameBtn);

            canCount.Text                    = AppResources.MetersThreeCellCanCount;
            canCount.FontSize                = 12;
            canCount.TextDecorations         = TextDecorations.Underline;
            canCount.FontAttributes          = FontAttributes.Bold;
            canCount.TextColor               = Color.Black;
            canCount.HorizontalTextAlignment = TextAlignment.End;
            canCount.HorizontalOptions       = LayoutOptions.CenterAndExpand;
            canCount.HorizontalTextAlignment = TextAlignment.Center;

            labelDisable = new Label()
            {
                Text                    = AppResources.CounterLeave,
                FontSize                = 14,
                IsVisible               = false,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            container.Children.Add(canCount);
            container.Children.Add(labelDisable);
            frame.Content = container;

            ext(mInfo, mInfo.Values, mInfo.NumberOfDecimalPlaces, mInfo.ID, mInfo.IsDisabled, mInfo.Resource, mInfo.Address,
                mInfo.CustomName, mInfo.FactoryNumber, mInfo.UniqueNum, mInfo.Units, mInfo.NextCheckupDate, mInfo.RecheckInterval.ToString(), mInfo.Tariff1Name, mInfo.Tariff2Name, mInfo.Tariff3Name);

            Children.Add(frame);
        }
예제 #4
0
        public PaysCell()
        {
            MaterialFrame frame = new MaterialFrame();
            frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White);
            frame.HorizontalOptions = LayoutOptions.FillAndExpand;
            frame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frame.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);
            frame.VerticalOptions = LayoutOptions.Start;
            frame.BackgroundColor = Color.White;
            frame.Margin = new Thickness(10, 0, 10, 10);
            frame.Padding = new Thickness(15, 15, 15, 15);
            frame.CornerRadius = 30;

            StackLayout container = new StackLayout();
            container.Orientation = StackOrientation.Vertical;

            StackLayout dateIdent = new StackLayout();
            dateIdent.Orientation = StackOrientation.Horizontal;

            StackLayout identAdress = new StackLayout();
            identAdress.HorizontalOptions = LayoutOptions.StartAndExpand;
            identAdress.Spacing = 0;
            
            ident.FontSize = 15;
            ident.TextColor = Color.Black;
            adress.FontSize = 12;
            adress.TextColor = Color.Gray;
            adress.FontFamily = "Roboto";

            identAdress.Children.Add(ident);
            identAdress.Children.Add(adress);


            IconView x = new IconView();
            x.Source = "ic_close";
            x.Foreground = (Color)Application.Current.Resources["MainColor"];
            x.HeightRequest = 10;
            x.WidthRequest = 10;

            Label close = new Label();
            close.Text = AppResources.Delete;
            close.TextColor = (Color)Application.Current.Resources["MainColor"];
            close.FontSize = 15;
            close.TextDecorations = TextDecorations.Underline;
            dell.Orientation = StackOrientation.Horizontal;
            dell.HorizontalOptions = LayoutOptions.EndAndExpand;
            dell.VerticalOptions = LayoutOptions.Center;
            dell.MinimumWidthRequest = 80;

            dell.Children.Add(x);
            dell.Children.Add(close);
            
           

            dateIdent.Children.Add(identAdress);
            dateIdent.Children.Add(dell);

            Label separator = new Label();

            separator.HeightRequest = 1;
            separator.BackgroundColor = Color.Gray;
            separator.Margin = new Thickness(0, 5, 0, 5);
            container.Children.Add(dateIdent);
            container.Children.Add(separator);

            StackLayout sums = new StackLayout();
            sums.Orientation = StackOrientation.Horizontal;
            sums.Margin = new Thickness(30, 0, 30, 5);

            sumPayDate.Text = string.Format("Сумма к оплате{0} на 31.05.2020", Environment.NewLine);
            sumPayDate.FontSize = 15;
            sumPayDate.TextColor = Color.Gray;
            sumPayDate.HorizontalTextAlignment = TextAlignment.End;
            sumPayDate.Margin = new Thickness(0, 0, 15, 0);

            sumPay.Text = "4593.01 руб";
            sumPay.TextColor = (Color)Application.Current.Resources["MainColor"];
            sumPay.FontSize = 25;
            sumPay.VerticalOptions = LayoutOptions.Center;

            sums.Children.Add(sumPayDate);
            sums.Children.Add(sumPay);

            container.Children.Add(sums);

            Frame frameBtn = new Frame();
            frameBtn.HorizontalOptions = LayoutOptions.FillAndExpand;
            frameBtn.VerticalOptions = LayoutOptions.Start;
            frameBtn.Padding = 0;
            frameBtn.BackgroundColor = (Color)Application.Current.Resources["MainColor"];
            frameBtn.CornerRadius = 10;

            StackLayout containerBtn = new StackLayout();
            containerBtn.Orientation = StackOrientation.Horizontal;
            containerBtn.Spacing = 0;
            containerBtn.HorizontalOptions = LayoutOptions.CenterAndExpand;

            IconView image = new IconView();
            image.Source = "ic_pays";
            image.Foreground = Color.White;
            // image.Margin = new Thickness(-45, 0, 0, 0);
            image.HeightRequest = 30;
            image.WidthRequest = 30;

            Label btn = new Label();
            // btn.Margin = new Thickness(-30, 0, 0, 0);
            btn.TextColor = Color.White;
            btn.BackgroundColor = Color.Transparent;
            btn.HorizontalOptions  = LayoutOptions.Center;
            btn.Margin = new Thickness(13,13,0,13);
            btn.FontAttributes = FontAttributes.Bold;
            btn.FontSize = 16;
            btn.Text = AppResources.Pay;

            containerBtn.Children.Add(image);
            containerBtn.Children.Add(btn);

            frameBtn.Content = containerBtn;

            container.Children.Add(frameBtn);

            Label payPeriod = new Label();

            FormattedString formatted = new FormattedString();

            formatted.Spans.Add(new Span
            {
                Text = AppResources.PayProcessing,
                FontSize = 12
            });
            formatted.Spans.Add(new Span
            {
                Text = " 2-3 ",
                FontSize = 12,
                FontAttributes = FontAttributes.Bold
            });
            formatted.Spans.Add(new Span
            {
                Text = AppResources.WorkDays,
                FontSize = 12
            });

            payPeriod.FormattedText = formatted;
            payPeriod.TextColor = (Color)Application.Current.Resources["MainColor"];
            payPeriod.FontSize = 12;
            payPeriod.HorizontalOptions = LayoutOptions.CenterAndExpand;

            container.Children.Add(payPeriod);

            frame.Content = container;

            View = frame;
        }
예제 #5
0
        public AppConstCell()
        {
            MaterialFrame frame = new MaterialFrame();

            frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White);
            frame.Elevation = 20;
            frame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
            frame.SetOnAppTheme(MaterialFrame.ElevationProperty, 0, 20);
            frame.HorizontalOptions = LayoutOptions.FillAndExpand;
            frame.VerticalOptions   = LayoutOptions.Start;
            frame.BackgroundColor   = Color.White;
            frame.Margin            = new Thickness(10, 0, 10, 14);
            frame.Padding           = new Thickness(20, 15, 20, 20);
            frame.CornerRadius      = 40;

            StackLayout container = new StackLayout();

            container.Orientation = StackOrientation.Horizontal;

            StackLayout containerData = new StackLayout();

            containerData.Orientation       = StackOrientation.Vertical;
            containerData.HorizontalOptions = LayoutOptions.FillAndExpand;


            SvgCachedImage arrow = new SvgCachedImage();

            arrow.Source = "resource://xamarinJKH.Resources.ic_arrow_forward.svg";
            Color hex = (Color)Application.Current.Resources["MainColor"];

            arrow.ReplaceStringMap = new System.Collections.Generic.Dictionary <string, string> {
                { "#000000", $"#{Settings.MobileSettings.color}" }
            };
            arrow.HeightRequest     = 25;
            arrow.WidthRequest      = 25;
            arrow.Margin            = new Thickness(0, 0, -5, 0);
            arrow.VerticalOptions   = LayoutOptions.CenterAndExpand;
            arrow.HorizontalOptions = LayoutOptions.End;

            //LabelDate.TextColor = Color.Black;
            //LabelDate.FontSize = 15;
            //LabelDate.Margin = new Thickness(0, -5, 0, 0);

            numberAndDate.TextColor         = Color.Black;
            numberAndDate.FontSize          = 12;
            numberAndDate.VerticalOptions   = LayoutOptions.CenterAndExpand;
            numberAndDate.HorizontalOptions = LayoutOptions.Fill;

            ImageStatus.ReplaceStringMap = new System.Collections.Generic.Dictionary <string, string> {
                { "#000000", $"#{Settings.MobileSettings.color}" }
            };
            ImageStatus.Source            = "resource://xamarinJKH.Resources.ic_status_new.svg";
            ImageStatus.HeightRequest     = 15;
            ImageStatus.VerticalOptions   = LayoutOptions.Center;
            ImageStatus.WidthRequest      = 15;
            ImageStatus.Margin            = new Thickness(0, 0, 0, 0);
            ImageStatus.HorizontalOptions = LayoutOptions.End;

            LabelStatus.TextColor             = Color.Black;
            LabelStatus.FontSize              = 13;
            LabelStatus.VerticalTextAlignment = TextAlignment.Center;
            LabelStatus.VerticalOptions       = LayoutOptions.Center;
            //LabelStatus.LineBreakMode = LineBreakMode.WordWrap;
            LabelStatus.HorizontalOptions = LayoutOptions.End;


            // status.Children.Add(ImageStatus);
            // status.Children.Add(LabelStatus);

            LabelText.TextColor               = Color.Black;
            LabelText.HorizontalOptions       = LayoutOptions.Start;
            LabelText.FontSize                = 15;
            LabelText.HorizontalTextAlignment = TextAlignment.Start;
            LabelText.VerticalOptions         = LayoutOptions.Start;
            LabelText.MaxLines                = 1;

            LabelAddressApp.TextColor               = Color.Black;
            LabelAddressApp.HorizontalOptions       = LayoutOptions.Start;
            LabelAddressApp.FontSize                = 10;
            LabelAddressApp.HorizontalTextAlignment = TextAlignment.Start;
            LabelAddressApp.VerticalOptions         = LayoutOptions.Start;
            // LabelAddressApp.MaxLines = 1;

            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            // status.Children.Add(numberAndDate);
            // status.Children.Add(LabelText);

            //grid.Children.Add(numberAndDate, 0, 0);

            StackLayout stackLayoutStatus = new StackLayout();

            stackLayoutStatus.Orientation       = StackOrientation.Horizontal;
            stackLayoutStatus.HorizontalOptions = LayoutOptions.Fill;

            // stackLayoutStatus.Spacing = 0;
            stackLayoutStatus.Children.Add(numberAndDate);
            stackLayoutStatus.Children.Add(ImageStatus);
            stackLayoutStatus.Children.Add(LabelStatus);

            StackLayout stackLayoutText = new StackLayout();

            stackLayoutText.Orientation       = StackOrientation.Horizontal;
            stackLayoutText.HorizontalOptions = LayoutOptions.FillAndExpand;
            stackLayoutText.Children.Add(LabelText);
            //containerData.Children.Add(grid);
            containerData.Children.Add(stackLayoutStatus);
            containerData.Children.Add(LabelAddressApp);
            containerData.Children.Add(stackLayoutText);


            container.Children.Add(containerData);

            //     <CheckBox
            //     HorizontalOptions="Center"
            // x:Name="CheckBoxBonus"
            // VerticalOptions="Center"
            // Color="{x:DynamicResource MainColor}" />

            checkBox = new CheckBox()
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 0, -5, 0),
                Color             = hex
            };
#if DEBUG
            container.Children.Add(checkBox);
#endif
            container.Children.Add(arrow);

            frame.Content = container;


            View = frame;
        }