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

C# Shared类代码示例

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

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



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

示例1:

        void IUIWidget.OnOperationChange(Shared.Core.Operation operation)
        {
            string lineOne = null;
            if (!string.IsNullOrWhiteSpace(_expressionLineOne))
            {
                lineOne = operation != null ? operation.ToString(_expressionLineOne) : "(n/A)";
            }
            string lineTwo = null;
            if (!string.IsNullOrWhiteSpace(_expressionLineTwo))
            {
                lineTwo = operation != null ? operation.ToString(_expressionLineTwo) : "(n/A)";
            }
            string lineThree = null;
            if (!string.IsNullOrWhiteSpace(_expressionLineThree))
            {
                lineThree = operation != null ? operation.ToString(_expressionLineThree) : "(n/A)";
            }
            LineOne.Inlines.Clear();
            LineTwo.Inlines.Clear();
            LineThree.Inlines.Clear();

            LineOne.Inlines.Add(Helper.Execute(lineOne));
            LineTwo.Inlines.Add(Helper.Execute(lineTwo));
            LineThree.Inlines.Add(Helper.Execute(lineThree));
        }
开发者ID:Bolde,项目名称:AlarmWorkflow,代码行数:25,代码来源:OperationWidget.xaml.cs


示例2: Broadcast

 public void Broadcast(Shared.InamStream stream, byte type)
 {
     foreach (IEntity entity in this.Senses[type])
     {
         entity.EventManager.Enqueue(stream);
     }
 }
开发者ID:milesgray,项目名称:resatiate,代码行数:7,代码来源:ListenerManager.cs


示例3: triggerInternal

 protected override void triggerInternal(Shared lastState, Shared currentState)
 {
     if (CommonData.isRaceStarted)
     {
         if (pushDataInFront == null || pushDataBehind == null)
         {
             clearState();
         }
         if (CommonData.isNewLap)
         {
             if (CommonData.racingSameCarInFront)
             {
                 pushDataInFront.Add(new PushData(currentState.LapTimePrevious, currentState.TimeDeltaFront));
             }
             else
             {
                 pushDataInFront.Clear();
             }
             if (CommonData.racingSameCarBehind)
             {
                 pushDataBehind.Add(new PushData(currentState.LapTimePrevious, currentState.TimeDeltaBehind));
             }
             else
             {
                 pushDataBehind.Clear();
             }
         }
         if (currentState.NumberOfLaps == -1 && !playedNearEndTimePush &&
                 currentState.SessionTimeRemaining < 4 * 60 && currentState.SessionTimeRemaining > 2 * 60)
         {
             // estimate the number of remaining laps - be optimistic...
             int numLapsLeft = (int)Math.Ceiling((double)currentState.SessionTimeRemaining / (double)currentState.LapTimeBest);
             playedNearEndTimePush = checkGaps(currentState, numLapsLeft);
         }
         else if (currentState.NumberOfLaps > 0 && currentState.NumberOfLaps - currentState.CompletedLaps <= 4 &&
             !playedNearEndLapsPush)
         {
             playedNearEndLapsPush = checkGaps(currentState, currentState.NumberOfLaps - currentState.CompletedLaps);
         }
         else if (currentState.PitWindowStatus == (int)Constant.PitWindow.Completed && lastState.PitWindowStatus == (int)Constant.PitWindow.StopInProgress)
         {
             drivingOutOfPits = true;
         }
         else if (drivingOutOfPits && currentState.ControlType == (int)Constant.Control.Player && lastState.ControlType == (int)Constant.Control.AI)
         {
             drivingOutOfPits = false;
             // we've just been handed control back after a pitstop
             if (currentState.TimeDeltaFront > 3 && currentState.TimeDeltaBehind > 4)
             {
                 // we've exited into clean air
                 audioPlayer.queueClip(folderPushExitingPits, 0, this);
             }
             else if (currentState.TimeDeltaBehind <= 4)
             {
                 // we've exited the pits but there's traffic behind
                 audioPlayer.queueClip(folderTrafficBehindExitingPits, 0, this);
             }
         }
     }
 }
开发者ID:mrbelowski,项目名称:r3e_crewchief,代码行数:60,代码来源:PushNow.cs


示例4: AuthenticateUser

        public Shared.Types.BooleanResult AuthenticateUser(Shared.Types.SessionProperties properties)
        {
            Shared.Types.UserInformation userInfo = properties.GetTrackedSingle<Shared.Types.UserInformation>();

            m_logger.DebugFormat("Authenticate: {0}", userInfo.Username);

            UserEntry entry = GetUserEntry(userInfo.Username);

            if (entry != null)
            {
                m_logger.DebugFormat("Retrieved info for user {0} from MySQL.  Password uses {1}.",
                    entry.Name, entry.HashAlg.ToString());

                bool passwordOk = entry.VerifyPassword(userInfo.Password);
                if (passwordOk)
                {
                    m_logger.DebugFormat("Authentication successful for {0}", userInfo.Username);
                    return new Shared.Types.BooleanResult() { Success = true, Message = "Success." };
                }
                else
                {
                    m_logger.DebugFormat("Authentication failed for {0}", userInfo.Username);
                    return new Shared.Types.BooleanResult() { Success = false, Message = "Invalid username or password." };
                }
            }
            else
            {
                m_logger.DebugFormat("Authentication failed for {0}", userInfo.Username);
                return new Shared.Types.BooleanResult() { Success = false, Message = "Invalid username or password." };
            }
        }
开发者ID:rameshwars,项目名称:pgina,代码行数:31,代码来源:PluginImpl.cs


示例5: CreateEvent

        /// <summary>
        /// This should read in a Type byte and create an instance of the correct type
        /// Each event type should include a custom 'Execute' method that handles it
        /// </summary>
        protected override IEvent CreateEvent(Shared.InamStream stream)
        {
            int ID = stream.ReadInt32();
            BrainEventType type = (BrainEventType)stream.ReadByte();

            if (type == BrainEventType.System)
            {
            }
            else if (type == BrainEventType.Sight)
            {
                return new BrainSightEvent(this, stream, this.entity);
            }
            else if (type == BrainEventType.Touch)
            {
                return new BrainTouchEvent(this, stream, this.entity);
            }
            else if (type == BrainEventType.Hear)
            {

            }
            else if (type == BrainEventType.Taste)
            {

            }

            // bad
            return null;
        }
开发者ID:milesgray,项目名称:resatiate,代码行数:32,代码来源:BrainEventManager.cs


示例6: SendContact

        public bool SendContact(string sessionKey, Shared.Dto.Contact contact)
        {
            var dbContext = DbContextFactory.GetContext();

            var sessionService = new SessionService();
            var user = sessionService.GetUser(sessionKey);
            if (user == null) return false;

            User recipient;
            try
            {
                recipient =
                    dbContext.Users.Single(u => u.Id == contact.ReceiverId);
            }
            catch (Exception)
            {
                return false;
            }

            var newContact = new Contact
            {
                PublicKey = contact.PublicKey,
                Name = contact.Name,
                Sender = user,
                Recipient = recipient
            };

            dbContext.Add(newContact);
            dbContext.SaveChanges();

            var userService = new PushService();
            userService.Push(recipient, "Recieved new contact!");

            return true;
        }
开发者ID:QRyptoWire,项目名称:qrypto-wire,代码行数:35,代码来源:ContactService.cs


示例7: AuthenticatedUserGateway

        public Shared.Types.BooleanResult AuthenticatedUserGateway(Shared.Types.SessionProperties properties)
        {
            UserInformation userInfo = properties.GetTrackedSingle<UserInformation>();

            try
            {
                using (MySqlUserDataSource dataSource = new MySqlUserDataSource())
                {
                    List<GroupGatewayRule> rules = GroupRuleLoader.GetGatewayRules();

                    foreach (GroupGatewayRule rule in rules)
                    {
                        m_logger.DebugFormat("Checking rule: {0}", rule.ToString());
                        if (rule.RuleMatch(dataSource.IsMemberOfGroup(userInfo.Username, rule.Group)))
                        {
                            m_logger.DebugFormat("Rule is a match, adding to {0}", rule.LocalGroup);
                            userInfo.Groups.Add(new GroupInformation { Name = rule.LocalGroup });
                        }
                        else
                        {
                            m_logger.DebugFormat("Rule is not a match");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                m_logger.ErrorFormat("Unexpected error: {0}", e);
                throw;
            }

            // Always return success
            return new Shared.Types.BooleanResult { Success = true };
        }
开发者ID:slayercat,项目名称:pgina,代码行数:34,代码来源:PluginImpl.cs


示例8: OnPolling

        protected async override Task<ProcessResult> OnPolling(
            Shared.Jobs.PollerJobParameters parameters,
            string workingFolder)
        {
            string pathToFile = await DownloadBlob(parameters.TenantId, parameters.JobId, parameters.FileName, workingFolder);

            Logger.DebugFormat("Downloaded file {0} to be converted to pdf", pathToFile);
            var converter = Converters.FirstOrDefault(c => c.CanConvert(pathToFile));
            if (converter == null)
            {
                Logger.InfoFormat("No converter for extension {0}", Path.GetExtension(pathToFile));
                return ProcessResult.Ok;
            }

            string outFile = Path.Combine(workingFolder, Guid.NewGuid() + ".pdf");
            if (!converter.Convert(pathToFile, outFile))
            {
                Logger.ErrorFormat("Error converting file {0} to pdf", pathToFile);
                return ProcessResult.Fail;
            }

            await AddFormatToDocumentFromFile(
               parameters.TenantId,
               parameters.JobId,
               new DocumentFormat(DocumentFormats.Pdf),
               outFile,
               new Dictionary<string, object>());

            return ProcessResult.Ok;
        }
开发者ID:ProximoSrl,项目名称:Jarvis.DocumentStore,代码行数:30,代码来源:PdfConverterOutOfProcessJob.cs


示例9: CreateEvent

        protected override IEvent CreateEvent(Shared.InamStream stream)
        {
            //int ID = stream.ReadInt32();  // there is no ID here, as we are just choosing the correct sense to send this to
            byte type = stream.ReadByte();

            // bad
            return null;
        }
开发者ID:milesgray,项目名称:resatiate,代码行数:8,代码来源:EntityEventManager.cs


示例10: ToString_returns_a_string_representation_of_the_object

        public void ToString_returns_a_string_representation_of_the_object()
        {
            var shared = new Shared<object>();

            const string expected = "Shared<System.Object>";

            Assert.AreEqual(expected, shared.ToString());
        }
开发者ID:ondfisk,项目名称:C5.Concurrent,代码行数:8,代码来源:SharedTests.cs


示例11: NavigateToMainView

 public void NavigateToMainView(Shared.ViewModels.MainViewModel.SubView? subView)
 {
     if (!subView.HasValue || subView.Value == Shared.ViewModels.MainViewModel.SubView.Auction)
     {
         Navigate(typeof(AuctionView));
         return;
     }
     throw new NotImplementedException();
 }
开发者ID:rvdplas,项目名称:QuickCross,代码行数:9,代码来源:CloudAuctionNavigator.cs


示例12: Constructor_when_given_a_value_instantiates_with_it

        public void Constructor_when_given_a_value_instantiates_with_it()
        {
            var value = new object();
            var shared = new Shared<object>(value);

            var actual = shared.Value;

            Assert.AreEqual(value, actual);
        }
开发者ID:ondfisk,项目名称:C5.Concurrent,代码行数:9,代码来源:SharedTests.cs


示例13: AddContact

 public IHttpActionResult AddContact([FromUri]string sessionKey, Shared.Dto.Contact contact)
 {
     var contactService = new ContactService();
     if (contactService.SendContact(sessionKey, contact))
     {
         return Ok();
     }
     return Unauthorized();
 }
开发者ID:QRyptoWire,项目名称:qrypto-wire,代码行数:9,代码来源:QryptoWireController.cs


示例14: trigger

 public void trigger(Shared lastState, Shared currentState)
 {
     // don't trigger events if someone else is driving the car (or it's a replay). No way to tell the difference between
     // watching an AI 'live' and the AI being in control of your car for starts / pitstops
     if (!CommonData.isNew && currentState.ControlType != (int)Constant.Control.Remote &&
         currentState.ControlType != (int)Constant.Control.Replay)
     {
         triggerInternal(lastState, currentState);
     }
 }
开发者ID:mrbelowski,项目名称:r3e_crewchief,代码行数:10,代码来源:AbstractEvent.cs


示例15: Prepare

        public override SkillResults Prepare(World.MabiCreature creature, World.MabiSkill skill, Shared.Network.MabiPacket packet, uint castTime)
        {
            creature.StopMove();

            WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, creature.Id).PutInt(Effect.SkillInit).PutString("thunder").PutShort((ushort)skill.Id), SendTargets.Range, creature);

            Send.SkillPrepare(creature.Client, creature, skill.Id, castTime);

            return SkillResults.Okay;
        }
开发者ID:pjm0616,项目名称:aura,代码行数:10,代码来源:ThunderHandler.cs


示例16: AuthenticatedUserGateway

        public Shared.Types.BooleanResult AuthenticatedUserGateway(Shared.Types.SessionProperties properties)
        {
            UserInformation userInfo = properties.GetTrackedSingle<UserInformation>();

            try
            {
                using (MySqlUserDataSource dataSource = new MySqlUserDataSource())
                {
                    List<GroupGatewayRule> rules = GroupRuleLoader.GetGatewayRules();

                    foreach (GroupGatewayRule rule in rules)
                    {
                        m_logger.DebugFormat("Checking rule: {0}", rule.ToString());
                        if (rule.RuleMatch(dataSource.IsMemberOfGroup(userInfo.Username, rule.Group)))
                        {
                            m_logger.DebugFormat("Rule is a match, adding to {0}", rule.LocalGroup);
                            userInfo.Groups.Add(new GroupInformation { Name = rule.LocalGroup });
                        }
                        else
                        {
                            m_logger.DebugFormat("Rule is not a match");
                        }
                    }
                }
            }
            catch(MySqlException e)
            {
                bool preventLogon = Settings.Store.PreventLogonOnServerError;
                if( preventLogon )
                {
                    m_logger.DebugFormat("Encountered MySQL server error, and preventing logon: {0}", e.Message);
                    return new BooleanResult {
                        Success = false,
                        Message = string.Format("Preventing logon due to server error: {0}", e.Message)
                    };
                }
                else
                {
                    m_logger.DebugFormat("Encoutered MySQL server error, but returning success anyway.  Error: {0}", e.Message);
                    return new BooleanResult {
                        Success = true,
                        Message = string.Format("Encountered server error: {0}", e.Message)
                    };
                }
            }
            catch (Exception e)
            {
                m_logger.ErrorFormat("Unexpected error: {0}", e);
                throw;
            }

            // Always return success
            return new Shared.Types.BooleanResult { Success = true };
        }
开发者ID:MutonUfoAI,项目名称:pgina,代码行数:54,代码来源:PluginImpl.cs


示例17: getResult

 private Shared.Results.TestResult getResult(double duration, Shared.Results.TestState state, string name, string message, string stackLines)
 {
     var result = new Shared.Results.TestResult("XUnit", _currentAssembly, "", duration * 1000, name, state, message);
     if (stackLines != null)
     {
         var lines = stackLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
         foreach (var line in lines)
             result.AddStackLine(new Shared.Results.StackLine(line));
     }
     return result;
 }
开发者ID:jeremywiebe,项目名称:AutoTest.Net,代码行数:11,代码来源:XUnitLogger.cs


示例18: CytologyIcd9EntryPage_Return

 private void CytologyIcd9EntryPage_Return(object sender, Shared.PageNavigationReturnEventArgs e)
 {
     switch (e.PageNavigationDirectionEnum)
     {
         case Shared.PageNavigationDirectionEnum.Next:
             this.ShowCytologyClinicalHistoryPage();
             break;
         case Shared.PageNavigationDirectionEnum.Back:
             this.ShowCytologyIcd9CodingPage();
             break;
     }
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:12,代码来源:ThinPrepPapSpecimenPath.cs


示例19: CompressFiles

 public void CompressFiles(string destinationDirectory, string archiveName, Shared.Enums.pdFileCompressor type, string pwd, params string[] files)
 {
     switch (type)
     {
         case Shared.Enums.pdFileCompressor.SEVEN_ZIP:
             this.CompressFiles_7z(destinationDirectory, archiveName, pwd, files);
             break;
         case Shared.Enums.pdFileCompressor.ZIP:
             this.CompressFiles_zip(destinationDirectory, archiveName, pwd, files);
             break;
     }
 }
开发者ID:AndrewEastwood,项目名称:desktop,代码行数:12,代码来源:szStorage.cs


示例20:

 void IUIWidget.OnOperationChange(Shared.Core.Operation operation)
 {
     string lineOne = operation != null ? operation.ToString(SettingsManager.Instance.GetSetting("OperationWidget", "LineOne").GetString()) : "(n/A)";
     string lineTwo = operation != null ? operation.ToString(SettingsManager.Instance.GetSetting("OperationWidget", "LineTwo").GetString()) : "(n/A)";
     string lineThree = operation != null ? operation.ToString(SettingsManager.Instance.GetSetting("OperationWidget", "LineThree").GetString()) : "(n/A)";
     LineOne.Inlines.Clear();
     LineOne.Inlines.Add(Helper.Traverse(lineOne));
     LineTwo.Inlines.Clear();
     LineTwo.Inlines.Add(Helper.Traverse(lineTwo));
     LineThree.Inlines.Clear();
     LineThree.Inlines.Add(Helper.Traverse(lineThree));
 }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:12,代码来源:OperationWidget.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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