public View GetView(bool WithBinding) { if (WithBinding) { this.SetBinding(CustomFreeProductStuffListCell.StuffIdProperty, "StuffId"); } Grid GridWrapper = new Grid() { Padding = new Thickness(5, 0), RowSpacing = 1, ColumnSpacing = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex(WithBinding ? "#DCE6FA" : "#0062C4") }; GridWrapper.RowDefinitions.Add(new RowDefinition() { Height = WithBinding ? 45 : 25 }); GridWrapper.RowDefinitions.Add(new RowDefinition() { Height = WithBinding ? 45 : 25 }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0.5, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); Label CodeLabel = null, NameLabel = null, UnitNameLabel = null, StockLabel = null, FeeLabel = null, PriceLabel = null, QuantityLabel = null, AddedQuantityPlusLabel = null, AddedQuantityMinusLabel = null; Label AddedQuantityEntry = null; CodeLabel = new Label() { LineBreakMode = LineBreakMode.HeadTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; NameLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; UnitNameLabel = WithBinding ? new FullRoundedLabel() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 0 } : new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; StockLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; FeeLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "1845A5" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; PriceLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "1845A5" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; QuantityLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; AddedQuantityPlusLabel = new RightEntryCompanionLabel() { LineBreakMode = LineBreakMode.TailTruncation, Text = "+", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 1 }; AddedQuantityMinusLabel = new LeftEntryCompanionLabel() { LineBreakMode = LineBreakMode.TailTruncation, Text = "-", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 1 }; AddedQuantityEntry = new MyLabel() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 0, BackgroundColor = Color.FromHex("fff"), Padding = new Thickness(10) }; GridWrapper.Children.Add(CodeLabel, 7, 0); GridWrapper.Children.Add(NameLabel, 1, 0); Grid.SetColumnSpan(NameLabel, 6); GridWrapper.Children.Add(UnitNameLabel, 0, 0); if (WithBinding) { GridWrapper.Children.Add(PriceLabel, 0, 1); GridWrapper.Children.Add(FeeLabel, 1, 1); GridWrapper.Children.Add(AddedQuantityMinusLabel, 3, 1); GridWrapper.Children.Add(AddedQuantityEntry, 4, 1); GridWrapper.Children.Add(AddedQuantityPlusLabel, 5, 1); GridWrapper.Children.Add(QuantityLabel, 6, 1); GridWrapper.Children.Add(StockLabel, 7, 1); } else { GridWrapper.Children.Add(PriceLabel, 0, 1); GridWrapper.Children.Add(FeeLabel, 1, 1); GridWrapper.Children.Add(QuantityLabel, 3, 1); Grid.SetColumnSpan(QuantityLabel, 4); GridWrapper.Children.Add(StockLabel, 7, 1); } if (WithBinding) { CodeLabel.SetBinding(Label.TextProperty, "StuffCode"); NameLabel.SetBinding(Label.TextProperty, "StuffName"); UnitNameLabel.SetBinding(Label.TextProperty, "UnitName"); StockLabel.SetBinding(Label.TextProperty, "Stock"); FeeLabel.SetBinding(Label.TextProperty, "Fee"); PriceLabel.SetBinding(Label.TextProperty, "Price"); QuantityLabel.SetBinding(Label.TextProperty, "CurrentQuantity"); AddedQuantityEntry.SetBinding(Label.TextProperty, "AddedQuantityLabel"); } else { CodeLabel.Text = "کد کالا"; NameLabel.Text = "نام کالا"; UnitNameLabel.Text = "واحد"; StockLabel.Text = "موجودی"; FeeLabel.Text = "فی"; PriceLabel.Text = "ارزش اشانتیون"; QuantityLabel.Text = "تعداد"; } var UnitNameTapGestureRecognizer = new TapGestureRecognizer(); UnitNameTapGestureRecognizer.Tapped += UnitNameTapEventHandler; UnitNameTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "StuffId"); UnitNameLabel.GestureRecognizers.Add(UnitNameTapGestureRecognizer); var QuantityPlusTapGestureRecognizer = new TapGestureRecognizer(); QuantityPlusTapGestureRecognizer.Tapped += QuantityPlusTapEventHandler; QuantityPlusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "StuffId"); AddedQuantityPlusLabel.GestureRecognizers.Add(QuantityPlusTapGestureRecognizer); var QuantityMinusTapGestureRecognizer = new TapGestureRecognizer(); QuantityMinusTapGestureRecognizer.Tapped += QuantityMinusTapEventHandler; QuantityMinusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "StuffId"); AddedQuantityMinusLabel.GestureRecognizers.Add(QuantityMinusTapGestureRecognizer); var AddedQuantityTextBoxTapGestureRecognizer = new TapGestureRecognizer(); AddedQuantityTextBoxTapGestureRecognizer.Tapped += AddedQuantityTextBoxTapEventHandler; AddedQuantityTextBoxTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "StuffId"); AddedQuantityEntry.GestureRecognizers.Add(AddedQuantityTextBoxTapGestureRecognizer); return(GridWrapper); }
public PartnerChange(Partner Partner, PartnerListForm PartnerListForm, InsertedInformations_Partners InsertedInformations_Partners, bool JustShow) { InitializeComponent(); this.PartnerListForm = PartnerListForm; this.InsertedInformations_Partners = InsertedInformations_Partners; this.JustShow = JustShow; this.Padding = new Thickness(5, 10); EditingPartner = Partner; //این 2 گروه در گروه مشتری ها نمی آیند //مشتریان بدون گروه //پرسنل شرکت PartnerGroups = App.DB.GetPartnerGroups().Where(a => a.Id != new Guid("00000000-0000-0000-0000-FFFFFFFFFFFF") && a.Id != new Guid("00000000-0000-0000-0000-EEEEEEEEEEEE")).ToArray(); PartnerGroupSwitchs = new KeyValuePair <Label, Switch> [PartnerGroups.Length]; for (int i = 0; i < PartnerGroups.Length; i++) { PartnerGroupSwitchs[i] = new KeyValuePair <Label, Switch>(new Label() { Text = PartnerGroups[i].Name, HorizontalOptions = LayoutOptions.EndAndExpand }, new Switch() { HorizontalOptions = LayoutOptions.End }); } City_Label = new Label() { Text = "شهر: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Zone_Label = new Label() { Text = "منطقه: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Route_Label = new Label() { Text = "مسیر: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; FirstName_Label = new Label() { Text = "نام: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; LastName_Label = new Label() { Text = "نام خانوادگی: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; LegalName_Label = new Label() { Text = "نام حقوقی: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Phone1_Label = new Label() { Text = "تلفن 1: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Phone2_Label = new Label() { Text = "تلفن 2: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Cell_Label = new Label() { Text = "تلفن همراه: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Fax_Label = new Label() { Text = "فکس: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Address_Label = new Label() { Text = "آدرس: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; Credit_Label = new Label() { Text = "اعتبار: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; IsPartnerLegal_Label = new Label() { Text = "مشتری حقوقی است.", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.EndAndExpand }; CalculateVATForThisPerson_Label = new Label() { Text = "محاسبه مالیات ا.ا. برای این مشتری", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.EndAndExpand }; PartnerGroup_Label = new Label() { Text = "گروه مشتری: ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; City = new RightRoundedLabel() { Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18 }; CityPicker = new Picker() { }; CityChangeButton = new LeftEntryCompanionLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..." }; Zone = new RightRoundedLabel() { Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18 }; ZonePicker = new Picker() { }; ZoneChangeButton = new LeftEntryCompanionLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..." }; Route = new RightRoundedLabel() { Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18 }; RoutePicker = new Picker() { }; RouteChangeButton = new LeftEntryCompanionLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..." }; FillZones(EditingPartner != null ? EditingPartner.ZoneId : new Nullable <Guid>(), EditingPartner != null ? EditingPartner.Groups.Select(a => a.Id).ToArray() : new Guid[] { }); FirstName = new MyEntry() { Text = EditingPartner != null ? EditingPartner.FirstName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10) }; LastName = new MyEntry() { Text = EditingPartner != null ? EditingPartner.LastName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10) }; LegalName = new MyEntry() { Text = EditingPartner != null ? EditingPartner.LegalName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10) }; Phone1 = new MyEntry() { Text = EditingPartner != null ? EditingPartner.Phone1 : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone }; Phone2 = new MyEntry() { Text = EditingPartner != null ? EditingPartner.Phone2 : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone }; Cell = new MyEntry() { Text = EditingPartner != null ? EditingPartner.Mobile : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone }; Fax = new MyEntry() { Text = EditingPartner != null ? EditingPartner.Fax : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone }; Address = new PlaceholderEditor() { Text = EditingPartner != null ? EditingPartner.Address : "", HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(30, 10) }; Credit = new RightRoundedLabel() { Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18 }; CreditPicker = new Picker() { }; CreditChangeButton = new LeftEntryCompanionLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..." }; FillCredits(EditingPartner != null ? EditingPartner.CreditId : new Nullable <Guid>()); IsPartnerLegal = new Switch() { IsToggled = EditingPartner != null ? EditingPartner.IsLegal : false, HorizontalOptions = LayoutOptions.End }; CalculateVATForThisPerson = new Switch() { IsToggled = EditingPartner != null ? EditingPartner.CalculateVATForThisPerson : false, HorizontalOptions = LayoutOptions.End }; ToolbarItem_LocalSave = new ToolbarItem(); ToolbarItem_LocalSave.Text = "ذخیره محلی"; ToolbarItem_LocalSave.Icon = "Save.png"; ToolbarItem_LocalSave.Clicked += SubmitPartnerToStorage; ToolbarItem_LocalSave.Order = ToolbarItemOrder.Primary; ToolbarItem_LocalSave.Priority = 0; if (!JustShow) { this.ToolbarItems.Add(ToolbarItem_LocalSave); } ToolbarItem_SendToServer = new ToolbarItem(); ToolbarItem_SendToServer.Text = "ذخیره محلی"; ToolbarItem_SendToServer.Icon = "Upload.png"; ToolbarItem_SendToServer.Activated += SubmitPartnerToServer; ToolbarItem_SendToServer.Order = ToolbarItemOrder.Primary; ToolbarItem_SendToServer.Priority = 0; if (!JustShow) { this.ToolbarItems.Add(ToolbarItem_SendToServer); } BusyIndicatorContainder.BackgroundColor = Color.FromRgba(255, 255, 255, 70); BusyIndicator.Color = Color.FromRgba(80, 100, 150, 255); }
public SettingsForm_PrintersAddEdit(PrinterSettingModel Printer, SettingsForm_Printers SettingsForm_Printers) { InitializeComponent(); TitleLabel = new MyEntry() { LeftRounded = true, RightRounded = true, Placeholder = "عنوان چاپگر", Padding = new Thickness(40, 10), FontSize = 18, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End }; GridLayout.Children.Add(TitleLabel, 0, 0); Grid.SetColumnSpan(TitleLabel, 2); BluetoothPrinterPicker = new Picker() { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; GridLayout.Children.Add(BluetoothPrinterPicker, 0, 1); BluetoothPrinterLabel = new RightRoundedLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End, Text = "چاپگر بلوتوث", Padding = new Thickness(40, 10), FontSize = 18 }; GridLayout.Children.Add(BluetoothPrinterLabel, 1, 1); BluetoothPrinterChangeButton = new LeftEntryCompanionLabel() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..." }; GridLayout.Children.Add(BluetoothPrinterChangeButton, 0, 1); WidthLabel = new MyEntry() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End, LeftRounded = true, RightRounded = true, Placeholder = "پهنای قابل چاپ(mm)", Padding = new Thickness(40, 10), FontSize = 18 }; GridLayout.Children.Add(WidthLabel, 0, 2); Grid.SetColumnSpan(WidthLabel, 2); DensityLabel = new MyEntry() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End, LeftRounded = true, RightRounded = true, Placeholder = "تراکم نقاط(dpi)", Padding = new Thickness(40, 10), FontSize = 18 }; GridLayout.Children.Add(DensityLabel, 0, 3); Grid.SetColumnSpan(DensityLabel, 2); FontSizeLabel = new MyEntry() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End, LeftRounded = true, RightRounded = true, Placeholder = "سایز فونت", Padding = new Thickness(40, 10), FontSize = 18 }; GridLayout.Children.Add(FontSizeLabel, 0, 4); Grid.SetColumnSpan(FontSizeLabel, 2); this.SettingsForm_Printers = SettingsForm_Printers; ToolbarItem_OK = new ToolbarItem(); ToolbarItem_OK.Text = "تایید"; ToolbarItem_OK.Icon = "Save.png"; ToolbarItem_OK.Order = ToolbarItemOrder.Primary; ToolbarItem_OK.Priority = 1; ToolbarItem_OK.Activated += ToolbarItem_OK_Activated; ToolbarItems.Add(ToolbarItem_OK); EditingPrinter = Printer; BluetoothPrinterPicker.SelectedIndexChanged += (sender, e) => { var SelectedDevice = (BluetoothDeviceModel)BluetoothPrinterPicker.SelectedItem; MacID = SelectedDevice.MACID; BluetoothPrinterLabel.Text = SelectedDevice.Name; }; SetEditingPrinter(); }
public View GetView(bool WithBinding) { if (WithBinding) { this.SetBinding(CustomArticleListCell.ArticleIdProperty, "Id"); } Grid GridWrapper = new Grid() { Padding = new Thickness(5, 0), RowSpacing = 1, ColumnSpacing = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex(WithBinding ? "#DCE6FA" : "#0062C4") }; GridWrapper.RowDefinitions.Add(new RowDefinition() { Height = 25 }); GridWrapper.RowDefinitions.Add(new RowDefinition() { Height = WithBinding ? 45 : 25 }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0.5, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); GridWrapper.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4, GridUnitType.Star) }); Label CodeLabel = null, NameLabel = null, QuantityLabel = null, PriceLabel = null, CurrentDiscountPercentLabel = null, DiscountAmountLabel = null, AfterDiscountReductionLabel = null, AddedDiscountPercentPlusLabel = null, AddedDiscountPercentMinusLabel = null; Label AddedDiscountPercentEntry = null; CodeLabel = new Label() { LineBreakMode = LineBreakMode.HeadTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; NameLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; QuantityLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; PriceLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; CurrentDiscountPercentLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; AddedDiscountPercentEntry = new MyLabel() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 0, BackgroundColor = Color.FromHex("fff"), Padding = new Thickness(10) }; AddedDiscountPercentPlusLabel = new RightEntryCompanionLabel() { Text = "+", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; AddedDiscountPercentMinusLabel = new LeftEntryCompanionLabel() { Text = "-", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; DiscountAmountLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; AfterDiscountReductionLabel = new Label() { LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16 }; GridWrapper.Children.Add(CodeLabel, 7, 0); GridWrapper.Children.Add(NameLabel, 1, 0); Grid.SetColumnSpan(NameLabel, 6); GridWrapper.Children.Add(QuantityLabel, 0, 0); GridWrapper.Children.Add(AfterDiscountReductionLabel, 0, 1); if (WithBinding) { GridWrapper.Children.Add(DiscountAmountLabel, 1, 1); GridWrapper.Children.Add(AddedDiscountPercentMinusLabel, 3, 1); GridWrapper.Children.Add(AddedDiscountPercentEntry, 4, 1); GridWrapper.Children.Add(AddedDiscountPercentPlusLabel, 5, 1); GridWrapper.Children.Add(CurrentDiscountPercentLabel, 6, 1); } else { GridWrapper.Children.Add(DiscountAmountLabel, 1, 1); GridWrapper.Children.Add(CurrentDiscountPercentLabel, 3, 1); Grid.SetColumnSpan(CurrentDiscountPercentLabel, 4); } GridWrapper.Children.Add(PriceLabel, 7, 1); if (WithBinding) { CodeLabel.SetBinding(Label.TextProperty, "StuffCode"); NameLabel.SetBinding(Label.TextProperty, "StuffName"); QuantityLabel.SetBinding(Label.TextProperty, "Quantity"); PriceLabel.SetBinding(Label.TextProperty, "SalePrice"); CurrentDiscountPercentLabel.SetBinding(Label.TextProperty, "CurrentDiscountPercent"); AddedDiscountPercentEntry.SetBinding(Label.TextProperty, "AddedDiscountPercentLabel"); DiscountAmountLabel.SetBinding(Label.TextProperty, "DiscountAmount"); AfterDiscountReductionLabel.SetBinding(Label.TextProperty, "AfterDiscountReduction"); } else { CodeLabel.Text = "کد کالا"; NameLabel.Text = "نام کالا"; QuantityLabel.Text = "تعداد"; PriceLabel.Text = "مبلغ ناخالص"; CurrentDiscountPercentLabel.Text = "تخفیف(%)"; DiscountAmountLabel.Text = "تخفیف($)"; AfterDiscountReductionLabel.Text = "با کسر تخفیف"; } var AddedDiscountPercentPlusTapGestureRecognizer = new TapGestureRecognizer(); AddedDiscountPercentPlusTapGestureRecognizer.Tapped += AddedDiscountPercentPlusTapEventHandler; AddedDiscountPercentPlusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id"); AddedDiscountPercentPlusLabel.GestureRecognizers.Add(AddedDiscountPercentPlusTapGestureRecognizer); var AddedDiscountPercentMinusTapGestureRecognizer = new TapGestureRecognizer(); AddedDiscountPercentMinusTapGestureRecognizer.Tapped += AddedDiscountPercentMinusTapEventHandler; AddedDiscountPercentMinusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id"); AddedDiscountPercentMinusLabel.GestureRecognizers.Add(AddedDiscountPercentMinusTapGestureRecognizer); var AddedDiscountPercentTextBoxTapGestureRecognizer = new TapGestureRecognizer(); AddedDiscountPercentTextBoxTapGestureRecognizer.Tapped += AddedDiscountPercentTextBoxTapEventHandler; AddedDiscountPercentTextBoxTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id"); AddedDiscountPercentEntry.GestureRecognizers.Add(AddedDiscountPercentTextBoxTapGestureRecognizer); return(GridWrapper); }