Пример #1
0
        protected override void OnUpdate()
        {
            if (NativeControl.Text != Text)
            {
                NativeControl.Text = Text;
            }
            NativeControl.Keyboard            = Keyboard;
            NativeControl.IsSpellCheckEnabled = IsSpellCheckEnabled;
            NativeControl.MaxLength           = MaxLength;
            NativeControl.IsReadOnly          = IsReadOnly;
            NativeControl.Placeholder         = Placeholder;
            NativeControl.PlaceholderColor    = PlaceholderColor;
            NativeControl.TextColor           = TextColor;
            NativeControl.CharacterSpacing    = CharacterSpacing;

            if (IsFocused)
            {
                NativeControl.Focus();
            }

            if (TextChangedAction != null)
            {
                NativeControl.TextChanged += NativeControl_TextChanged;
            }
            if (AfterTextChangedAction != null)
            {
                NativeControl.Unfocused += NativeControl_Unfocused;
            }

            base.OnUpdate();
        }
Пример #2
0
 public static NativeControl Instance()
 {
     if (nativeControl == null)
     {
         nativeControl = new NativeControl();
     }
     return(nativeControl);
 }
        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == OxyPlotView.BackgroundColorProperty.PropertyName)
            {
                NativeControl.SetBackgroundColor(NativeElement.BackgroundColor.ToAndroid());
            }
        }
Пример #4
0
        public async Task GoTo(XF.ShellNavigationState state, bool animate = true)
        {
            if (state is null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            await NativeControl.GoToAsync(state, animate).ConfigureAwait(true);
        }
    private void ControlsHandleCreated(object sender, EventArgs e)
    {
        Control       control = sender as Control;
        NativeControl nc;

        if (!controls.TryGetValue(control, out nc))
        {
            nc = new NativeControl(this);
            controls[control] = nc;
        }
        nc.AssignHandle(control.Handle);
    }
Пример #6
0
        protected override void OnRemoveChild(VisualNode widget, BindableObject nativeControl)
        {
            if (nativeControl is TableSection section)
            {
                NativeControl.Remove(section);
            }
            else
            {
                throw new InvalidOperationException($"Type '{nativeControl.GetType()}' not supported under '{GetType()}'");
            }

            base.OnRemoveChild(widget, nativeControl);
        }
    /// <summary>
    /// If location service is not enable, location service screen shows.
    /// This method is responsible for location service sceen visibility.
    /// </summary>
    /// <param name="_status">Status.</param>
    public void LocationServiceScreenStatus(string _status)
    {
        switch (_status)
        {
        case "start":
            NativeControl.Instance().ShowToast("GPS Start", ToastLenght.LENGTH_LONG);
            break;

        case "stop":
            NativeControl.Instance().CheckLocationService();
            break;
        }
    }
Пример #8
0
        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == BoxView.ColorProperty.PropertyName)
            {
                NativeControl.SetBackgroundColor(NativeElement.BackgroundColor.ToAndroid());
                Insights.Track("BACKGROUND-Android");
            }
            if (e.PropertyName == OxyPlotView.ModelProperty.PropertyName)
            {
                NativeControl.Model.InvalidatePlot(true);
                NativeControl.InvalidatePlot(true);
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            var plotView = new PlotView(Context);

            NativeElement.OnInvalidateDisplay = (s, ea) => {
                plotView.Invalidate();
            };

            SetNativeControl(plotView);

            NativeControl.Model = NativeElement.Model;

            NativeControl.SetBackgroundColor(NativeElement.BackgroundColor.ToAndroid());
        }
Пример #10
0
        protected override void OnUpdate()
        {
            NativeControl.BackgroundImageSource = BackgroundImageSource;
            NativeControl.IsBusy          = IsBusy;
            NativeControl.Padding         = Padding;
            NativeControl.Title           = Title;
            NativeControl.IconImageSource = IconImageSource;

            NativeControl.SetValue(Shell.BackButtonBehaviorProperty, new BackButtonBehavior()
            {
                IsEnabled = IsBackButtonEnabled,
                Command   = BackButtonCommand
            });

            base.OnUpdate();
        }
Пример #11
0
        protected override void OnUpdate()
        {
            NativeControl.HasRenderLoop     = HasRenderLoop;
            NativeControl.EnableTouchEvents = EnableTouchEvents;

            if (PaintSurfaceAction != null)
            {
                NativeControl.PaintSurface += NativeControl_PaintSurface;
                NativeControl.InvalidateSurface();
            }
            if (TouchAction != null)
            {
                NativeControl.Touch += NativeControl_Touch;
            }

            base.OnUpdate();
        }
Пример #12
0
        protected override void OnUpdate()
        {
            NativeControl.IgnorePixelScaling = IgnorePixelScaling;
            NativeControl.EnableTouchEvents  = EnableTouchEvents;

            if (PaintSurfaceAction != null)
            {
                NativeControl.PaintSurface += NativeControl_PaintSurface;
                NativeControl.InvalidateSurface();
            }
            if (TouchAction != null)
            {
                NativeControl.Touch += NativeControl_Touch;
            }

            base.OnUpdate();
        }
 public void ShowToast()
 {
     NativeControl.Instance().ShowToast("Hello, Great Work!!!", ToastLenght.LENGTH_LONG);
 }
    public void SaveToGallery()
    {
        Texture2D image = (Texture2D)preview.texture;

        NativeControl.Instance().SaveImageToGallery(image, SaveImageLocation);
    }
 public void StartGPS()
 {
     NativeControl.Instance().StartGPS();
 }
 // Start is called before the first frame update
 void Start()
 {
     NativeControl.Instance();
 }
Пример #17
0
 public MainWindow()
 {
     InitializeComponent();
     _nativeControl = new NativeControl();
     this.Loaded += this.OnLoaded;
 }