async void SetTheme(OSS sObj) { /******* Повестка собрания ********/ //видимая часть Frame CommonTheme = GetFrame(); CommonTheme.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); CommonTheme.GestureRecognizers.Add(ShowHideAction()); StackLayout rootStack = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; //добавляем иконку stack.Children.Add(getIconView("ic_info_theme")); //основной текст stack.Children.Add(HeadLabel(AppResources.OSSInfoTheme)); //стрелка var iconViewArrowCommonTheme = await getIconArrowAsync(); stack.Children.Add(iconViewArrowCommonTheme); arrows.Add(CommonTheme.Id, iconViewArrowCommonTheme.Id); //добавляем видимю часть на старте rootStack.Children.Add(stack); //невидимые на старте элементы фрейма, кроме 1го фрейма StackLayout additionslData = new StackLayout() { IsVisible = false, Orientation = StackOrientation.Vertical }; //добавляем в список связку стека с невидимыми полями и родительского фрейма frames.Add(CommonTheme.Id, additionslData.Id); //вопросы int i = 1; foreach (var q in sObj.Questions) { var docName = detailLabel($"{AppResources.OSSInfoQuestionNumber} {i}: ", q.Text); i++; additionslData.Children.Add(docName); } rootStack.Children.Add(additionslData); CommonTheme.Content = rootStack; OSSListContent.Children.Add(CommonTheme); }
private void SetData(OSS oSS) { //проголосовано * из * spanAnswersCnt.TextColor = colorFromMobileSettings; int answerTotalCount = 0; int answerYesCount = 0; int answerNoCount = 0; int answerAbstainedCount = 0; foreach (var q in oSS.Questions) { answerTotalCount += q.AnswerTotalCount; answerYesCount += q.CountWhyVoiteYes; answerNoCount += q.CountWhyVoiteNo; answerAbstainedCount += q.CountWhyVoiteUnknow; } var cntVotes = $"{AppResources.OSSPersonalFor} " + answerTotalCount + "/" + (oSS.TotalAccounts * oSS.Questions.Count).ToString() + "."; spanAnswersCnt.Text = cntVotes; lCntYes.Text = answerYesCount.ToString(); cntYes.Foreground = colorFromMobileSettings; lCntNo.Text = answerNoCount.ToString(); cntNo.Foreground = colorFromMobileSettings; lCntAbstained.Text = answerAbstainedCount.ToString(); cntAbstained.Foreground = colorFromMobileSettings; delimColored.BackgroundColor = colorFromMobileSettings; TotalArea.Text = " " + oSS.VoitingArea.ToString() + $" {AppResources.OSSInfoMeasurmentArea} = 100%"; Area.Text = " " + oSS.ComplateArea.ToString() + $" {AppResources.OSSInfoMeasurmentArea} = " + oSS.ComplateAreaPercents + "%"; //ссылки на документы - Макс по идее должен сказать откуда взять. //urlBlank.TextColor = colorFromMobileSettings; //urlBlank.GestureRecognizers.Add(new TapGestureRecognizer //{ // Command = new Command(async () => await Launcher.OpenAsync(oSS.AdminstratorSite)) //}); ProtokolStackL.IsVisible = oSS.HasProtocolFile; if (ProtokolStackL.IsVisible) { urlProtokol.TextColor = colorFromMobileSettings; urlProtokol.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => await Launcher.OpenAsync(oSS.ProtocolFileLink)) }); } }
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); }
int GetOssStatus(OSS oss) { int statusInt = 0;//зеленый if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) < DateTime.Now) { statusInt = 1; // статус "уведомление о проведнии ОСС" } if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) < DateTime.Now && Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) > DateTime.Now) { //статус - идет голосование //if (!oss.Questions.Any(_ => string.IsNullOrWhiteSpace(_.Answer))) //{ // Ваш голос учтен - страница личных результатов голосования statusInt = 2; //желтый(стоит сейчас) или какой еще цвет? //} } return(statusInt); }
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; }
public OSSPool(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 backClick = new TapGestureRecognizer(); backClick.Tapped += async(s, e) => { ClosePage(); }; BackStackLayout.GestureRecognizers.Add(backClick); UkName.Text = Settings.MobileSettings.main_name; //FrameBack.BackgroundColor = colorFromMobileSettings; FrameBtnNext.BackgroundColor = colorFromMobileSettings; FrameBtnFinish.BackgroundColor = colorFromMobileSettings; var nextClick = new TapGestureRecognizer(); nextClick.Tapped += async(s, e) => { NextQuest(); }; FrameBtnNext.GestureRecognizers.Add(nextClick); //var backClickQuest = new TapGestureRecognizer(); //backClickQuest.Tapped += async (s, e) => { BackQuest(); }; //FrameBack.GestureRecognizers.Add(backClickQuest); var finishClick = new TapGestureRecognizer(); finishClick.Tapped += async(s, e) => { FinishClick(); }; FrameBtnFinish.GestureRecognizers.Add(finishClick); _oss = oSS; for (int qNow = 0; qNow < _oss.Questions.Count; qNow++) { if (!string.IsNullOrWhiteSpace(_oss.Questions[qNow].Answer)) { quest++; } } setIndicator(); setQuest(); setQuestVisible(); ChechQuestions(); setVisibleButton(); SetQuestion(quest); if (quest > 0) { visibleIndicator(quest, true); } if (ProtokolStackL.IsVisible) { urlProtokol.TextColor = colorFromMobileSettings; urlProtokol.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => await Launcher.OpenAsync(fileLink)) }); } pdf2.Foreground = colorFromMobileSettings; Color hexColor = (Color)Application.Current.Resources["MainColor"]; FramePool.SetAppThemeColor(Frame.BorderColorProperty, hexColor, Color.White); //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White); //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White); Color unselect = hexColor.AddLuminosity(0.3); StackLayoutIndicator.SetAppThemeColor(StackLayout.BackgroundColorProperty, unselect, Color.White); }
public OSSPersonalVotingResult(OSS oSS, bool userFinishPool = false) { InitializeComponent(); Analytics.TrackEvent("Персональные результаты голосования ОСС"); if (oSS.Accounts.Count > 0) { OSSAccount oSsAccount = oSS.Accounts[0]; ProtokolStackL.IsVisible = oSsAccount.HasVoitingBlankFile; urlProtokol.TextColor = colorFromMobileSettings; urlProtokol.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => await Launcher.OpenAsync(oSsAccount.VoitingBlankFileLink)) }); } else { ProtokolStackL.IsVisible = false; } forsvg = false; this.BindingContext = this; 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); if (userFinishPool) { listNeedUpdate = userFinishPool; } 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); }
async void SetDesignOrder(OSS sObj) { /******* Порядок приема решений ********/ //видимая часть Frame CommonTheme = GetFrame(); CommonTheme.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); CommonTheme.GestureRecognizers.Add(ShowHideAction()); StackLayout rootStack = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; //добавляем иконку stack.Children.Add(getIconView("ic_info_design_order")); //основной текст stack.Children.Add(HeadLabel(AppResources.OSSInfoOrder)); //стрелка var iconViewArrowCommonTheme = await getIconArrowAsync(); stack.Children.Add(iconViewArrowCommonTheme); arrows.Add(CommonTheme.Id, iconViewArrowCommonTheme.Id); //добавляем видимю часть на старте rootStack.Children.Add(stack); //невидимые на старте элементы фрейма, кроме 1го фрейма StackLayout additionslData = new StackLayout() { IsVisible = false, Orientation = StackOrientation.Vertical }; //добавляем в список связку стека с невидимыми полями и родительского фрейма frames.Add(CommonTheme.Id, additionslData.Id); //Электронные образцы var site = new Label(); var fs = new FormattedString(); Span t = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoTypeElec} {AppResources.OSSInfoTypes}: " }; fs.Spans.Add(t); var fsSpanUrl = new Span() { Text = sObj.WebSiteForScanDocView, TextColor = colorFromMobileSettings, TextDecorations = TextDecorations.Underline }; fsSpanUrl.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => await Launcher.OpenAsync(sObj.WebSiteForScanDocView)) }); fs.Spans.Add(fsSpanUrl); site.FormattedText = fs; additionslData.Children.Add(site); //Рукописные образцы: - содержимое поля надо уточнить var placeForWriteDesigns = sObj.PlaceOfReceiptSolutions; var docName = detailLabel($"{AppResources.OSSInfoTypeHand} {AppResources.OSSInfoTypes}: ", placeForWriteDesigns); additionslData.Children.Add(docName); rootStack.Children.Add(additionslData); CommonTheme.Content = rootStack; OSSListContent.Children.Add(CommonTheme); }
async void SetAdmin(OSS sObj) { /******* Сведения об администраторе ********/ //видимая часть Frame frame = GetFrame(); frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); frame.GestureRecognizers.Add(ShowHideAction()); StackLayout rootStack = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; //добавляем иконку stack.Children.Add(getIconView("ic_info_admin")); //основной текст stack.Children.Add(HeadLabel(AppResources.OSSInfoAdminHeader)); //стрелка var iconViewArrowCommonTheme = await getIconArrowAsync(); stack.Children.Add(iconViewArrowCommonTheme); arrows.Add(frame.Id, iconViewArrowCommonTheme.Id); //добавляем видимю часть на старте rootStack.Children.Add(stack); //невидимые на старте элементы фрейма, кроме 1го фрейма StackLayout additionslData = new StackLayout() { IsVisible = false, Orientation = StackOrientation.Vertical }; //добавляем в список связку стека с невидимыми полями и родительского фрейма frames.Add(frame.Id, additionslData.Id); //Фирменное наименование Label name = detailLabel($"{AppResources.OSSInfoAdminFirm}: ", sObj.AdminstratorName); additionslData.Children.Add(name); //Организационно-правовая форма Label opf = detailLabel($"{AppResources.OSSInfoAdminForm}: ", sObj.AdministratorIsUL? AppResources.Entity : AppResources.Resident); additionslData.Children.Add(opf); //Место нахождения additionslData.Children.Add(detailLabel($"{AppResources.OSSInfoAdminPlace}: ", sObj.AdminstratorAddress)); //Почтовый адрес additionslData.Children.Add(detailLabel($"{AppResources.OSSInfoPostCode}: ", sObj.AdminstratorPostAddress)); //Контактный номер телефона additionslData.Children.Add(detailLabel($"{AppResources.OSSInfoContact}: ", sObj.AdminstratorPhone)); //Официальный сайт var site = new Label(); var fs = new FormattedString(); Span t = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoOfficialSite}: " }; fs.Spans.Add(t); var fsSpanUrl = new Span() { Text = sObj.AdminstratorSite, TextColor = colorFromMobileSettings, TextDecorations = TextDecorations.Underline }; fsSpanUrl.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => await Launcher.OpenAsync(sObj.AdminstratorSite)) }); fs.Spans.Add(fsSpanUrl); site.FormattedText = fs; additionslData.Children.Add(site); //без заполнения, поля надо уточнить //ФИО var fio = sObj.AdminstratorName; additionslData.Children.Add(detailLabel($"{AppResources.FIO}: ", fio)); //Паспортные данные var passport = sObj.AdminstratorDocNumber; additionslData.Children.Add(detailLabel($"{AppResources.OSSInfoPassport}: ", passport)); //Место постоянного проживания var passportAdress = sObj.AdminstratorAddress; additionslData.Children.Add(detailLabel($"{AppResources.OSSInfoPMJ}: ", passportAdress)); //Адрес электронной почты var emailAdress = sObj.AdminstratorEmail; additionslData.Children.Add(detailLabel($"{AppResources.EmailAdress}: ", emailAdress)); rootStack.Children.Add(additionslData); frame.Content = rootStack; OSSListContent.Children.Add(frame); }
public OSSInfo(OSS sObj) { InitializeComponent(); Analytics.TrackEvent("ОСС Инфо"); forsvg = false; BindingContext = this; 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 backClick = new TapGestureRecognizer(); backClick.Tapped += async(s, e) => { try { _ = await Navigation.PopAsync(); } catch (Exception exception) { _ = await Navigation.PopModalAsync(); } }; BackStackLayout.GestureRecognizers.Add(backClick); UkName.Text = Settings.MobileSettings.main_name; Btn.BackgroundColor = colorFromMobileSettings; _oss = sObj; //заполнение статуса ОСС FiilOssStatusLayout(sObj); FillOssInfoAsync(sObj); SetTheme(sObj); SetProperty(sObj); SetAdmin(sObj); SetDesignOrder(sObj); Color hexColor = (Color)Application.Current.Resources["MainColor"]; //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White); PancakeBot.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White); }
async void SetProperty(OSS sObj) { /******* Сведения о собственности ********/ //видимая часть Frame frame = GetFrame(); frame.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); frame.GestureRecognizers.Add(ShowHideAction()); StackLayout rootStack = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; //добавляем иконку stack.Children.Add(getIconView("ic_info_property")); //основной текст stack.Children.Add(HeadLabel(AppResources.OSSInfoPropHeader)); //стрелка var iconViewArrowCommonTheme = await getIconArrowAsync(); stack.Children.Add(iconViewArrowCommonTheme); arrows.Add(frame.Id, iconViewArrowCommonTheme.Id); //добавляем видимю часть на старте rootStack.Children.Add(stack); //невидимые на старте элементы фрейма, кроме 1го фрейма StackLayout additionslData = new StackLayout() { IsVisible = false, Orientation = StackOrientation.Vertical }; //добавляем в список связку стека с невидимыми полями и родительского фрейма frames.Add(frame.Id, additionslData.Id); //Реквизиты, подтверждающие собственность Label document = detailLabel($"{AppResources.OSSInfoProps}: ", sObj.Accounts[0].Document); additionslData.Children.Add(document); //Номер собственности Label propNum = detailLabel($"{AppResources.OSSInfoNumber}: ", sObj.Accounts[0].PremiseNumber); additionslData.Children.Add(propNum); //Площадь Label area = detailLabel($"{AppResources.OSSInfoArea}: ", $"{sObj.Accounts[0].Area} {AppResources.OSSInfoMeasurmentArea}"); additionslData.Children.Add(area); //Доля Label propertyPercent = detailLabel($"{AppResources.OSSInfoPart}: ", $"{sObj.Accounts[0].PropertyPercent} %"); additionslData.Children.Add(propertyPercent); //Общая площадь помещений Label areaTotal = detailLabel($"{AppResources.OSSInfoAllArea}: ", $"{AppResources.OSSInfoLivingArea}: {sObj.AreaResidential} {AppResources.OSSInfoMeasurmentArea}\n{AppResources.OSSInfoNonLivingArea}: {sObj.AreaNonresidential} {AppResources.OSSInfoMeasurmentArea}"); additionslData.Children.Add(areaTotal); rootStack.Children.Add(additionslData); frame.Content = rootStack; OSSListContent.Children.Add(frame); }
async void FillOssInfoAsync(OSS sObj) { /******* общая информация ********/ //видимая часть Frame CommonInfo = GetFrame(); CommonInfo.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); CommonInfo.GestureRecognizers.Add(ShowHideAction()); StackLayout rootStackCommon = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stackCommonInfo = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; //добавляем иконку stackCommonInfo.Children.Add(getIconView("ic_info")); //основной текст stackCommonInfo.Children.Add(HeadLabel(AppResources.OSSInfoGeneralInfo)); //стрелка var iconViewArrow = await getIconArrowAsync(); stackCommonInfo.Children.Add(iconViewArrow); arrows.Add(CommonInfo.Id, iconViewArrow.Id); //добавляем видимю часть на старте rootStackCommon.Children.Add(stackCommonInfo); //невидимые на старте элементы фрейма, кроме 1го фрейма prevAddtionlExpanded = CommonInfo; StackLayout additionslData = new StackLayout() { IsVisible = true, Orientation = StackOrientation.Vertical }; //добавляем в список связку стека с невидимыми полями и родительского фрейма frames.Add(CommonInfo.Id, additionslData.Id); //наименование документа var docName = detailLabel($"{AppResources.OSSInfoDocName}: ", sObj.MeetingTitle); additionslData.Children.Add(docName); //инициатор var initiator = detailLabel($"{AppResources.OSSInfoInitiator}: ", sObj.Author); additionslData.Children.Add(initiator); //Адрес дома Label adress = detailLabel($"{AppResources.OSSInfoAdress}: ", sObj.HouseAddress); additionslData.Children.Add(adress); //Реквизиты, подтверждающие собственность Label document = detailLabel($"{AppResources.OSSInfoProps}: ", sObj.Accounts[0].Document); additionslData.Children.Add(document); //Номер собственности Label propNum = detailLabel($"{AppResources.OSSInfoNumber}: ", sObj.Accounts[0].PremiseNumber); additionslData.Children.Add(propNum); //Площадь Label area = detailLabel($"{AppResources.OSSInfoArea}: ", $"{sObj.Accounts[0].Area} {AppResources.OSSInfoMeasurmentArea}"); additionslData.Children.Add(area); //Доля Label propertyPercent = detailLabel($"{AppResources.OSSInfoPart}: ", $"{sObj.Accounts[0].PropertyPercent} %"); additionslData.Children.Add(propertyPercent); //дата собрания Label date = detailLabel($"{AppResources.OSSInfoDate}: ", $"{sObj.DateStart} {AppResources.To} {sObj.DateEnd} {AppResources.OSSInfoDateInclude}"); additionslData.Children.Add(date); //форма проведения Label formAction = detailLabel($"{AppResources.OSSInfoForm}: ", sObj.Form); additionslData.Children.Add(formAction); rootStackCommon.Children.Add(additionslData); CommonInfo.Content = rootStackCommon; OSSListContent.Children.Add(CommonInfo); }
private void FiilOssStatusLayout(OSS oss) { int statusInt = 0;//зеленый if (Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) < DateTime.Now) { statusInt = 3; // красный, голосование окончено , статус "итоги голосования" и переход на эту страницу } if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) < DateTime.Now && Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) > DateTime.Now) { //статус - идет голосование if (!oss.Questions.Any(_ => string.IsNullOrWhiteSpace(_.Answer))) { // Ваш голос учтен - страница личных результатов голосования statusInt = 2;//желтый(стоит сейчас) или какой еще цвет? } else { //если не всё проголосовано, переходим на вопрос начиная с которго нет ответов, и продолжаем голосование statusInt = 1;//желтый } } if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) > DateTime.Now) { //зеленый, "Уведомление о проведении ОСС", statusInt = 0 statusInt = 0; } IconView iconViewStatusNameIcon = new IconView(); string textStatius = ""; Color ColorStatusTextString; if (statusInt == 0) { iconViewStatusNameIcon.Source = "ic_status_green"; iconViewStatusNameIcon.Foreground = Color.FromHex("#50ac2f"); ColorStatusTextString = Color.FromHex("#50ac2f"); textStatius = AppResources.OSSInfoNotif; } else if (statusInt == 1) { iconViewStatusNameIcon.Source = "ic_status_yellow"; iconViewStatusNameIcon.Foreground = Color.FromHex("#ff971c"); ColorStatusTextString = Color.FromHex("#ff971c"); textStatius = AppResources.OSSInfoVoting; } else //2 { iconViewStatusNameIcon.Source = "ic_status_red"; iconViewStatusNameIcon.Foreground = Color.FromHex("#ed2e37"); ColorStatusTextString = Color.FromHex("#ed2e37"); textStatius = AppResources.OSSInfoPassed; } iconViewStatusNameIcon.HeightRequest = 15; iconViewStatusNameIcon.WidthRequest = 15; iconViewStatusNameIcon.VerticalOptions = LayoutOptions.Center; iconViewStatusNameIcon.HorizontalOptions = LayoutOptions.Start; statusLayout.Children.Add(iconViewStatusNameIcon); Label statSting = new Label() { Text = textStatius, FontSize = 12, TextColor = ColorStatusTextString, HorizontalOptions = LayoutOptions.Start }; statusLayout.Children.Add(statSting); }
private async Task <bool> GetOssData(int type = 0) { ButtonActive.IsEnabled = false; ButtonArchive.IsEnabled = false; if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet) { Device.BeginInvokeOnMainThread(async() => await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK")); return(false); } //получаем данные от сервера по ОСС var result = await rc.GetOss(); //var result1 = await rc.GetOss(1); //var haveP =result.Data.Where(_ => _.HasProtocolFile).ToList(); if (result.Error == null) { var dateNow = DateTime.Now; //Завершенные if (type == 0) { var rr = result.Data.Where(_ => Convert.ToDateTime(_.DateEnd, new CultureInfo("ru-RU")) < dateNow).OrderByDescending(_ => _.DateEnd).ToList(); result.Data = rr; } //Активные if (type == 1) { var rr = result.Data.Where(_ => Convert.ToDateTime(_.DateEnd, new CultureInfo("ru-RU")) > dateNow).OrderByDescending(_ => _.DateEnd).ToList(); result.Data = rr; } frames.Clear(); arrows.Clear(); OSSListContent.Children.Clear(); bool isFirst = true; foreach (var oss in result.Data) { Frame f = new Frame(); f.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White); f.MinimumHeightRequest = 50; f.SetOnAppTheme(Frame.HasShadowProperty, false, true); f.BackgroundColor = Color.White; f.CornerRadius = Device.RuntimePlatform == Device.iOS? 20: 40; f.HorizontalOptions = LayoutOptions.FillAndExpand; f.Margin = new Thickness(0, 10); //по нажатию обработка в раскрытие TapGestureRecognizer tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += async(s, e) => { //делаем видимыми/невидимыми все доп.элементы Device.BeginInvokeOnMainThread(async() => { var frme = (Frame)s; if (prevAddtionlExpanded != null) { if (prevAddtionlExpanded.Id != frme.Id) { action(prevAddtionlExpanded, true); } } action(frme); prevAddtionlExpanded = frme; }); }; f.GestureRecognizers.Add(tapGesture); StackLayout rootStack = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; //добавление краткой инфо о собраниях StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; IconView iconViewStatus = new IconView(); iconViewStatus.Source = "ic_OssCircleStatus"; int statusInt = 0; //зеленый if (Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) < DateTime.Now) { iconViewStatus.Foreground = Color.FromHex("#ed2e37"); statusInt = 3; // красный, голосование окончено , статус "итоги голосования" и переход на эту страницу } if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) < DateTime.Now && Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) > DateTime.Now) { //статус - идет голосование if (oss.IsComplete) { // Ваш голос учтен - страница личных результатов голосования statusInt = 2; //желтый(стоит сейчас) или какой еще цвет? iconViewStatus.Foreground = Color.FromHex("#50ac2f"); } else { //если не все проголосовано, переходим на вопрос начиная с которго нет ответов, и продолжаем голосование iconViewStatus.Foreground = Color.FromHex("#ff971c"); statusInt = 1; //желтый } } if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) > DateTime.Now) { //зеленый, "Уведомление о проведении ОСС", statusInt = 0 iconViewStatus.Foreground = Color.FromHex("#50ac2f"); } iconViewStatus.HeightRequest = 15; iconViewStatus.WidthRequest = 15; iconViewStatus.VerticalOptions = LayoutOptions.Center; stack.Children.Add(iconViewStatus); Label MeetingTitle = new Label() { Text = oss.MeetingTitle, FontSize = 18, TextColor = Color.Black, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand }; stack.Children.Add(MeetingTitle); IconView iconViewArrow = new IconView(); iconViewArrow.Source = "ic_arrow_forward"; iconViewArrow.Foreground = colorFromMobileSettings; await iconViewArrow.RotateTo(90); iconViewArrow.HeightRequest = 15; iconViewArrow.WidthRequest = 15; iconViewArrow.VerticalOptions = LayoutOptions.Center; iconViewArrow.HorizontalOptions = LayoutOptions.End; stack.Children.Add(iconViewArrow); arrows.Add(f.Id, iconViewArrow.Id); //добавляем видимю часть на старте rootStack.Children.Add(stack); //невидимые на старте элементы фрейма, кроме 1го фрейма StackLayout additionslData = new StackLayout() { IsVisible = false, Orientation = StackOrientation.Vertical }; if (isFirst) { prevAddtionlExpanded = f; isFirst = false; } //добавляем в список связку стека с невидимыми плями и родительского фрейма frames.Add(f.Id, additionslData.Id); //инициатор Label initiator = new Label() { }; FormattedString text = new FormattedString(); Span t1 = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoInitiator}: " }; text.Spans.Add(t1); Span t2 = new Span() { TextColor = Color.Black, FontSize = 14, Text = oss.InitiatorNames }; text.Spans.Add(t2); initiator.FormattedText = text; additionslData.Children.Add(initiator); //дата собрания Label date = new Label() { }; FormattedString datetext = new FormattedString(); Span datet1 = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoDate}: " }; datetext.Spans.Add(datet1); Span datet2 = new Span() { TextColor = Color.Black, FontSize = 14, Text = $"{oss.DateStart} {AppResources.To} {oss.DateEnd}" }; datetext.Spans.Add(datet2); date.FormattedText = datetext; additionslData.Children.Add(date); //Адрес дома Label adress = new Label() { }; FormattedString adresstext = new FormattedString(); Span adresst1 = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoAdress}: " }; adresstext.Spans.Add(adresst1); Span adresst2 = new Span() { TextColor = Color.Black, FontSize = 14, Text = $"{oss.HouseAddress}" }; adresstext.Spans.Add(adresst2); adress.FormattedText = adresstext; additionslData.Children.Add(adress); //форма проведения Label formAction = new Label() { }; FormattedString formActiontext = new FormattedString(); Span formActiont1 = new Span() { TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoForm}: " }; formActiontext.Spans.Add(formActiont1); Span formActiont2 = new Span() { TextColor = Color.Black, FontSize = 14, Text = $"{oss.Form}" }; formActiontext.Spans.Add(formActiont2); formAction.FormattedText = formActiontext; additionslData.Children.Add(formAction); //разделитель BoxView delim = new BoxView() { BackgroundColor = Color.FromHex("#545454"), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 1, Margin = new Thickness(0, 10) }; additionslData.Children.Add(delim); //статус собрания: StackLayout status = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand }; StackLayout statusNameIcon = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand }; Label statusName = new Label() { Text = $"{AppResources.OSSInfoStatus} ", FontAttributes = FontAttributes.Bold, FontSize = 14, TextColor = Color.Black, HorizontalOptions = LayoutOptions.Start }; statusNameIcon.Children.Add(statusName); StackLayout coloredStatus = new StackLayout() { HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal }; IconView iconViewStatusNameIcon = new IconView(); string textStatius = ""; Color ColorStatusTextString; if (statusInt == 0) { iconViewStatusNameIcon.Source = "ic_status_green"; iconViewStatusNameIcon.Foreground = Color.FromHex("#50ac2f"); ColorStatusTextString = Color.FromHex("#50ac2f"); textStatius = AppResources.OSSInfoNotif; } else if (statusInt == 1) { iconViewStatusNameIcon.Source = "ic_status_yellow"; iconViewStatusNameIcon.Foreground = Color.FromHex("#ff971c"); ColorStatusTextString = Color.FromHex("#ff971c"); textStatius = AppResources.OSSInfoVoting; } else if (statusInt == 2) { iconViewStatusNameIcon.Source = "ic_status_done"; iconViewStatusNameIcon.Foreground = Color.FromHex("#50ac2f"); ColorStatusTextString = Color.FromHex("#50ac2f"); textStatius = AppResources.OSSVoteChecked; } else //3 { iconViewStatusNameIcon.Source = "ic_status_red"; iconViewStatusNameIcon.Foreground = Color.FromHex("#ed2e37"); ColorStatusTextString = Color.FromHex("#ed2e37"); textStatius = AppResources.OSSInfoPassed; } iconViewStatusNameIcon.HeightRequest = 15; iconViewStatusNameIcon.WidthRequest = 15; iconViewStatusNameIcon.VerticalOptions = LayoutOptions.Center; iconViewStatusNameIcon.HorizontalOptions = LayoutOptions.Start; coloredStatus.Children.Add(iconViewStatusNameIcon); Label statSting = new Label() { Text = textStatius, FontSize = 12, TextColor = ColorStatusTextString, HorizontalOptions = LayoutOptions.Start }; coloredStatus.Children.Add(statSting); statusNameIcon.Children.Add(coloredStatus); status.Children.Add(statusNameIcon); //кнопка раскрытия осс Frame buttonFrame = new Frame() { HeightRequest = 40, WidthRequest = 40, BackgroundColor = colorFromMobileSettings, CornerRadius = 10, Padding = 0 }; IconView iconViewArrowButton = new IconView(); iconViewArrowButton.Source = "ic_arrow_forward"; iconViewArrowButton.Foreground = Color.White; iconViewArrowButton.HeightRequest = 15; iconViewArrowButton.WidthRequest = 15; iconViewArrowButton.VerticalOptions = LayoutOptions.Center; iconViewArrowButton.HorizontalOptions = LayoutOptions.Center; buttonFrame.SetOnAppTheme(Frame.HasShadowProperty, false, true); buttonFrame.Content = iconViewArrowButton; TapGestureRecognizer buttonFrametapGesture = new TapGestureRecognizer(); buttonFrametapGesture.Tapped += async(s, e) => { OSS result = await rc.GetOssById(oss.ID.ToString()); switch (statusInt) { case 0: case 1: var setAcquintedResult = await rc.SetAcquainted(oss.ID); if (string.IsNullOrWhiteSpace(setAcquintedResult.Error)) { OpenPage(new OSSInfo(result)); } else { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSMain, "OK"); } break; case 3: //"Итоги голосования"/"завершено" - открываем форму общих результатов голосования OpenPage(new OSSTotalVotingResult(result)); break; case 2: //"Ваш голос учтен" - открываем форму личных результатов голосования OpenPage(new OSSPersonalVotingResult(result)); break; default: OpenPage(new OSSInfo(result)); return; } //await Navigation.PushAsync(new OSSInfo(oss)); }; buttonFrame.GestureRecognizers.Add(buttonFrametapGesture); status.Children.Add(buttonFrame); //Button bFrame = new Button() { ImageSource }; additionslData.Children.Add(status); //добавляем "невидимую" часть rootStack.Children.Add(additionslData); f.Content = rootStack; OSSListContent.Children.Add(f); } action(prevAddtionlExpanded); ButtonActive.IsEnabled = true; ButtonArchive.IsEnabled = true; //}); return(true); } else { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSMainInfo, "OK"); return(false); } }
public async Task <UploadResponse> FunctionHandler(UploadRequest uploadRequest, ILambdaContext context) { var regionFromEnv = Environment.GetEnvironmentVariable("AWS_REGION"); Console.WriteLine($"System.Environment.GetEnvironmentVariable(\"AWS_REGION\") = {regionFromEnv}"); var region = RegionEndpoint.GetBySystemName(regionFromEnv); IForgeUploadJobHanlder uploadJob; string jobId = ""; try { uploadJob = new S3ForgeUploadJobHandler(region, Environment.GetEnvironmentVariable("JOB_BUCKET")); } catch (Exception ex) { var response = new UploadResponse { StatusCode = (int)HttpStatusCode.InternalServerError, Error = JsonConvert.SerializeObject(new { message = ex.Message }) }; return(response); } try { string bucketName = uploadRequest.S3BucketName; string bucketKey = uploadRequest.S3ObjectKey; string forgeBucketKey = uploadRequest.ForgeBucketKey; string fileName = uploadRequest.ForgeModelName; jobId = uploadRequest.JobId; Console.WriteLine($"Request: {JsonConvert.SerializeObject(uploadRequest)}"); Console.WriteLine($"jobId = {jobId}"); await uploadJob.FromRequestToUploading(jobId); //Eventualmente qui prevedere altro parametro che se specificato permette di sovrascrivere il default per il bucket di origine using var client = new AmazonS3Client(region); var size = await GetObjectSize(client, bucketName, bucketKey); using var s3bucketStream = await GetS3Stream(client, bucketName, bucketKey); var uploadResult = await OSS.UploadObject(s3bucketStream, size, forgeBucketKey, fileName); var translationRequest = new ModelDerivative.TranslateObjectModel { bucketKey = forgeBucketKey, objectName = Base64Encode(uploadResult.objectId) }; Console.WriteLine($"Requesting translation with {JsonConvert.SerializeObject(translationRequest)}"); var convertResult = await ModelDerivative.TranslateObject(translationRequest); await uploadJob.FromUploadingToConverting(jobId, uploadResult, convertResult.ToJson()); var response = new UploadResponse { StatusCode = (int)HttpStatusCode.OK, UploadResult = uploadResult }; return(response); } catch (Exception ex) { Console.WriteLine($"Error uploading file: {ex.Message}"); try { if (!string.IsNullOrEmpty(jobId)) { await uploadJob.SetError(jobId, ex.Message); } } catch { }; var response = new UploadResponse { StatusCode = (int)HttpStatusCode.InternalServerError, Error = JsonConvert.SerializeObject(new { message = ex.Message }) }; return(response); } }