public SettingsForm_ServerAddressAddEdit(string Address, bool Editing, SettingsForm_ServerAddress SettingsForm_ServerAddress)
        {
            InitializeComponent();

            this.SettingsForm_ServerAddress = SettingsForm_ServerAddress;

            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);

            EditingAddress     = Editing ? Address : "";
            ServerAddress.Text = Address;
            LayoutStack.Children.Add(ServerAddress);
        }
Example #2
0
        public SettingsForm()
        {
            InitializeComponent();

            PrepareFormElements();

            ShowNotAvailableStuffsOnOrderInsertionSwitch.IsToggled = App.ShowNotAvailableStuffsOnOrderInsertion.Value;
            ShowNotAvailableStuffsOnOrderInsertionSwitch.Toggled  += (sender, e) =>
            {
                App.ShowNotAvailableStuffsOnOrderInsertion.Value = ShowNotAvailableStuffsOnOrderInsertionSwitch.IsToggled;
            };

            ShowConsumerPriceSwitch.IsToggled = App.ShowConsumerPrice.Value;
            ShowConsumerPriceSwitch.Toggled  += (sender, e) =>
            {
                App.ShowConsumerPrice.Value = ShowConsumerPriceSwitch.IsToggled;
            };

            if (App.Accesses.AccessToViewPartnerRemainder)
            {
                PartnerShowAccountingCycleSwitch_Remainder.IsToggled = App.ShowAccountingCycleOfPartner_Remainder.Value;
                PartnerShowAccountingCycleSwitch_Remainder.Toggled  += (sender, e) =>
                {
                    App.ShowAccountingCycleOfPartner_Remainder.Value = PartnerShowAccountingCycleSwitch_Remainder.IsToggled;
                };

                PartnerShowAccountingCycleSwitch_UncashedCheques.IsToggled = App.ShowAccountingCycleOfPartner_UncashedCheques.Value;
                PartnerShowAccountingCycleSwitch_UncashedCheques.Toggled  += (sender, e) =>
                {
                    App.ShowAccountingCycleOfPartner_UncashedCheques.Value = PartnerShowAccountingCycleSwitch_UncashedCheques.IsToggled;
                };

                PartnerShowAccountingCycleSwitch_ReturnedCheques.IsToggled = App.ShowAccountingCycleOfPartner_ReturnedCheques.Value;
                PartnerShowAccountingCycleSwitch_ReturnedCheques.Toggled  += (sender, e) =>
                {
                    App.ShowAccountingCycleOfPartner_ReturnedCheques.Value = PartnerShowAccountingCycleSwitch_ReturnedCheques.IsToggled;
                };
            }

            ShowPartnerLegalNameInList.IsToggled = App.ShowPartnerLegalNameInList.Value;
            ShowPartnerLegalNameInList.Toggled  += (sender, e) =>
            {
                App.ShowPartnerLegalNameInList.Value = ShowPartnerLegalNameInList.IsToggled;
            };

            ShowPartnerGroupInList.IsToggled = App.ShowPartnerGroupInList.Value;
            ShowPartnerGroupInList.Toggled  += (sender, e) =>
            {
                App.ShowPartnerGroupInList.Value = ShowPartnerGroupInList.IsToggled;
            };

            ShowStuffCodeInOrderInsertForm.IsToggled = App.ShowStuffCodeInOrderInsertForm.Value;
            ShowStuffCodeInOrderInsertForm.Toggled  += (sender, e) =>
            {
                App.ShowStuffCodeInOrderInsertForm.Value = ShowStuffCodeInOrderInsertForm.IsToggled;
            };

            DefaultPriceListPicker.IsVisible = false;
            var DefaultPriceListTapGestureRecognizer = new TapGestureRecognizer();

            DefaultPriceListTapGestureRecognizer.Tapped += (sender, e) => {
                DefaultPriceListPicker.Focus();
            };
            DefaultPriceListLabel1.GestureRecognizers.Add(DefaultPriceListTapGestureRecognizer);
            DefaultPriceListLabel2.GestureRecognizers.Add(DefaultPriceListTapGestureRecognizer);

            FillPriceListVersionsAsync(!string.IsNullOrEmpty(App.DefaultPriceListVersionId.Value) ? new Guid(App.DefaultPriceListVersionId.Value) : new Nullable <Guid>());

            if (App.DefineWarehouseForSaleAndBuy.Value)
            {
                DefaultWarehousePicker.IsVisible = false;
                var DefaultWarehouseTapGestureRecognizer = new TapGestureRecognizer();
                DefaultWarehouseTapGestureRecognizer.Tapped += (sender, e) => {
                    DefaultWarehousePicker.Focus();
                };
                DefaultWarehouseLabel1.GestureRecognizers.Add(DefaultWarehouseTapGestureRecognizer);
                DefaultWarehouseLabel2.GestureRecognizers.Add(DefaultWarehouseTapGestureRecognizer);

                FillWarehousesAsync(!string.IsNullOrEmpty(App.DefaultWarehouseId.Value) ? new Guid(App.DefaultWarehouseId.Value) : new Guid?());
            }

            StuffListGroupingPicker.IsVisible = false;
            var StuffListGroupingTapGestureRecognizer = new TapGestureRecognizer();

            StuffListGroupingTapGestureRecognizer.Tapped += (sender, e) => {
                StuffListGroupingPicker.Focus();
            };
            StuffListGroupingLabel1.GestureRecognizers.Add(StuffListGroupingTapGestureRecognizer);
            StuffListGroupingLabel2.GestureRecognizers.Add(StuffListGroupingTapGestureRecognizer);

            StuffListGroupingPicker.Items.Clear();
            StuffListGroupingPicker.Items.Add(StuffListGroupings[0]);
            StuffListGroupingPicker.Items.Add(StuffListGroupings[1]);
            StuffListGroupingPicker.Items.Add(StuffListGroupings[2]);

            FillStuffListGroupingsAsync(App.StuffListGroupingMethod.Value);

            var ServerAddressTapGestureRecognizer = new TapGestureRecognizer();

            ServerAddressTapGestureRecognizer.Tapped += async(sender, e) =>
            {
                var SettingsForm_ServerAddress = new SettingsForm_ServerAddress(this, null)
                {
                    StartColor = Color.FromHex("E6EBEF"),
                    EndColor   = Color.FromHex("A6CFED")
                };
                await this.Navigation.PushAsync(SettingsForm_ServerAddress);
            };
            ServerAddressLabel1.GestureRecognizers.Add(ServerAddressTapGestureRecognizer);
            ServerAddressLabel2.GestureRecognizers.Add(ServerAddressTapGestureRecognizer);
            ServerAddressLabel2.Text = App.ServerAddress.ReplaceLatinDigits();

            var GallaryStuffCountTapGestureRecognizer = new TapGestureRecognizer();

            GallaryStuffCountTapGestureRecognizer.Tapped += async(sender, e) =>
            {
                var SettingsForm_GallaryStuffCount = new SettingsForm_GallaryStuffCount(this)
                {
                    StartColor = Color.FromHex("E6EBEF"),
                    EndColor   = Color.FromHex("A6CFED")
                };
                await this.Navigation.PushAsync(SettingsForm_GallaryStuffCount);
            };
            GallaryStuffCountLabel1.GestureRecognizers.Add(GallaryStuffCountTapGestureRecognizer);
            GallaryStuffCountLabel2.GestureRecognizers.Add(GallaryStuffCountTapGestureRecognizer);
            RefreshGallryStuffCount();

            var PrinterTapGestureRecognizer = new TapGestureRecognizer();

            PrinterTapGestureRecognizer.Tapped += async(sender, e) =>
            {
                var SettingsForm_Printers = new SettingsForm_Printers(this, null)
                {
                    StartColor = Color.FromHex("E6EBEF"),
                    EndColor   = Color.FromHex("A6CFED")
                };
                await this.Navigation.PushAsync(SettingsForm_Printers);
            };
            PrintersLabel1.GestureRecognizers.Add(PrinterTapGestureRecognizer);
            PrintersLabel2.GestureRecognizers.Add(PrinterTapGestureRecognizer);
            PrintersLabel2.Text = App.SelectedPrinter != null?App.SelectedPrinter.Title.ReplaceLatinDigits() : "تعریف نشده";
        }