예제 #1
0
        public TextBoxView(IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <TextBoxView>(() => TextProperty = PropertyEngine.RegisterProperty("Text",
                                                                                                             typeof(TextBoxView),
                                                                                                             typeof(string), new PropertyMetadata {
                DefaultValue = null
            }));

            var changedObservable = GetChangedObservable(TextProperty);

            Pointer.Down.Subscribe(point =>
            {
                Platform.Current.EventSource.ShowVirtualKeyboard();
                Platform.Current.SetFocusedElement(this);
            });

            Keyboard.KeyInput.Where(Filter).Subscribe(args => AddText(args.Text));
            Keyboard.SpecialKeys.Subscribe(ProcessSpecialKey);
            NotifyRenderAffectedBy(TextProperty);
            Platform.Current.FocusedElement.Select(layout => layout == this)
            .Subscribe(isFocused => IsFocused = isFocused);

            changedSubscription = changedObservable
                                  .Subscribe(o =>
            {
                FormattedText.Text = (string)o;
                EnforceCursorLimits();
                Invalidate();
            });
        }
예제 #2
0
파일: TextBox.cs 프로젝트: knocte/OmniGUI
        public TextBox(IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <TextBox>(() =>
            {
                TextWrappingProperty = PropertyEngine.RegisterProperty("TextWrapping", typeof(TextBox), typeof(TextWrapping), new PropertyMetadata {
                    DefaultValue = TextWrapping.NoWrap
                });
                ForegroundProperty = PropertyEngine.RegisterProperty("Foreground", typeof(TextBox), typeof(Brush), new PropertyMetadata {
                    DefaultValue = new Brush(Colors.Black)
                });
                TextProperty = PropertyEngine.RegisterProperty("Text", typeof(TextBox), typeof(string), new PropertyMetadata {
                    DefaultValue = null
                });
                FontFamilyProperty = PropertyEngine.RegisterProperty("FontFamily", typeof(TextBox), typeof(float), new PropertyMetadata {
                    DefaultValue = "Arial"
                });
                FontWeightProperty = PropertyEngine.RegisterProperty("FontWeight", typeof(TextBox), typeof(float), new PropertyMetadata {
                    DefaultValue = FontWeights.Normal
                });
                FontSizeProperty = PropertyEngine.RegisterProperty("FontSize", typeof(TextBox), typeof(float), new PropertyMetadata {
                    DefaultValue = 16F
                });
            });

            NotifyRenderAffectedBy(TextProperty);
            GetChangedObservable(TextProperty).Subscribe(t => Text = (string)t);
            Children.OnChildAdded(AttachToTextBoxView);
        }
예제 #3
0
        public ContentLayout(IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <ContentLayout>(() =>
            {
                ContentProperty = PropertyEngine.RegisterProperty("Content", typeof(ContentLayout), typeof(object), new PropertyMetadata {
                    DefaultValue = null
                });
            });

            GetChangedObservable(ContentProperty).Subscribe(SetContent);
        }
예제 #4
0
 public Image(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
     RegistrationGuard.RegisterFor <Image>(() =>
     {
         StretchProperty = PropertyEngine.RegisterProperty("Stretch", typeof(Image), typeof(Stretch), new PropertyMetadata {
             DefaultValue = Stretch.Uniform
         });
         SourceProperty = PropertyEngine.RegisterProperty("Source", typeof(Image), typeof(Bitmap), new PropertyMetadata()
         {
             DefaultValue = null
         });
     });
 }
예제 #5
0
파일: Button.cs 프로젝트: knocte/OmniGUI
        public Button(IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <Button>(() =>
            {
                CommandProperty = PropertyEngine.RegisterProperty("Command", typeof(Button), typeof(ICommand), new PropertyMetadata());
            });

            Pointer.Down.Subscribe(p =>
            {
                if (Command?.CanExecute(null) == true)
                {
                    Command.Execute(null);
                }
            });
        }
예제 #6
0
파일: Layout.cs 프로젝트: knocte/OmniGUI
        protected Layout(IPropertyEngine propertyEngine)
        {
            PropertyEngine = propertyEngine;

            RegistrationGuard.RegisterFor <Layout>(() =>
            {
                DataContextProperty = DataContextProperty = PropertyEngine.RegisterProperty("DataContext", typeof(Layout), typeof(object), new PropertyMetadata());
            });

            Children = new OwnedList <Layout>(this);
            Children.OnChildAdded(layout =>
            {
                layout.DataContext = DataContext;
                GetChangedObservable(DataContextProperty).Subscribe(o => layout.DataContext = o);
            });
            Pointer  = new PointerEvents(this, Platform.Current.EventSource);
            Keyboard = new KeyboardEvents(this, Platform.Current.EventSource, Platform.Current.FocusedElement);
        }
예제 #7
0
파일: Grid.cs 프로젝트: knocte/OmniGUI
 public Grid(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
     RegistrationGuard.RegisterFor <Grid>(() =>
     {
         RowSpanProperty = PropertyEngine.RegisterProperty("RowSpan", typeof(Grid), typeof(int), new AttachedPropertyMetadata {
             DefaultValue = 1
         });
         ColumnSpanProperty = PropertyEngine.RegisterProperty("ColumnSpan", typeof(Grid), typeof(int), new AttachedPropertyMetadata {
             DefaultValue = 1
         });
         RowProperty = PropertyEngine.RegisterProperty("Row", typeof(Grid), typeof(int), new AttachedPropertyMetadata {
             DefaultValue = 0
         });
         ColumnProperty = PropertyEngine.RegisterProperty("Column", typeof(Grid), typeof(int), new AttachedPropertyMetadata {
             DefaultValue = 0
         });
     });
 }
예제 #8
0
파일: TextBlock.cs 프로젝트: knocte/OmniGUI
        public TextBlock(IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <TextBlock>(() =>
            {
                TextProperty = PropertyEngine.RegisterProperty("Text", typeof(TextBlock), typeof(string), new PropertyMetadata {
                    DefaultValue = null
                });
                FontFamilyProperty = PropertyEngine.RegisterProperty("FontFamily", typeof(TextBlock), typeof(float), new PropertyMetadata {
                    DefaultValue = "Arial"
                });
                FontWeightProperty = PropertyEngine.RegisterProperty("FontWeight", typeof(TextBlock), typeof(float), new PropertyMetadata {
                    DefaultValue = FontWeights.Normal
                });
                FontSizeProperty = PropertyEngine.RegisterProperty("FontSize", typeof(TextBlock), typeof(float), new PropertyMetadata {
                    DefaultValue = 14F
                });
            });

            Foreground = new Brush(Colors.Black);
            GetChangedObservable(TextProperty).Subscribe(t => Text = (string)t);
            NotifyRenderAffectedBy(TextProperty);
        }
예제 #9
0
 public StackPanel(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
 }
예제 #10
0
 public LocationController(IPropertyEngine propertyEngine)
 {
     _propertyEngine = propertyEngine;
 }
예제 #11
0
 public HomeController(ICategoryEngine categoryEngine, IPropertyEngine propertyEngine) : base(categoryEngine)
 {
     _propertyEngine = propertyEngine;
 }
예제 #12
0
파일: List.cs 프로젝트: knocte/OmniGUI
        public List(TemplateInflator controlTemplateInflator, Func <ICollection <ControlTemplate> > getControlTemplates, IPropertyEngine propertyEngine) : base(propertyEngine)
        {
            RegistrationGuard.RegisterFor <List>(() =>
            {
                ItemTemplateProperty = ItemTemplateProperty = PropertyEngine.RegisterProperty("ItemTemplate", typeof(List), typeof(DataTemplate), new PropertyMetadata());
                SourceProperty       = SourceProperty = PropertyEngine.RegisterProperty("Source", typeof(List), typeof(IObservableCollection <object>), new PropertyMetadata());
            });

            this.controlTemplateInflator = controlTemplateInflator;
            this.getControlTemplates     = getControlTemplates;
            panel = new StackPanel(propertyEngine);
            this.AddChild(panel);

            subscription = GetChangedObservable(SourceProperty).Subscribe(obj =>
            {
                var source = (ISourceList <object>)obj;

                Platform.Current.EventSource.Invalidate();

                source.Connect()
                .OnItemAdded(AddItem)
                .ForEachChange(_ => Platform.Current.EventSource.Invalidate())
                .Subscribe();
            });
        }
예제 #13
0
 public AssetController(ICategoryEngine categoryEngine, IPropertyEngine propertyEngine, IPhotoEngine photoEngine)
 {
     _categoryEngine = categoryEngine;
     _propertyEngine = propertyEngine;
     _iphotoEngine   = photoEngine;
 }
예제 #14
0
파일: Border.cs 프로젝트: knocte/OmniGUI
 public Border(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
 }
예제 #15
0
 public StateTrigger(IPropertyEngine propertyEngine)
 {
     this.propertyEngine = propertyEngine;
     IsActiveProperty    = propertyEngine.RegisterProperty("IsActive", typeof(StateTrigger), typeof(bool),
                                                           new PropertyMetadata());
 }
예제 #16
0
 public ContentPresenter(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
 }
예제 #17
0
 public UserController(IUserEngine userEngine, IPropertyEngine proertyEngine)
 {
     _userEngine     = userEngine;
     _propertyEngine = proertyEngine;
 }
예제 #18
0
 public Inflatable(IPropertyEngine propertyEngine) : base(propertyEngine)
 {
     TextProperty = PropertyEngine.RegisterProperty("Text", typeof(Inflatable), typeof(string), new PropertyMetadata());
 }