当前位置: 首页>>代码示例>>C#>>正文


C# ElementChangedEventArgs类代码示例

本文整理汇总了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 ();
				}
			}
		}
开发者ID:kevincwq,项目名称:XamarinLearn,代码行数:35,代码来源:AuthenticationPageRenderer.cs

示例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 ();
			}
		}
开发者ID:AlejandroRuiz,项目名称:FloatingTextEntry,代码行数:29,代码来源:StatesButtonRenderer.cs

示例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
			}
		}
开发者ID:todibbang,项目名称:HowlOutApp,代码行数:25,代码来源:CustomTimePickerRenderer.cs

示例4: OnElementChanged

        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            page = new MyThirdNativePage();
            this.Children.Add(page);
        }
开发者ID:berlamont,项目名称:xamarin-forms-samples,代码行数:7,代码来源:MyThirdPageRenderer.cs

示例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"));
		}
开发者ID:Surfoo,项目名称:WF.Player,代码行数:7,代码来源:ExtendedLabelRenderer.cs

示例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;
			}
		}
开发者ID:berlamont,项目名称:xamarin-forms-samples,代码行数:25,代码来源:CustomMapRenderer.cs

示例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();
        }
开发者ID:patridge,项目名称:NControl.Controls,代码行数:11,代码来源:FontAwareLabelRenderer.cs

示例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);
			}
		}
开发者ID:santiagohdzb,项目名称:FormsDemo,代码行数:29,代码来源:CameraPage.cs

示例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);
                }
            }
        }
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:25,代码来源:LocalizedImageRenderer.cs

示例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();
      
    }
开发者ID:Adam--,项目名称:Hanselman.Forms,代码行数:25,代码来源:AudioPlayerRenderer.cs

示例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);
                };
            }
        }
开发者ID:JCQuiroga,项目名称:EjemploCustomControls,代码行数:28,代码来源:AndroidButton.cs

示例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)) };

      
               
            }
        }
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:32,代码来源:WinImageButtonRenderer.cs

示例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));
		}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:7,代码来源:LoginPageRenderer.cs

示例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;
        }
开发者ID:se7ensoft,项目名称:TK.CustomMap,代码行数:29,代码来源:TKCustomMapRenderer.cs

示例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()
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:29,代码来源:CustomEditorRenderer.cs


注:本文中的ElementChangedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。