private void SetData(OSS oSS)
        {
            //проголосовано * из *
            spanAnswersCnt.TextColor = colorFromMobileSettings;
            var cntVotes = "за " + oSS.Questions.Where(_ => !string.IsNullOrWhiteSpace(_.Answer)).Count().ToString() + " / " + oSS.Questions.Count.ToString() + ".";

            spanAnswersCnt.Text = cntVotes;

            //ответы по штукам
            lCntYes.Text      = oSS.Questions.Where(_ => _.Answer == "0").Count().ToString();
            cntYes.Foreground = colorFromMobileSettings;
            lCntNo.Text       = oSS.Questions.Where(_ => _.Answer == "1").Count().ToString();
            cntNo.Foreground  = colorFromMobileSettings;

            lCntAbstained.Text      = oSS.Questions.Where(_ => _.Answer == "2").Count().ToString();
            cntAbstained.Foreground = colorFromMobileSettings;


            delimColored.BackgroundColor = colorFromMobileSettings;

            TotalArea.Text = " " + oSS.VoitingArea.ToString() + $" {AppResources.OSSInfoMeasurmentArea} = 100%";
            decimal round = 0;

            try
            {
                round = Math.Round(oSS.Accounts[0].Area / oSS.VoitingArea * 100, 3);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            Area.Text   = " " + oSS.Accounts[0].Area.ToString() + $" {AppResources.OSSInfoMeasurmentArea} = " + round + "%";
            dayEnd.Text = oSS.DateEnd.Split(' ')[0];
            var r1Date = oSS.ResultsReleaseDate.Split(' ')[0];
            var r1Time = oSS.ResultsReleaseDate.Split(' ')[1];

            dayEndPlus.Text = " " + AppResources.OSSText.Replace("{r1Date}", r1Date).Replace("{r1Time}", r1Time);
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            PancakeBot.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            FrameResult.SetAppThemeColor(Frame.BorderColorProperty, hexColor, Color.White);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White);
        }
Пример #2
0
        public OSSTotalVotingResult(OSS oSS)
        {
            InitializeComponent();
            Analytics.TrackEvent("Общие результаты голосования ОСС");
            NavigationPage.SetHasNavigationBar(this, false);

            var profile = new TapGestureRecognizer();

            profile.Tapped += async(s, e) =>
            {
                if (Navigation.NavigationStack.FirstOrDefault(x => x is ProfilePage) == null)
                {
                    await Navigation.PushAsync(new ProfilePage());
                }
            };
            IconViewProfile.GestureRecognizers.Add(profile);


            var techSend = new TapGestureRecognizer();

            techSend.Tapped += async(s, e) => { await Navigation.PushAsync(new AppPage()); };
            LabelTech.GestureRecognizers.Add(techSend);
            var call = new TapGestureRecognizer();

            call.Tapped += async(s, e) =>
            {
                if (Settings.Person.Phone != null)
                {
                    IPhoneCallTask phoneDialer;
                    phoneDialer = CrossMessaging.Current.PhoneDialer;
                    if (phoneDialer.CanMakePhoneCall && !string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
                    {
                        phoneDialer.MakePhoneCall(System.Text.RegularExpressions.Regex.Replace(Settings.Person.companyPhone, "[^+0-9]", ""));
                    }
                }
            };



            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                int statusBarHeight = DependencyService.Get <IStatusBar>().GetHeight();
                Pancake.Padding = new Thickness(0, statusBarHeight, 0, 0);

                //BackgroundColor = Color.White;
                break;

            default:
                break;
            }

            var dH = Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Height;

            if (dH < 1400)
            {
                titleLabel.FontSize = 18;
            }

            var backClick = new TapGestureRecognizer();

            backClick.Tapped += async(s, e) => { ClosePage(); };
            BackStackLayout.GestureRecognizers.Add(backClick);

            SetDecorations();

            SetData(oSS);
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            PancakeBot.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            FrameResult.SetAppThemeColor(Frame.BorderColorProperty, hexColor, Color.White);
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);

            BindingContext = this;
        }