Ejemplo n.º 1
0
        private void TryUpdate()
        {
            //DateTime.for
            mainControl.TabPages.Clear();
            if (DBAccess.Instance.Values.AreCollectionsValidated)
            {
                foreach (var construction in DBAccess.Instance.Values.Constructions)
                {
                    mainControl.TabPages.Add(construction.Name);

                    var itemNames                 = from p in DBAccess.Instance.Values.Products.ToArray() where p.Name != string.Empty select p.Name;
                    List <EntryLine> entries      = new List <EntryLine>();
                    EntryLine        currentEntry = null;

                    foreach (var e in construction.EntryList)
                    {
                        entries.Add(new EntryLine(e.EntryIndex));
                        currentEntry = entries[e.EntryIndex];

                        currentEntry.LoadComboBoxes(new List <string>(itemNames).ToArray(), DBAccess.Instance.Values.Categories.ToArray());
                        currentEntry.ProductComboBox.SelectedIndex = e.ItemIndex;
                        currentEntry.CategoryComboBox.SelectedItem = Database.ProductList[e.ItemIndex].Category;
                        currentEntry.ProductQuantityTextBox.Text   = e.Quantity.ToString();
                        currentEntry.TotalAmountTextBox.Text       = e.Total.ToString();
                        currentEntry.UnitPriceTextBox.Text         = e.Cost.ToString();
                        currentEntry.DateTextBox.Text = e.Date;


                        mainControl.TabPages[mainControl.TabPages.Count - 1].Controls.Add(currentEntry);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public App()
        {
            var messagingCenter = new Button
            {
                Text    = "Messaging Center",
                Command = new Command(() => MainPage.Navigation.PushAsync(new MessagingServicePage()))
            };

            var line = new EntryLine
            {
                Placeholder             = "This nifty place for entering text!",
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                Text        = "",
                BorderColor = Color.FromHex("#ECECEC")
            };

            // The root page of your application
            MainPage = new NavigationPage(new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(32, 32, 32, 32),
                    Children        =
                    {
                        messagingCenter,
                        line
                    }
                }
            });
        }
Ejemplo n.º 3
0
        public App()
        {
            var messagingCenter = new Button
            {
                Text    = "Messaging Center",
                Command = new Command(() => MainPage.Navigation.PushAsync(new MessagingServicePage()))
            };

            var line = new EntryLine
            {
                Placeholder             = "This nifty place for entering text!",
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                Text        = "",
                FontSize    = 30,
                BorderColor = Color.Red
            };

            var trigger = new Trigger(typeof(EntryLine));

            trigger.Property = EntryLine.IsFocusedProperty;
            trigger.Value    = true;
            Setter setter = new Setter();

            setter.Property = EntryLine.BorderColorProperty;
            setter.Value    = Color.Yellow;

            trigger.Setters.Add(setter);

            line.Triggers.Add(trigger);

            var line2 = new EntryLine
            {
                PlaceholderColor        = Color.Orange,
                Placeholder             = "This nifty place for entering text!",
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                Text        = "",
                FontSize    = 10,
                BorderColor = Color.Red
            };

            // The root page of your application
            MainPage = new NavigationPage(new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(32, 32, 32, 32),
                    Children        =
                    {
                        messagingCenter,
                        line,
                        line2
                    }
                }
            });
        }
 void SetFontSize(EntryLine view)
 {
     if (view.FontSize != Font.Default.FontSize)
     {
         Control.Font = UIFont.SystemFontOfSize((System.nfloat)view.FontSize);
     }
     else if (view.FontSize == Font.Default.FontSize)
     {
         Control.Font = UIFont.SystemFontOfSize(17f);
     }
 }
 void SetPlaceholderTextColor(EntryLine view)
 {
     if (string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderColor != Color.Default)
     {
         var placeholderString = new NSAttributedString(view.Placeholder,
                                                        new UIStringAttributes {
             ForegroundColor = view.PlaceholderColor.ToUIColor()
         });
         Control.AttributedPlaceholder = placeholderString;
     }
 }
        void DrawBorder(EntryLine view)
        {
            var borderLayer = new CALayer();

            borderLayer.MasksToBounds = true;
            borderLayer.Frame         = new CoreGraphics.CGRect(0f, Frame.Height / 2, Frame.Width, 1f);
            borderLayer.BorderColor   = view.BorderColor.ToCGColor();
            borderLayer.BorderWidth   = 1.0f;

            Control.Layer.AddSublayer(borderLayer);
            Control.BorderStyle = UITextBorderStyle.None;
        }
 void DrawBorder(EntryLine view)
 {
     SetNeedsDisplay();
 }