本文整理汇总了C#中ElementChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ElementChangedEventArgs类的具体用法?C# ElementChangedEventArgs怎么用?C# ElementChangedEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ElementChangedEventArgs类属于命名空间,在下文中一共展示了ElementChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnElementChanged
protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
{
base.OnElementChanged (e);
// Retrieve any stored account information
var accounts = AccountStore.Create (Context).FindAccountsForService (App.AppName);
var account = accounts.FirstOrDefault ();
if (account == null) {
if (!isShown) {
isShown = true;
// Initialize the object that communicates with the OAuth service
var auth = new OAuth2Authenticator (
Constants.ClientId,
Constants.ClientSecret,
Constants.Scope,
new Uri (Constants.AuthorizeUrl),
new Uri (Constants.RedirectUrl),
new Uri (Constants.AccessTokenUrl));
// Register an event handler for when the authentication process completes
auth.Completed += OnAuthenticationCompleted;
// Display the UI
var activity = Context as Activity;
activity.StartActivity (auth.GetUI (activity));
}
} else {
if (!isShown) {
App.User.Email = account.Username;
App.SuccessfulLoginAction.Invoke ();
}
}
}
示例2: OnElementChanged
protected async override void OnElementChanged (ElementChangedEventArgs<Button> e)
{
base.OnElementChanged (e);
if (byPassButton == null) {
byPassButton = new UIButton (UIButtonType.Custom);
byPassButton.Frame = this.Frame;
SetNativeControl (byPassButton);
base.Control.TouchUpInside += byPassButton_TouchUpInside;
SetField (this, "buttonTextColorDefaultNormal", base.Control.TitleColor (UIControlState.Normal));
SetField (this, "buttonTextColorDefaultHighlighted", base.Control.TitleColor (UIControlState.Highlighted));
SetField (this, "buttonTextColorDefaultDisabled", base.Control.TitleColor (UIControlState.Disabled));
InvokeMethod (this, "UpdateText", null);
InvokeMethod (this, "UpdateFont", null);
InvokeMethod (this, "UpdateBorder", null);
InvokeMethod (this, "UpdateImage", null);
InvokeMethod (this, "UpdateTextColor", null);
}
if (e.NewElement != null) {
Control.ShowsTouchWhenHighlighted = false;
Control.AdjustsImageWhenHighlighted = false;
await SetNormalImageResource ();
await SetDisableImageResource ();
await SetPressImageResource ();
}
}
示例3: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
{
base.OnElementChanged(e);
CustomTimePicker timePicker = (CustomTimePicker)Element;
if (timePicker != null)
{
SetBorderStyle(timePicker);
SetTextColor(timePicker);
Control.AdjustsFontSizeToFitWidth = true;
}
if (e.OldElement == null)
{
//Wire events
}
if (e.NewElement == null)
{
//Unwire events
}
}
示例4: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
page = new MyThirdNativePage();
this.Children.Add(page);
}
示例5: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
// The first time OnElementPropertyChanged isn't called for Text, so call it by ourselfs
OnElementPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("Text"));
}
示例6: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
if (e.OldElement != null)
{
var nativeMap = Control as MKMapView;
nativeMap.GetViewForAnnotation = null;
nativeMap.CalloutAccessoryControlTapped -= OnCalloutAccessoryControlTapped;
nativeMap.DidSelectAnnotationView -= OnDidSelectAnnotationView;
nativeMap.DidDeselectAnnotationView -= OnDidDeselectAnnotationView;
}
if (e.NewElement != null)
{
var formsMap = (CustomMap)e.NewElement;
var nativeMap = Control as MKMapView;
customPins = formsMap.CustomPins;
nativeMap.GetViewForAnnotation = GetViewForAnnotation;
nativeMap.CalloutAccessoryControlTapped += OnCalloutAccessoryControlTapped;
nativeMap.DidSelectAnnotationView += OnDidSelectAnnotationView;
nativeMap.DidDeselectAnnotationView += OnDidDeselectAnnotationView;
}
}
示例7: OnElementChanged
/// <summary>
/// Raises the element changed event.
/// </summary>
/// <param name="e">E.</param>
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Label> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
UpdateFont();
}
示例8: OnElementChanged
protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
{
base.OnElementChanged (e);
if (e.OldElement != null || Element == null)
return;
try {
activity = this.Context as Activity;
view = activity.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false);
cameraType = CameraFacing.Back;
textureView = view.FindViewById<TextureView> (Resource.Id.textureView);
textureView.SurfaceTextureListener = this;
takePhotoButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.takePhotoButton);
takePhotoButton.Click += TakePhotoButtonTapped;
switchCameraButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.switchCameraButton);
switchCameraButton.Click += SwitchCameraButtonTapped;
toggleFlashButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.toggleFlashButton);
toggleFlashButton.Click += ToggleFlashButtonTapped;
AddView (view);
} catch (Exception ex) {
//Xamarin.Insights.Report (ex);
}
}
示例9: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
var s = e.NewElement.Source as FileImageSource;
if (s != null)
{
var fileName = s.File;
string ci = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
if (ci == "pt-BR") {
// use the complete string 'as is'
} else if (ci == "zh-CN") {
ci = "zh-Hans"; // we could have named the image directories differently, but this keeps them consisent with RESX naming
} else if (ci == "zh-TW" || ci == "zh-HK") {
ci = "zh-Hant";
} else {
// for all others, just use the two-character language code
ci = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
}
e.NewElement.Source = Path.Combine("Assets/" + ci + "/" + fileName);
}
}
}
示例10: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Frame> e)
{
base.OnElementChanged(e);
if (Element == null)
return;
player = new MediaElement();
player.AutoPlay = true;
player.MediaOpened += (sender, args) =>
{
timer.Start();
};
this.Control.Child = player;
timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) };
timer.Tick += timer_Tick;
if (string.IsNullOrWhiteSpace(Player.Url))
return;
InitPlayer();
}
示例11: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged(e);
if (Control != null)
{
var button = (CustomButton)e.NewElement;
button.SizeChanged += (s, args) =>
{
// Estado normal
_normal = new GradientDrawable();
_normal.SetColor(Android.Graphics.Color.DarkBlue);
_normal.SetCornerRadius(100);
// Estado pulsado
_pressed = new GradientDrawable();
_pressed.SetColor(Android.Graphics.Color.DarkCyan);
_pressed.SetCornerRadius(100);
var sld = new StateListDrawable();
sld.AddState(new int[] { Android.Resource.Attribute.StatePressed }, _pressed);
sld.AddState(new int[] { }, _normal);
Control.SetBackgroundDrawable(sld);
Control.SetTextSize(ComplexUnitType.Px, 60);
Control.SetTextColor(Android.Graphics.Color.Silver);
};
}
}
示例12: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
{
winButton = Control;
formsElement = (CustomImageButton)this.Element;
if( formsElement.TextOrientation == TextOrientation.Left )
{
winButton.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
}
else if (formsElement.TextOrientation == TextOrientation.Middle)
{
winButton.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
}
else
{
winButton.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
}
formsElement.BorderColor = Xamarin.Forms.Color.Transparent;
formsElement.BorderWidth = 0;
if (formsElement.ImageName != null )
winButton.Background = new ImageBrush { Stretch = System.Windows.Media.Stretch.Fill, ImageSource = new BitmapImage(new Uri(formsElement.ImageName, UriKind.Relative)) };
}
}
示例13: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
var app = (MixRadioActivity.App.Current as MixRadioActivity.App);
WebAuthenticationBroker.AuthenticateAndContinue(app.ActivityViewModel.GetAuthUri(), new Uri(ApiKeys.OAuthRedirectUrl));
}
示例14: OnElementChanged
/// <inheritdoc/>
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
if (e.OldElement != null || this.FormsMap == null || this.Map == null) return;
this.Map.GetViewForAnnotation = this.GetViewForAnnotation;
this.Map.OverlayRenderer = this.GetOverlayRenderer;
this.Map.DidSelectAnnotationView += OnDidSelectAnnotationView;
this.Map.RegionChanged += OnMapRegionChanged;
this.Map.ChangedDragState += OnChangedDragState;
this.Map.CalloutAccessoryControlTapped += OnMapCalloutAccessoryControlTapped;
this.Map.AddGestureRecognizer(new UILongPressGestureRecognizer(this.OnMapLongPress));
this.Map.AddGestureRecognizer(new UITapGestureRecognizer(this.OnMapClicked));
if (this.FormsMap.CustomPins != null)
{
this.UpdatePins();
this.FormsMap.CustomPins.CollectionChanged += OnCollectionChanged;
}
this.SetMapCenter();
this.UpdateRoutes();
this.UpdateLines();
this.UpdateCircles();
this.UpdatePolygons();
this.FormsMap.PropertyChanged += OnMapPropertyChanged;
}
示例15: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
base.OnElementChanged(e);
UITextView textView = (UITextView)Control;
//Color
textView.BackgroundColor = UIColor.White;
textView.TextColor = UIColor.Gray;
//font
//textField.Font = UIFont.FromName("Ubuntu-light", 13);
replacingControl = new UITextView(Control.Bounds);
var adelegate = new CustomTextViewDelegate();
var element = this.Element as PurposeColor.CustomControls.CustomEditor;
adelegate.Placeholder = element.Placeholder;
adelegate.formsEditor = element;
replacingControl.Delegate = adelegate;
replacingControl.TextColor = UIColor.LightGray;
replacingControl.Text = adelegate.Placeholder;
this.SetNativeControl(replacingControl);
}//OnElementChanged()