Esempio n. 1
0
        public void Date_ValueChanged(object sender, DateChangedEventArgs e)
        {
            DatePicker ctrl        = (DatePicker)sender;
            string     nestedname  = "";
            string     oldvalue    = "";
            string     description = "";

            ComosWebSDK.UI.UIDate b = (ComosWebSDK.UI.UIDate)ctrl.BindingContext;
            nestedname  = b.NestedName;
            oldvalue    = b.Value;
            description = b.Text;

            string comosDate = e.NewDate.ToOADate().ToString();

            //if (ctrl.NullableDate == null)
            //CheckValue(nestedname, "", oldvalue, description);
            //else
            CheckValue(nestedname, comosDate, oldvalue, description);
        }
Esempio n. 2
0
        public View UpdateAttributesUI(ComosWebSDK.UI.UIDate ui)
        {
            if (!ui.ReadOnly)
            {
                editablevalues.Add(ui);
            }

            StackLayout layout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            var lbl = new Label()
            {
                Text                    = ui.Text,
                WidthRequest            = App.WidthPixels / 3,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Start,
            };

            layout.Children.Add(lbl);

            if (ui.ReadOnly)
            {
                var txt = new Label()
                {
                    Text = ui.Value,
                };
                layout.Children.Add(txt);
            }
            else
            {
                var date = new DatePicker()
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    BindingContext    = ui,
                };


                if (ui.CachedValue != "" && ui.CachedValue != ui.Value && ui.CachedValue != null)
                {
                    date.Date      = Convert.ToDateTime(ui.CachedValue);
                    date.TextColor = (Color)App.Current.Resources["spec-only-cache"];
                    CheckValue(ui.NestedName, ui.CachedValue, ui.Value, ui.Text);
                }
                else
                {
                    if (!ui.Value.Equals(""))
                    {
                        date.Date = Convert.ToDateTime(ui.Value);
                        DateTime dateTime  = new DateTime(date.Date.Year, date.Date.Month, date.Date.Day);
                        string   comosDate = dateTime.ToOADate().ToString();
                        CheckValue(ui.NestedName, comosDate, ui.Value, ui.Text);
                    }
                    else
                    {
                        CheckValue(ui.NestedName, "", ui.Value, ui.Text);
                    }
                }

                date.DateSelected += Date_ValueChanged;

                layout.Children.Add(date);
            }

            AbsoluteLayout.SetLayoutBounds(layout, new Rectangle(
                                               ui.x, ui.y, ui.width, ui.height));
            return(layout);
        }