private async Task Initialize(Partner Partner, Guid?ShowingId, InsertedInformations_FailedVisits FailedVisitsForm, PartnerListForm PartnerListForm) { BusyIndicatorContainder.BackgroundColor = Color.FromRgba(255, 255, 255, 70); BusyIndicator.Color = Color.FromRgba(80, 100, 150, 255); ToolbarItem_LocalSave = new ToolbarItem(); ToolbarItem_LocalSave.Text = "ذخیره محلی"; ToolbarItem_LocalSave.Icon = "Save.png"; ToolbarItem_LocalSave.Activated += SubmitFailedVisitToStorage; ToolbarItem_LocalSave.Order = ToolbarItemOrder.Primary; ToolbarItem_LocalSave.Priority = 0; this.ToolbarItems.Add(ToolbarItem_LocalSave); ToolbarItem_SendToServer = new ToolbarItem(); ToolbarItem_SendToServer.Text = "ذخیره محلی"; ToolbarItem_SendToServer.Icon = "Upload.png"; ToolbarItem_SendToServer.Activated += SubmitFailedVisitToServer; ToolbarItem_SendToServer.Order = ToolbarItemOrder.Primary; ToolbarItem_SendToServer.Priority = 0; this.ToolbarItems.Add(ToolbarItem_SendToServer); this.ShowingId = ShowingId; var ShowingFailedVisit = ShowingId.HasValue ? (await App.DB.GetFailedVisitAsync(ShowingId.Value)) : null; this.FailedVisitsForm = FailedVisitsForm; this.PartnerListForm = PartnerListForm; SelectedPartner = Partner != null ? Partner : ShowingFailedVisit != null ? ShowingFailedVisit.Data.Partner : null; PartnerSelected(); if (SelectedPartner == null) { PartnerChangeButton.IsEnabled = true; } else { PartnerChangeButton.IsEnabled = false; } PartnerLabel.FontSize *= 1.5; var PartnerChangeButtonTapGestureRecognizer = new TapGestureRecognizer(); PartnerChangeButtonTapGestureRecognizer.Tapped += (sender, e) => { if (PartnerChangeButton.IsEnabled) { var PartnerListForm1 = new PartnerListForm(); PartnerListForm1.FailedOrderInsertForm = this; Navigation.PushAsync(PartnerListForm1); } }; PartnerChangeButtonTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id"); PartnerChangeButton.GestureRecognizers.Add(PartnerChangeButtonTapGestureRecognizer); PartnerChangeButton.WidthRequest = 150; var NotOrderReasonsResult = await App.DB.GetNotOrderReasonsAsync(); if (!NotOrderReasonsResult.Success) { App.ShowError("خطا", "NotOrderReasonsResult.Message", "خوب"); try { Navigation.PopAsync(); } catch (Exception) { } } NotOrderReasons = NotOrderReasonsResult.Data.ToArray(); foreach (var NotOrderReason in NotOrderReasons) { FailedOrderReason.Items.Add(NotOrderReason.Name); } FailedOrderReason.SelectedIndexChanged += (sender, e) => { FailedOrderReasonLabel.Text = NotOrderReasons[FailedOrderReason.SelectedIndex].Name; }; if (ShowingFailedVisit != null) { for (int i = 0; i < NotOrderReasons.Length; i++) { if (NotOrderReasons[i].Id == ShowingFailedVisit.Data.NotOrderReason.Id) { FailedOrderReason.SelectedIndex = i; FailedOrderReasonLabel.Text = NotOrderReasons[i].Name; } } Description.Text = ShowingFailedVisit.Data.FailedVisit.Description; if (FailedVisitsForm == null) { Description.IsEnabled = false; FailedOrderReason.IsEnabled = false; FailedOrderReasonChangeButton.IsEnabled = false; this.ToolbarItems.Remove(ToolbarItem_LocalSave); this.ToolbarItems.Remove(ToolbarItem_SendToServer); } } }
public InsertedInformations() { InitializeComponent(); Partners = new InsertedInformations_Partners(this) { StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED") }; FailedVisits = new InsertedInformations_FailedVisits(this) { StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED") }; Orders = new InsertedInformations_Orders(this) { StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED") }; App.InsertedInformations_Partners = Partners; App.InsertedInformations_FailedVisits = FailedVisits; App.InsertedInformations_Orders = Orders; Children.Add(Partners); Children.Add(FailedVisits); Children.Add(Orders); ToolbarItem_SearchBar = new ToolbarItem(); ToolbarItem_SearchBar.Text = "جستجو"; ToolbarItem_SearchBar.Icon = "Search.png"; ToolbarItem_SearchBar.Order = ToolbarItemOrder.Primary; ToolbarItem_SearchBar.Priority = 10; ToolbarItem_SelectAll = new ToolbarItem(); ToolbarItem_SelectAll.Text = "انتخاب همه"; ToolbarItem_SelectAll.Icon = "SelectAll_Empty.png"; ToolbarItem_SelectAll.Order = ToolbarItemOrder.Primary; ToolbarItem_SelectAll.Priority = 9; ToolbarItem_SendToServer = new ToolbarItem(); ToolbarItem_SendToServer.Text = "ارسال"; ToolbarItem_SendToServer.Icon = "Upload.png"; ToolbarItem_SendToServer.Order = ToolbarItemOrder.Primary; ToolbarItem_SendToServer.Priority = 1; ToolbarItem_Delete = new ToolbarItem(); ToolbarItem_Delete.Text = "حذف"; ToolbarItem_Delete.Icon = "Delete.png"; ToolbarItem_Delete.Order = ToolbarItemOrder.Primary; ToolbarItem_Delete.Priority = 2; ToolbarItem_Edit = new ToolbarItem(); ToolbarItem_Edit.Text = "ویرایش"; ToolbarItem_Edit.Icon = "Edit.png"; ToolbarItem_Edit.Order = ToolbarItemOrder.Primary; ToolbarItem_Edit.Priority = 3; ToolbarItem_Show = new ToolbarItem(); ToolbarItem_Show.Text = "نمایش"; ToolbarItem_Show.Icon = "ShowInvoice.png"; ToolbarItem_Show.Order = ToolbarItemOrder.Primary; ToolbarItem_Show.Priority = 4; this.CurrentPageChanged += (sender, e) => { if (this.CurrentPage == Orders) { Orders.SetCurrentPage(); FailedVisits.UnsetCurrentPage(); Partners.UnsetCurrentPage(); } if (this.CurrentPage == FailedVisits) { Orders.UnsetCurrentPage(); FailedVisits.SetCurrentPage(); Partners.UnsetCurrentPage(); } if (this.CurrentPage == Partners) { Orders.UnsetCurrentPage(); FailedVisits.UnsetCurrentPage(); Partners.SetCurrentPage(); } }; CurrentPage = Orders; }
public FailedOrderInsertForm(Partner Partner, Guid?ShowingId, InsertedInformations_FailedVisits FailedVisitsForm, PartnerListForm PartnerListForm) { InitializeComponent(); Initialize(Partner, ShowingId, FailedVisitsForm, PartnerListForm); }