• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MaskType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MaskType的典型用法代码示例。如果您正苦于以下问题:C# MaskType类的具体用法?C# MaskType怎么用?C# MaskType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MaskType类属于命名空间,在下文中一共展示了MaskType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IsSymbolValid

        private static bool IsSymbolValid(MaskType mask, string str)
        {
            switch (mask)
            {
                case MaskType.Any:
                    return true;

                case MaskType.Integer:
                    if (str == NumberFormatInfo.CurrentInfo.NegativeSign)
                        return true;
                    break;

                case MaskType.Decimal:
                    if (str == NumberFormatInfo.CurrentInfo.NumberDecimalSeparator ||
                        str == NumberFormatInfo.CurrentInfo.NegativeSign)
                        return true;
                    break;
            }

            if (mask.Equals(MaskType.Integer) || mask.Equals(MaskType.Decimal))
            {
                foreach (char ch in str)
                {
                    if (!Char.IsDigit(ch))
                        return false;
                }

                return true;
            }

            return false;
        }
开发者ID:powernick,项目名称:CodeLib,代码行数:32,代码来源:NumberTextBox.cs


示例2: Show

		public void Show (Context context, string status = null, int progress = -1, MaskType maskType = MaskType.Black, TimeSpan? timeout = null, Action clickCallback = null, bool centered = true, Action cancelCallback = null)
		{
			if (progress >= 0)
				showProgress (context, progress, status, maskType, timeout, clickCallback, cancelCallback);
			else
				showStatus (context, true, status, maskType, timeout, clickCallback, centered, cancelCallback);
		}
开发者ID:skela,项目名称:AndHUD,代码行数:7,代码来源:AndHUD.cs


示例3: Progress

		public virtual IProgressDialog Progress(string title, Action onCancel, string cancelText, bool show, MaskType? maskType) {
			return this.Progress(new ProgressDialogConfig {
                Title = title ?? ProgressDialogConfig.DefaultTitle,
                AutoShow = show,
                CancelText = cancelText ?? ProgressDialogConfig.DefaultCancelText,
				MaskType = maskType ?? ProgressDialogConfig.DefaultMaskType,
                IsDeterministic = true,
                OnCancel = onCancel
            });
        }
开发者ID:modulexcite,项目名称:userdialogs,代码行数:10,代码来源:AbstractUserDialogs.cs


示例4: AddMask

        /// <summary>
        /// Adiciona a máscara escolhida.
        /// </summary>
        /// <param name="Type">Tipo de máscara</param>
        /// <param name="Value">Valor que receberá a máscara.</param>
        /// <returns>Retorna o valor com a máscara escolhida aplicada.</returns>
        public static String AddMask(MaskType Type, String Value)
        {
            if (!string.IsNullOrEmpty(Value))
                switch (Type)
                {
                    case MaskType.CPF:
                        if (Value.Length == 11)
                            Value = string.Format("{0}.{1}.{2}-{3}", Value.Substring(0, 3), Value.Substring(3, 3), Value.Substring(6, 3), Value.Substring(9, 2));
                        break;
                    case MaskType.CNPJ:
                        if (Value.Length == 14)
                            Value = string.Format("{0}.{1}.{2}/{3}-{4}", Value.Substring(0, 2), Value.Substring(2, 3), Value.Substring(5, 3), Value.Substring(8, 4), Value.Substring(12, 2));
                        break;
                }

            return Value;
        }
开发者ID:anzolin,项目名称:SBSC,代码行数:23,代码来源:StringHelper.cs


示例5: ApplyMask

        /// <summary>Generates and applies gradient mask to cloned <see cref="System.Drawing.Bitmap"/>.</summary>
        /// <param name="type"><see cref="MaskType"/> specifies which type of mask to generate.</param>
        /// <param name="width">Width or height of gradient rectangle.</param>
        public void ApplyMask(MaskType type, int width = 20)
        {
            // First of all, generating mask
            GenerateMask(type, width);

            // Right after, applying generated mask to bitmap
            for (var x = 0; x < Bitmap.Width; x++) {
                for (var y = 0; y < Bitmap.Height; y++) {

                    // Reading pixels from both, mask and target bitmaps
                    var msk = Mask.GetPixel(x, y);
                    var bmp = Bitmap.GetPixel(x, y);

                    // Calculating alpha-value
                    var alpha = (msk.A * 100) / 255;
                    alpha = (bmp.A * alpha) / 100;
                    alpha = Math.Min(255, Math.Max(0, alpha));

                    // Setting pixel with same colors except alpha
                    Bitmap.SetPixel(x, y, Color.FromArgb(alpha, bmp));

                }
            }
        }
开发者ID:ikenni,项目名称:Layered,代码行数:27,代码来源:Fragment.cs


示例6: ShowProgressWorker

        /*
        void ShowProgressWorker(string cancelCaption, Delegate cancelCallback, float progress = -1, string status = null, MaskType maskType = MaskType.None){
            CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
            CancelHudButton.TouchUpInside += delegate {
                BTProgressHUD.Dismiss();
                if(cancelCallback != null){
                    cancelCallback.DynamicInvoke(null);
                }
            };
            UpdatePosition();
            ShowProgressWorker(progress, status, maskType);
        }
        */
        void ShowProgressWorker(float progress = -1, string status = null, MaskType maskType = MaskType.None, bool textOnly = false, bool showToastCentered = true, string cancelCaption = null, Action cancelCallback = null)
        {
            if (OverlayView.Superview == null)
                UIApplication.SharedApplication.KeyWindow.AddSubview (OverlayView);

            if (Superview == null)
                OverlayView.AddSubview (this);

            _fadeoutTimer = null;
            ImageView.Hidden = true;
            _maskType = maskType;
            _progress = progress;

            StringLabel.Text = status;

            if(!string.IsNullOrEmpty(cancelCaption)){
                CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
                CancelHudButton.TouchUpInside += delegate {
                    BTProgressHUD.Dismiss();
                    if(cancelCallback != null){
                        obj.InvokeOnMainThread (() => cancelCallback.DynamicInvoke(null));
                        //cancelCallback.DynamicInvoke(null);
                    }
                };
            }

            UpdatePosition (textOnly);

            if(progress >= 0)
            {
                ImageView.Image = null;
                ImageView.Hidden = false;
                SpinnerView.StopAnimating();
                RingLayer.StrokeEnd = progress;
            } else if (textOnly)
            {
                CancelRingLayerAnimation();
                SpinnerView.StopAnimating();
            } else
            {
                CancelRingLayerAnimation();
                SpinnerView.StartAnimating();
            }

            if(maskType != MaskType.None) {
                OverlayView.UserInteractionEnabled = true;
                //AccessibilityLabel = status;
                //IsAccessibilityElement = true;
            }
            else {
                OverlayView.UserInteractionEnabled = true;
                //hudView.IsAccessibilityElement = true;
            }

            OverlayView.Hidden = false;
            this.showToastCentered = showToastCentered;
            PositionHUD (null);

            if (Alpha != 1)
            {
                RegisterNotifications ();
                HudView.Transform.Scale (1.3f, 1.3f);

                UIView.Animate (0.15f, 0,
                                UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.BeginFromCurrentState,
                                delegate {
                    HudView.Transform.Scale ((float)1 / 1.3f, (float)1f / 1.3f);
                    Alpha = 1;
                }, delegate {
                    //UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, string);

                    if (textOnly) StartDismissTimer(new TimeSpan(0,0,1));
                });

                SetNeedsDisplay();
            }
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:90,代码来源:BTProgressHUD.cs


示例7: Show

 public static void Show(string status = null, float progress = -1, MaskType maskType = MaskType.None)
 {
     obj.InvokeOnMainThread (() => SharedView.ShowProgressWorker (progress, status, maskType));
 }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:4,代码来源:BTProgressHUD.cs


示例8: ShowToast

		public void ShowToast(Context context, string status, MaskType maskType = MaskType.Black, TimeSpan? timeout = null, bool centered = true, Action clickCallback = null, Action cancelCallback = null)
		{
			showStatus (context, false, status, maskType, timeout, clickCallback, centered, cancelCallback);
		}
开发者ID:skela,项目名称:AndHUD,代码行数:4,代码来源:AndHUD.cs


示例9: ShowImage

		public void ShowImage(Context context, int drawableResourceId, string status = null, MaskType maskType = MaskType.Black, TimeSpan? timeout = null, Action clickCallback = null, Action cancelCallback = null)
		{
			showImage (context, context.Resources.GetDrawable(drawableResourceId), status, maskType, timeout, clickCallback, cancelCallback);
		}
开发者ID:skela,项目名称:AndHUD,代码行数:4,代码来源:AndHUD.cs


示例10: showImage

		void showImage(Context context, Android.Graphics.Drawables.Drawable image, string status = null, MaskType maskType = MaskType.Black, TimeSpan? timeout = null, Action clickCallback = null, Action cancelCallback = null)
		{
			if (timeout == null)
				timeout = TimeSpan.Zero;

			if (CurrentDialog != null && imageView == null)
				DismissCurrent (context);

			lock (dialogLock)
			{
				if (CurrentDialog == null)
				{
					SetupDialog (context, maskType, cancelCallback, (a, d, m) => {
						var inflater = LayoutInflater.FromContext(context);
						var view = inflater.Inflate(Resource.Layout.loadingimage, null);

						if (clickCallback != null)
							view.Click += (sender, e) => clickCallback();

						imageView = view.FindViewById<ImageView>(Resource.Id.loadingImage);
						statusText = view.FindViewById<TextView>(Resource.Id.textViewStatus);

						if (maskType != MaskType.Black)
							view.SetBackgroundResource(Resource.Drawable.roundedbgdark);

						imageView.SetImageDrawable(image);

						if (statusText != null)
						{
							statusText.Text = status ?? "";
							statusText.Visibility = string.IsNullOrEmpty(status) ? ViewStates.Gone : ViewStates.Visible;
						}

						return view;
					});

					if (timeout > TimeSpan.Zero)
					{
						Task.Factory.StartNew(() => {
							if (!waitDismiss.WaitOne (timeout.Value))
								DismissCurrent (context);
			
						}).ContinueWith(ct => {
							var ex = ct.Exception;

							if (ex != null)
								Android.Util.Log.Error("AndHUD", ex.ToString());
						}, TaskContinuationOptions.OnlyOnFaulted);
					}
				}
				else
				{
					Application.SynchronizationContext.Send(state => {
						imageView.SetImageDrawable(image);
						statusText.Text = status ?? "";
					}, null);
				}
			}
		}
开发者ID:skela,项目名称:AndHUD,代码行数:59,代码来源:AndHUD.cs


示例11: SetMask

 /// <summary>
 /// Sets the mask
 /// </summary>
 /// <param name="obj">The object</param>
 /// <param name="value">The value</param>
 public static void SetMask(DependencyObject obj, MaskType value)
 {
     obj.SetValue(MaskProperty, value);
 }
开发者ID:shivercube,项目名称:SumControls,代码行数:9,代码来源:TextBoxMaskBehavior.cs


示例12: ValidateValue

        private static string ValidateValue(MaskType mask, string value, double min, double max)
        {
            if (string.IsNullOrEmpty(value))
                return string.Empty;

            value = value.Trim();
            switch (mask) {
                case MaskType.Integer:
                    try {
                        Convert.ToInt64(value);
                        return value;
                    }
                    catch {
                    }
                    return string.Empty;

                case MaskType.Decimal:
                    try {
                        Convert.ToDouble(value);

                        return value;
                    }
                    catch {
                    }
                    return string.Empty;
            }

            return value;
        }
开发者ID:malcolmcarvalho,项目名称:TrimCurve,代码行数:29,代码来源:TextBoxMaskBehavior.cs


示例13: Toast

 public override void Toast(string message, int timeoutSeconds, Action onClick, MaskType maskType)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(() => {
         var ms = timeoutSeconds * 1000;
         BTProgressHUD.ShowToast(
             message,
             maskType.ToNative(),
             false,
             ms
         );
     });
 }
开发者ID:vvolkgang,项目名称:userdialogs,代码行数:12,代码来源:UserDialogsImpl.cs


示例14: Loading

        async void Loading(MaskType maskType) {
            var cancelSrc = new CancellationTokenSource();

			using (var dlg = UserDialogs.Instance.Loading("Loading", maskType: maskType)) {
                dlg.SetCancel(cancelSrc.Cancel);

                try {
                    await Task.Delay(TimeSpan.FromSeconds(5), cancelSrc.Token);
                }
                catch { }
            }
            this.Result(cancelSrc.IsCancellationRequested ? "Loading Cancelled" : "Loading Complete");
        }
开发者ID:benoitjadinon,项目名称:userdialogs,代码行数:13,代码来源:MainPage.cs


示例15: MaskPara

 /// <summary>
 /// Initialize Mask Parameters
 /// </summary>
 /// <param name="basepara"></param>
 /// <param name="masktype"></param>
 public MaskPara(vsBasePara basepara, MaskType masktype)
 {
     basepara.vstype = VSType.Mask;
     this.BasePara = basepara;
     this.masktype = masktype;
 }
开发者ID:babaq,项目名称:StiLib,代码行数:11,代码来源:VisionStimulus.cs


示例16: ProgressDialogConfig

 static ProgressDialogConfig() {
     DefaultTitle = "Loading";
     DefaultCancelText = "Cancel";
     DefaultMaskType = MaskType.Black;
 }
开发者ID:RTodorov,项目名称:userdialogs,代码行数:5,代码来源:ProgressDialogConfig.cs


示例17: SetMaskType

 public ProgressDialogConfig SetMaskType(MaskType maskType) {
     this.MaskType = maskType;
     return this;
 }
开发者ID:RTodorov,项目名称:userdialogs,代码行数:4,代码来源:ProgressDialogConfig.cs


示例18: ValidateValue

        private static string ValidateValue(MaskType mask, string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return string.Empty;
            }

            value = value.Trim();
            switch (mask)
            {
                case MaskType.Integer:
                    try
                    {
                        Convert.ToInt64(value, CultureInfo.CurrentCulture);
                        return value;
                    }
                    catch (FormatException)
                    {
                        return string.Empty;
                    }
                    catch (OverflowException)
                    {
                        return string.Empty;
                    }

                case MaskType.Decimal:
                    try
                    {
                        Convert.ToDouble(value, CultureInfo.CurrentCulture);

                        return value;
                    }
                    catch (FormatException)
                    {
                        return string.Empty;
                    }
                    catch (OverflowException)
                    {
                        return string.Empty;
                    }
            }

            return value;
        }
开发者ID:shivercube,项目名称:SumControls,代码行数:44,代码来源:TextBoxMaskBehavior.cs


示例19: SetupDialog

		void SetupDialog(Context context, MaskType maskType, Action cancelCallback, Func<Context, Dialog, MaskType, View> customSetup)
		{
			Application.SynchronizationContext.Send(state => {

				CurrentDialog = new Dialog(context);

				CurrentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle);

				if (maskType != MaskType.Black)
					CurrentDialog.Window.ClearFlags(WindowManagerFlags.DimBehind);

				if (maskType == MaskType.None)
					CurrentDialog.Window.SetFlags(WindowManagerFlags.NotTouchModal, WindowManagerFlags.NotTouchModal);

				CurrentDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));

				var customView = customSetup(context, CurrentDialog, maskType);

				CurrentDialog.SetContentView (customView);

				CurrentDialog.SetCancelable (cancelCallback != null);	
				if (cancelCallback != null)
					CurrentDialog.CancelEvent += (sender, e) => cancelCallback();

				CurrentDialog.Show ();

			}, null);
		}
开发者ID:skela,项目名称:AndHUD,代码行数:28,代码来源:AndHUD.cs


示例20: Show

 public void Show(string status = null, float progress = -1, MaskType maskType = MaskType.None, double timeoutMs = 1000)
 {
     obj.InvokeOnMainThread (() => ShowProgressWorker (progress, status, maskType, timeoutMs: timeoutMs));
 }
开发者ID:philippd,项目名称:userdialogs,代码行数:4,代码来源:ProgressHUD.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MaskedTextResultHint类代码示例发布时间:2022-05-24
下一篇:
C# MaskSize类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap