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

C# Constants类代码示例

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

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



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

示例1: CostForLineSwitch

        internal double CostForLineSwitch(ILine from,
                                          Constants.LineDirection fromDirection,
                                          ILine to,
                                          Constants.LineDirection toDirection)
        {
            double cost = double.MaxValue;

            if ( fromDirection == Constants.LineDirection.Forward &&
                 toDirection == Constants.LineDirection.Forward )
            {
                cost = from.EndPoint.DistanceTo(to.StartPoint);
            }
            else if ( fromDirection == Constants.LineDirection.Forward &&
                      toDirection == Constants.LineDirection.Reverse )
            {
                cost = from.EndPoint.DistanceTo(to.EndPoint);
            }
            else if ( fromDirection == Constants.LineDirection.Reverse &&
                      toDirection == Constants.LineDirection.Forward )
            {
                cost = from.StartPoint.DistanceTo(to.StartPoint);
            }
            else if ( fromDirection == Constants.LineDirection.Reverse &&
                      toDirection == Constants.LineDirection.Reverse )
            {
                cost = from.StartPoint.DistanceTo(to.EndPoint);
            }

            return cost;
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:30,代码来源:CostForLineSwitchCalculator.cs


示例2: QrResultModel

 public QrResultModel(Constants.ResultTypes resultType)
 {
     using (ResultsService service = new ResultsService())
     {
         Result = service.GetResultText(resultType);
     }
 }
开发者ID:surgerer,项目名称:QrTrack,代码行数:7,代码来源:QrResultModel.cs


示例3: MovePacket

        public MovePacket(Objects.Client c, Constants.Direction direction)
            : base(c)
        {
            Direction = direction;

            switch (direction)
            {
                case Tibia.Constants.Direction.Down:
                    Type = OutgoingPacketType.MoveDown;
                    break;
                case Tibia.Constants.Direction.Up:
                    Type = OutgoingPacketType.MoveUp;
                    break;
                case Tibia.Constants.Direction.Right:
                    Type = OutgoingPacketType.MoveRight;
                    break;
                case Tibia.Constants.Direction.Left:
                    Type = OutgoingPacketType.MoveLeft;
                    break;
                case Tibia.Constants.Direction.DownLeft:
                    Type = OutgoingPacketType.MoveDownLeft;
                    break;
                case Tibia.Constants.Direction.DownRight:
                    Type = OutgoingPacketType.MoveDownRight;
                    break;
                case Tibia.Constants.Direction.UpLeft:
                    Type = OutgoingPacketType.MoveUpLeft;
                    break;
                case Tibia.Constants.Direction.UpRight:
                    Type = OutgoingPacketType.MoveUpRight;
                    break;
            }

            Destination = PacketDestination.Server;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:35,代码来源:MovePacket.cs


示例4: ThenTheFieldShouldBeHiglightedIn

        public void ThenTheFieldShouldBeHiglightedIn(Constants.LoginFields fieldName, Constants.Colour colour)
        {
            var expectedRgbaColour = Utilities.GetRgbaColour(colour);
            Assert.NotNull(expectedRgbaColour);

            string actualColour;
            switch (fieldName)
            {
                case Constants.LoginFields.Email:
                {
                    actualColour = LoginPage.EmailValidationColor;
                }
                    break;
                case Constants.LoginFields.Password:
                {
                    actualColour = LoginPage.PasswordValidationColor;
                }
                    break;
                default:
                {
                    throw new AssertionException("No field name defined in test framework");
                }
            }
            Assert.NotNull(expectedRgbaColour);

            Assert.AreEqual(expectedRgbaColour, actualColour);
        }
开发者ID:rohanbaraskar,项目名称:SeleniumAutomationFramework,代码行数:27,代码来源:LoginStepDefinition.cs


示例5: GameOptions

 public GameOptions(string TeamOneName, string TeamTwoName, Constants.GameTypeEnumeration GameType, ushort GameLimit)
 {
     this.teamOneNameField = TeamOneName;
     this.teamTwoNameField = TeamTwoName;
     this.gameLimitField = GameLimit;
     this.gameTypeField = GameType;
 }
开发者ID:kensniper,项目名称:castle-butcher,代码行数:7,代码来源:GameOptions.cs


示例6: ThenIShouldBeOnTheInsightPage

        public void ThenIShouldBeOnTheInsightPage(Constants.Page pageType)
        {
            string expectedPageTitle;

            switch (pageType)
            {
                case Constants.Page.Main:
                {
                    expectedPageTitle = Constants.PageTitle.Main;
                }
                    break;
                case Constants.Page.Login:
                {
                    expectedPageTitle = Constants.PageTitle.Login;
                }
                    break;
                case Constants.Page.ForgotPassword:
                {
                    expectedPageTitle = Constants.PageTitle.ForgotPassword;
                }
                    break;

                default:
                {
                    throw new AssertionException(pageType + " not defined in the test framework!");
                }
            }

            Assert.IsTrue(BasePage.GetCurrentPageTitle().StartsWith(expectedPageTitle), "Page title not as expected.");
        }
开发者ID:rohanbaraskar,项目名称:SeleniumAutomationFramework,代码行数:30,代码来源:CommonStepDefinition.cs


示例7: FnMatch

        private static bool FnMatch(string pattern, string path, Constants flags)
        {
            if (pattern.Length == 0)
            {
                return path.Length == 0;
            }

            var pathName = ((flags & Constants.PathName) != 0);
            var noEscape = ((flags & Constants.NoEscape) != 0);
            var regexPattern = PatternToRegex(pattern, pathName, noEscape);
            if (regexPattern.Length == 0)
            {
                return false;
            }

            if (((flags & Constants.DotMatch) == 0) && path.Length > 0 && path[0] == '.')
            {
                // Starting dot requires an explicit dot in the pattern
                if (regexPattern.Length < 4 || regexPattern[2] != '[' || regexPattern[3] != '.')
                {
                    return false;
                }
            }

            var options = RegexOptions.None;
            if ((flags & Constants.IgnoreCase) != 0)
            {
                options |= RegexOptions.IgnoreCase;
            }
            var match = Regex.Match(path, regexPattern, options);
            return match != null && match.Success && (match.Length == path.Length);
        }
开发者ID:MicroHealthLLC,项目名称:mCleaner,代码行数:32,代码来源:Glob.cs


示例8: AssertLine

 private static void AssertLine(ILine actual,
                                int expectedId,
                                double expectedX1,
                                double expectedY1,
                                double expectedX2,
                                double expectedY2,
                                bool isUnknown,
                                Constants.LineDirection direction)
 {
     Assert.AreEqual(expectedId,
                     actual.Id,
                     "Id");
     Assert.AreEqual(expectedX1,
                     actual.X1,
                     "X1");
     Assert.AreEqual(expectedY1,
                     actual.Y1,
                     "Y1");
     Assert.AreEqual(expectedX2,
                     actual.X2,
                     "X2");
     Assert.AreEqual(expectedY2,
                     actual.Y2,
                     "Y2");
     Assert.AreEqual(isUnknown,
                     actual.IsUnknown,
                     "IsUnknown");
     Assert.AreEqual(direction,
                     actual.RunDirection,
                     "RunDirection");
 }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:31,代码来源:TestLinesDtoToLinesConverterTests.cs


示例9: FloatingText

        public FloatingText(String text, Constants.FloatingTextType type, Vector2 position)
        {
            this.text = text;
            this.type = type;
            this.position = position;

            if (type == Constants.FloatingTextType.Emphasised)
            {
                velocity = Vector2.Zero;
                textColor = Color.White;

                scale = 1.3f;
            }
            else
            {
                int r = rand.Next(0, 100);

                if (r <= 50)
                {
                    velocity = new Vector2(2, -5);
                    acceleration = new Vector2(0.125f, 0.175f);
                }
                else
                {
                    velocity = new Vector2(-2, -5);
                    acceleration = new Vector2(-0.125f, 0.175f);
                }
            }
        }
开发者ID:Raunio,项目名称:Bearventure,代码行数:29,代码来源:FloatingText.cs


示例10: Log

 public static void Log(Constants.Log importance, string message)
 {
     #if !DEBUG
     if (importance==Constants.Log.Verbose) return;
     #endif
     CKernel.NewLogMessage(importance,CKernel.Globalization[message]);
 }
开发者ID:sonicwang1989,项目名称:lphant,代码行数:7,代码来源:Log.cs


示例11: Log

        public void Log(Constants.Level level, string loggerName, string message)
        {
            ILog log = LogManager.GetLogger(loggerName);

            switch (level)
            {
                case Constants.Level.TRACE:
                    log.Trace(message);
                    break;

                case Constants.Level.DEBUG:
                    log.Debug(message);
                    break;

                case Constants.Level.INFO:
                    log.Info(message);
                    break;

                case Constants.Level.WARN:
                    log.Warn(message);
                    break;

                case Constants.Level.ERROR:
                    log.Error(message);
                    break;

                case Constants.Level.FATAL:
                    log.Fatal(message);
                    break;

                default:
                    throw new Exception(string.Format("Logger.Log - unknown level={0}", level));
            }
        }
开发者ID:jltrem,项目名称:jsnlog,代码行数:34,代码来源:Logger.cs


示例12: ThenIShouldSeeAListOfAnalysisWithStarting

        public void ThenIShouldSeeAListOfAnalysisWithStarting(Constants.SearchResultColoumnName coloumnName, string searchFilterText)
        {
            BasePage.WaitForAjax(10, true);

            switch (coloumnName)
            {
                case Constants.SearchResultColoumnName.Id:
                    {
                        Assert.IsTrue(CreateComparisonPage.IsAnalysisIdStartsWith(searchFilterText),
                            "All analysis Id on list does not begin with " + searchFilterText);
                    }
                    break;
                case Constants.SearchResultColoumnName.Name:
                    {

                        Assert.IsTrue(CreateComparisonPage.IsAnalysisNameStartsWith(searchFilterText),
                            "All analysis Name on list does not begin with " + searchFilterText);
                    }
                    break;
                case Constants.SearchResultColoumnName.Definition:
                    {
                        Assert.IsTrue(CreateComparisonPage.IsAnalysisDefinitionStartsWith(searchFilterText),
                            "All analysis Definition on list does not begin with " + searchFilterText);
                    }
                    break;
                default:
                    {
                        throw new AssertionException("Field not defined in test framework.");
                    }
            }
        }
开发者ID:rohanbaraskar,项目名称:SeleniumAutomationFramework,代码行数:31,代码来源:SearchFilterStepDefinition.cs


示例13: TestEvent

        public TestEvent(Constants.Event eventType, Constants.Phase phase, Constants.SubPhase subphase, string notes)
        {
            this.EventType = eventType;
            this.Phase = phase;
            this.SubPhase = subphase;
            this.Notes = notes;
            this.Time = DateTime.Now;
            this.X = -1;
            this.Y = -1;
            this.Alt = false;
            this.Ctrl = false;
            this.Shift = false;
            this.TargetString = string.Empty;
            switch(this.SubPhase)
            {
                case Constants.SubPhase.FreePractice:
                    this.subphaseRepetitionNumber = Session.Instance.TimesInFreePractice;
                    break;

                case Constants.SubPhase.ForcedPractice:
                    this.subphaseRepetitionNumber = Session.Instance.TimesInForcedPractice;
                    break;

                case Constants.SubPhase.Verify:
                    this.subphaseRepetitionNumber = Session.Instance.TimesInVerify;
                    break;

                default:
                    this.subphaseRepetitionNumber = 0;
                    break;
            }
        }
开发者ID:kkgreene,项目名称:NistTypingTester,代码行数:32,代码来源:TestEvent.cs


示例14: Connect

        public void Connect(string username, string password, Constants.Server.Region region)
        {
            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password) || region == Constants.Server.Region.UNK)
                throw new ArgumentException("Username, password or region is emtpy");

            var address = _serverAddresses.Single(o => o.Key == region).Value;

            XMPPClient.UserName = username;
            XMPPClient.Password = _passPrefix + password;
            XMPPClient.Server = address;
            XMPPClient.Domain = _domain;
            XMPPClient.Resource = "xiff";
            XMPPClient.Port = 5223;

            XMPPClient.UseTLS = true;

            XMPPClient.UseOldStyleTLS = true;

            XMPPClient.AutoAcceptPresenceSubscribe = false;
            XMPPClient.AutomaticallyDownloadAvatars = false;
            XMPPClient.RetrieveRoster = true;

            XMPPClient.OnStateChanged += XMPPClient_OnStateChanged;
            XMPPClient.OnRetrievedRoster += XMPPClient_OnRetrievedRoster;
            XMPPClient.OnNewConversationItem += XMPPClient_OnNewConversationItem;
            XMPPClient.Connect();
        }
开发者ID:nagysa1313,项目名称:pvpnetwpchat,代码行数:27,代码来源:Client.cs


示例15: Get

        public HttpResponseMessageWrapper<Constants> Get(HttpRequestMessage req)
        {
            // no need to authenticate
            //HttpStatusCode code = ResourceHelper.AuthenticateUser(req, TaskStore);
            //if (code != HttpStatusCode.OK)
            //    return new HttpResponseMessageWrapper<Constants>(req, code);  // user not authenticated

            TaskStore taskstore = TaskStore;

            try
            {
                var actions = taskstore.Actions.OrderBy(a => a.SortOrder).ToList<TaskStoreServerEntities.Action>();
                var colors = taskstore.Colors.OrderBy(c => c.ColorID).ToList<Color>();
                var fieldTypes = taskstore.FieldTypes.OrderBy(ft => ft.FieldTypeID).ToList<FieldType>();
                var listTypes = taskstore.ListTypes.Where(l => l.UserID == null).Include("Fields").ToList<ListType>();  // get the built-in listtypes
                var priorities = taskstore.Priorities.OrderBy(p => p.PriorityID).ToList<Priority>();
                var constants = new Constants() { Actions = actions, Colors = colors, FieldTypes = fieldTypes, ListTypes = listTypes, Priorities = priorities };
                return new HttpResponseMessageWrapper<Constants>(req, constants, HttpStatusCode.OK);
            }
            catch (Exception)
            {
                // constants not found - return 404 Not Found
                return new HttpResponseMessageWrapper<Constants>(req, HttpStatusCode.NotFound);
            }
        }
开发者ID:ogazitt,项目名称:TaskStore,代码行数:25,代码来源:ConstantsResource.cs


示例16: Sprite

 public Sprite(Texture2D texture, Vector2 position, Constants.ViewLayer layer, SpriteFraming framing)
     : base(position, framing.FrameRectangle.Width, framing.FrameRectangle.Height, layer, true)
 {
     Texture = texture;
     Framing = framing;
     Framing.SpriteForFraming = this;
 }
开发者ID:fordream,项目名称:Sunfish,代码行数:7,代码来源:Sprite.cs


示例17: CreatePolylineSegmentFromDto

        internal IPolylineSegment CreatePolylineSegmentFromDto(SegmentDto segment,
                                                               Constants.CircleOrigin origin)
        {
            IPolylineSegment polylineSegment;

            var dto = segment as ArcSegmentDto;
            if ( dto != null )
            {
                polylineSegment = CreateTurnCircleArcSegment(dto,
                                                             origin);
            }
            else
            {
                var segmentDto = segment as LineSegmentDto;
                if ( segmentDto != null )
                {
                    polylineSegment = CreateLineFromLineDto(segmentDto);
                }
                else
                {
                    throw new ArgumentException(
                        "Unknown polyline segment {0}!".Inject(segment.GetType().FullName));
                }
            }

            return polylineSegment;
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:27,代码来源:PathDtoToPath.cs


示例18: LoadPageView

 public void LoadPageView(Constants.PageViewID PageViewID)
 {
     switch (PageViewID)
     {
         case Constants.PageViewID.HomePageView:
             this.mainWindow.Content = this.homePageView;
             break;
         case Constants.PageViewID.SearchPageView:
             this.mainWindow.Content = this.searchPageView;
             NIKernel.Instance.SearchPageView.ShowTopTextBox.Text = Properties.Settings.Default.SearchShowTopValue;
             break;
         case Constants.PageViewID.HelpPageView:
             this.mainWindow.Content = this.helpPageView;
             break;
         case Constants.PageViewID.SettingsPageView:
             this.mainWindow.Content = this.settingsPageView;
             break;
         case Constants.PageViewID.MapViewPage:
             this.mainWindow.Content = this.mapPageView;
             break;
         default:
             this.mainWindow.Content = this.homePageView;
             break;
     }
 }
开发者ID:KyleBerryCS,项目名称:Portfolio,代码行数:25,代码来源:NIKernel.cs


示例19: CreateStone

    public static GameObject CreateStone(Constants.StoneColor color, Vector3 position)
    {
        GameObject stone = safeInitialize(Constants.StonePrefabName, position);
        stone.GetComponent<StoneView> ().StoneColor = color;

        return stone;
    }
开发者ID:projektorkraft,项目名称:PiGo,代码行数:7,代码来源:GameObjectManager.cs


示例20: TurnPacket

        public TurnPacket(Objects.Client c, Constants.Direction direction)
            : base(c)
        {
            Direction = direction;

            switch (direction)
            {
                case Tibia.Constants.Direction.Down:
                    Type = OutgoingPacketType.TurnDown;
                    break;
                case Tibia.Constants.Direction.Up:
                    Type = OutgoingPacketType.TurnUp;
                    break;
                case Tibia.Constants.Direction.Right:
                    Type = OutgoingPacketType.TurnRight;
                    break;
                case Tibia.Constants.Direction.Left:
                    Type = OutgoingPacketType.TurnLeft;
                    break;
                default:
                    throw new ArgumentOutOfRangeException(
                        "direction",
                        "Valid directions for turning are Up, Right, Down, and Left.");
            }

            Destination = PacketDestination.Server;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:27,代码来源:TurnPacket.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Constraint类代码示例发布时间:2022-05-24
下一篇:
C# ConstantValue类代码示例发布时间: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