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

C# Work类代码示例

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

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



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

示例1: GetXmlForWork

		/// ------------------------------------------------------------------------------------
		public string GetXmlForWork(Work work)
		{
			var bldr =  new StringBuilder();

			if (work != null)
			{
				bldr.Append(GetOlacRecordElement());

				foreach (var contributor in work.Contributions)
					bldr.Append(GetContributorElement(contributor.Role.Code, contributor.ContributorName));

				bldr.Append("</olac:olac>");
			}

			return bldr.ToString();

			/*            <dc:language xsi:type="olac:language" olac:code="adz"
				  view="Adzera"/>

			  <dc:subject xsi:type="olac:language" olac:code="adz"
				  view="Adzera"/>



	  <dc:title>Language</dc:title>
	  <dc:publisher>New York: Holt</dc:publisher>
			 */

		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:30,代码来源:OlacSystem.cs


示例2: ContentHub

 public ContentHub(Work<IContentManager> workContentManager,
     Work<IAuthenticationService> workAuthenticationService,
     IClock clock) {
     _workContentManager = workContentManager;
     _workAuthenticationService = workAuthenticationService;
     _clock = clock;
 }
开发者ID:Jetski5822,项目名称:NGM.OperationalTransformation,代码行数:7,代码来源:ContentHub.cs


示例3: Search

        /// <summary>
        /// Implements the search function in managed code.
        /// </summary>
        /// <param name="work"></param>
        /// <param name="round1State"></param>
        /// <param name="round1Block2"></param>
        /// <param name="round2State"></param>
        /// <param name="round2Block1"></param>
        /// <returns></returns>
        public unsafe override uint? Search(Work work, uint* round1State, byte* round1Block2, uint* round2State, byte* round2Block1)
        {
            // starting nonce
            uint nonce = 0;

            // output for final hash
            uint* round2State2 = stackalloc uint[Sha256.SHA256_STATE_SIZE];

            while (true)
            {
                // update the nonce value
                ((uint*)round1Block2)[3] = nonce;

                // transform variable second half of block using saved state from first block, into pre-padded round 2 block (end of first hash)
                Sha256.Transform(round1State, round1Block2, (uint*)round2Block1);

                // transform round 2 block into round 2 state (second hash)
                Sha256.Transform(round2State, round2Block1, round2State2);

                // test for potentially valid hash
                if (round2State2[7] == 0U)
                    // actual nonce is flipped
                    return Memory.ReverseEndian(nonce);

                // only report and check for exit conditions every so often
                if ((++nonce % 65536) == 0)
                    if (!Progress(work, 65536) || nonce == 0)
                        break;
            }

            return null;
        }
开发者ID:wasabii,项目名称:BitMaker,代码行数:41,代码来源:ManagedMiner.cs


示例4: ShoutboxHub

        public ShoutboxHub(Work<IOrchardServices> orchardServices, IHelpers helpers, IShoutboxService shoutboxService, IPostService postService)
        {
            if (orchardServices == null)
            {
                throw new ArgumentNullException("orchardServices");
            }

            if (helpers == null)
            {
                throw new ArgumentNullException("helpers");
            }

            if (postService == null)
            {
                throw new ArgumentNullException("postService");
            }

            if (shoutboxService == null)
            {
                throw new ArgumentNullException("shoutboxService");
            }

            _OrchardServices = orchardServices;
            _Helpers = helpers;
            _ShoutboxService = shoutboxService;
            _PostService = postService;
        }
开发者ID:micrak,项目名称:anurgath-shoutbox,代码行数:27,代码来源:ShoutboxHub.cs


示例5: Shapes

 public Shapes(
     Work<WorkContext> workContext,
     Work<INavigationManager> navigationManager)
 {
     _workContext = workContext;
     _navigationManager = navigationManager;
 }
开发者ID:dminik,项目名称:voda_code,代码行数:7,代码来源:Shapes.cs


示例6: FacebookConnectWidgetPartHandler

 public FacebookConnectWidgetPartHandler(Work<ISiteService> siteServiceWork)
 {
     OnActivated<FacebookConnectWidgetPart>((context, part) =>
         {
             part.PermissionsField.Loader(() => siteServiceWork.Value.GetSiteSettings().As<FacebookConnectSettingsPart>().Permissions);
         });
 }
开发者ID:Lombiq,项目名称:Orchard-Facebook-Suite-Connect,代码行数:7,代码来源:FacebookConnectWidgetPartHandler.cs


示例7: Main

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var works = new Work[N];
        for (int i = 0; i < N; i++)
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int J = int.Parse(inputs[0]);
            int D = int.Parse(inputs[1]);
            works[i] = new Work { Starts = J, Ends = J + D - 1 };
        }

        var sortedWorks = works.OrderBy(x => x.Ends).ThenBy(x => x.Starts).ToArray();

        var lastEnd = 0;
        var count = 0;
        for (int i = 0; i < sortedWorks.Length; i++)
        {
            if (sortedWorks[i].Starts > lastEnd)
            {
                count++;
                lastEnd = sortedWorks[i].Ends;
            }
        }

        Console.WriteLine(count);
    }
开发者ID:aquamoth,项目名称:CodeinGame,代码行数:27,代码来源:Program.cs


示例8: DefaultExceptionPolicy

 public DefaultExceptionPolicy(INotifier notifier, Work<IAuthorizer> authorizer)
 {
     _notifier = notifier;
     _authorizer = authorizer;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
开发者ID:jecofang01,项目名称:OrchardNoCMS,代码行数:7,代码来源:DefaultExceptionPolicy.cs


示例9: ScriptDifferences

 private ExecutionBlock ScriptDifferences(Differences differences)
 {
     var work = new Work();
     work.BuildFromDifferences(differences, Options.Default, true);
     ExecutionBlock block = work.ExecutionBlock;
     return block;
 }
开发者ID:tcabanski,项目名称:SouthSideDevToys,代码行数:7,代码来源:SchemaSyncEngine.cs


示例10: Main

    static void Main()
    {
        // Create the thread object. This does not start the thread.
        Worker workerObject = new Work();
        Thread workerThread = new Thread(workerObject.DoWork);

        // Start the worker thread.
        workerThread.Start();
        Console.WriteLine("main thread: Starting worker thread...");

        // Loop until worker thread activates. 
        while (!workerThread.IsAlive) ;

        // Put the main thread to sleep for 1 millisecond to 
        // allow the worker thread to do some work:
        Thread.Sleep(1);

        // Request that the worker thread stop itself:
        workerObject.RequestStop();

        // Use the Join method to block the current thread  
        // until the object's thread terminates.
        workerThread.Join();
        Console.WriteLine("main thread: Worker thread has terminated.");
    }
开发者ID:karthikkumsi,项目名称:FTDI_Test-app,代码行数:25,代码来源:Form1.Designer.cs


示例11: Main

        public static void Main()
        {
            try
            {
                TTransport transport = new TSocket("localhost", 9090);
                TProtocol protocol = new TBinaryProtocol(transport);
                Calculator.Client client = new Calculator.Client(protocol);

                transport.Open();
                try
                {
                    client.ping();
                    Console.WriteLine("ping()");

                    int sum = client.add(1, 1);
                    Console.WriteLine("1+1={0}", sum);

                    Work work = new Work();

                    work.Op = Operation.DIVIDE;
                    work.Num1 = 1;
                    work.Num2 = 0;
                    try
                    {
                        int quotient = client.calculate(1, work);
                        Console.WriteLine("Whoa we can divide by 0");
                    }
                    catch (InvalidOperation io)
                    {
                        Console.WriteLine("Invalid operation: " + io.Why);
                    }

                    work.Op = Operation.SUBTRACT;
                    work.Num1 = 15;
                    work.Num2 = 10;
                    try
                    {
                        int diff = client.calculate(1, work);
                        Console.WriteLine("15-10={0}", diff);
                    }
                    catch (InvalidOperation io)
                    {
                        Console.WriteLine("Invalid operation: " + io.Why);
                    }

                    SharedStruct log = client.getStruct(1);
                    Console.WriteLine("Check log: {0}", log.Value);

                }
                finally
                {
                    transport.Close();
                }
            }
            catch (TApplicationException x)
            {
                Console.WriteLine(x.StackTrace);
            }

        }
开发者ID:ConfusedReality,项目名称:pkg_serialization_thrift,代码行数:60,代码来源:CsharpClient.cs


示例12: PerformWork

 public void PerformWork(Work work, ISessionImplementor session)
 {
     if (session.TransactionInProgress)
     {
         ITransaction transaction = ((ISession)session).Transaction;
         PostTransactionWorkQueueSynchronization txSync = (PostTransactionWorkQueueSynchronization)
                                                          synchronizationPerTransaction[transaction];
         if (txSync == null || txSync.IsConsumed)
         {
             txSync =
                 new PostTransactionWorkQueueSynchronization(queueingProcessor, synchronizationPerTransaction);
             transaction.RegisterSynchronization(txSync);
             lock (synchronizationPerTransaction.SyncRoot)
                 synchronizationPerTransaction[transaction] = txSync;
         }
         txSync.Add(work);
     }
     else
     {
         WorkQueue queue = new WorkQueue(2); //one work can be split
         queueingProcessor.Add(work, queue);
         queueingProcessor.PrepareWorks(queue);
         queueingProcessor.PerformWorks(queue);
     }
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:25,代码来源:TransactionalWorker.cs


示例13: FileRecordSequenceCompletedAsyncResult

        public FileRecordSequenceCompletedAsyncResult(
            SequenceNumber result,
            AsyncCallback callback,
            object userState,
            Work work)
        {
            this.result = result;
            this.callback = callback;
            this.userState = userState;
            this.work = work;

            this.syncRoot = new object();

            if (this.callback != null)
            {
                try
                {
                    this.callback(this);
                }
#pragma warning suppress 56500 // This is a callback exception
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                        throw;

                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(e);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:29,代码来源:FileRecordSequenceCompletedAsyncResult.cs


示例14: Main

    static void Main() 
    {
        // To start a thread using a static thread procedure, use the 
        // class name and method name when you create the ThreadStart 
        // delegate. Beginning in version 2.0 of the .NET Framework, 
        // it is not necessary to create a delegate explicitly.  
        // Specify the name of the method in the Thread constructor,  
        // and the compiler selects the correct delegate. For example: 
        // 
         Thread newThread = new Thread(Work.DoWork); 
        //
        // ThreadStart threadDelegate = new ThreadStart(Work.DoWork);
        // Thread newThread = new Thread(threadDelegate);
        newThread.Start();

        // To start a thread using an instance method for the thread  
        // procedure, use the instance variable and method name when  
        // you create the ThreadStart delegate. Beginning in version 
        // 2.0 of the .NET Framework, the explicit delegate is not 
        // required. 
        //
        Work w = new Work();
        w.Data = 42;
        newThread = new Thread(w.DoMoreWork); //directly attach newThread to a new method
        // threadDelegate = new ThreadStart(w.DoMoreWork);
        // newThread = new Thread(threadDelegate);
        newThread.Start();
    }
开发者ID:siagung,项目名称:Qilu-leetcode,代码行数:28,代码来源:MultiThreadExamples.cs


示例15: TypicalEmbedInMyXmlDocument

		public void TypicalEmbedInMyXmlDocument()
		{
			var system = new OlacSystem();
			var work = new Work();
			work.Licenses.Add(License.CreativeCommons_Attribution_ShareAlike);
			work.Contributions.Add(new Contribution("Charlie Brown", system.GetRoleByCodeOrThrow("author")));
			work.Contributions.Add(new Contribution("Linus", system.GetRoleByCodeOrThrow("editor")));

			string metaData = system.GetXmlForWork(work);

			//Embed that data in our own file
			using (var f = new TempFile(@"<doc>
				<metadata>" + metaData + @"</metadata>
				<ourDocumentContents>blah blah<ourDocumentContents/></doc>"))
			{
				//Then when it comes time to read the file, we can extract out the work again
				var dom = new XmlDocument();
				dom.Load(f.Path);

				var node = dom.SelectSingleNode("//metadata");
				var work2 = new Work();
				system.LoadWorkFromXml(work2, node.InnerXml);

				Assert.AreEqual(2,work2.Contributions.Count());
			}
		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:26,代码来源:ClearShareUsage.cs


示例16: SocketsContentPartDriver

 public SocketsContentPartDriver(IOrchardServices services, 
     Work<IMechanicsDisplay> display)
 {
     Services = services;
     _mechanicsDisplay = display;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
开发者ID:akhurst,项目名称:ricealumni,代码行数:8,代码来源:SocketsContentPartDriver.cs


示例17: MediaFormatHeaderFilter

 public MediaFormatHeaderFilter(
     IOrchardServices _orchardServices,
     Work<IMediaGardenService> gardenService)
 {
     Services = _orchardServices;
     _gardenService = gardenService;
     T= NullLocalizer.Instance;
 }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:8,代码来源:MediaFormatHeaderFilter.cs


示例18: AssociativyGraphLinksPartHandler

 public AssociativyGraphLinksPartHandler(Work<IGraphManager> graphManagerWork, Work<IEngineManager> engineManagerWork)
 {
     OnActivated<AssociativyGraphLinksPart>((context, part) =>
     {
         part.GraphsField.Loader(() => graphManagerWork.Value.FindGraphs(new GraphContext { ContentTypes = new [] { context.ContentType } }));
         part.FrontendEnginesField.Loader(() => engineManagerWork.Value.GetEngines());
     });
 }
开发者ID:Lombiq,项目名称:Associativy-Extensions,代码行数:8,代码来源:AssociativyGraphLinksPartHandler.cs


示例19: ContentPickerShapes

 public ContentPickerShapes(
     Work<INavigationManager> navigationManager,
     Work<WorkContext> workContext,
     Work<IShapeFactory> shapeFactory) {
     _navigationManager = navigationManager;
     _workContext = workContext;
     _shapeFactory = shapeFactory;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:8,代码来源:ContentPickerShapes.cs


示例20: NavigationProviderFactory

 public NavigationProviderFactory(Work<IAdvancedMenuService> menuService, ICacheManager cache, ISignals signals,
     IEnumerable<INavigationProvider> providers)
 {
     _menuService = menuService;
     _cache = cache;
     _signals = signals;
     _providers = providers;
 }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:8,代码来源:NavigationProviderFactory.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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