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


C# Context.Request方法代码示例

本文整理汇总了C#中Context.Request方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Request方法的具体用法?C# Context.Request怎么用?C# Context.Request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Context的用法示例。


在下文中一共展示了Context.Request方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnitTest

	// 
	void UnitTest () 
	{
		Context theContext = new Context();
		theContext.SetState( new ConcreteStateA( theContext ));
		theContext.Request( 5 );
		theContext.Request( 15 );
		theContext.Request( 25 );
		theContext.Request( 35 );

	}
开发者ID:jardar,项目名称:PBaseDefense_Unity3D,代码行数:11,代码来源:StateTest.cs

示例2: Main

  public static void Main( string[] args )
  {
    // Setup context in a state
    Context c = new Context( new ConcreteStateA() );
    c.Show();

    // Issue request, which toggles state
    c.Request();
    c.Show();

    // Issue request, which toggles state
    c.Request();
    c.Show();

  }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:15,代码来源:State_Structure.cs

示例3: Demo

        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Demo()
        {
            // Setup context in a state
            Context c = new Context(new ConcreteStateA());

            // Issue requests, which toggles state
            c.Request();
            c.Request();

            c.State = new ConcreteStateB();
            c.Request();
            c.Request();

            // Wait for user
            Console.ReadKey();
        }
开发者ID:aloneplayer,项目名称:BenProjects,代码行数:19,代码来源:StatePattern.cs

示例4: Execute

 public void Execute(Demo4Input input)
 {
     using (var context = new Context())
     using (var socket = context.Request())
     {
         socket.Connect("tcp://localhost:5559");
         SendRequests(socket, input.NodeNumberFlag);
     }
 }
开发者ID:brechtvm,项目名称:presentations-zeromq,代码行数:9,代码来源:Client.cs

示例5: Main

        static void Main(string[] args)
        {
            //#region Book User Level
            //User user = new User("Hyman");
            //user.BuyBook(2000);
            //user.BuyBook(2000);
            //user.BuyBook(2000);
            //user.BuyBook(2000);
            //Console.Read();
            //#endregion

            #region State patter structure
            Context context = new Context();
            context.Request();
            context.Request();
            context.Request();
            context.Request();
            Console.Read();
            #endregion
        }
开发者ID:Huai-Ming,项目名称:Design-Patterns-For-C-,代码行数:20,代码来源:Program.cs

示例6: Demo

        // The user interface
        static void Demo()
        {
            // context.s are States
            // Decide on a starting state and hold onto the Context thus established
            Context context = new Context();
            context.State = new RestingState();

            char command = ' ';
            Console.WriteLine("Welcome to \"The State Game\"!");
            Console.WriteLine("You are standing here looking relaxed!");
            while (command != 'e')
            {
                Console.WriteLine("\nWhat would you like to do now?");
                Console.Write(" Move Attack Stop Run Panic CalmDown Exit the game: ==>");
                string choice;
                do
                {
                    choice = Console.ReadLine();
                }
                while (choice == null);
                command = choice[0];
                context.Request(command);
            }
        }
开发者ID:aloneplayer,项目名称:BenProjects,代码行数:25,代码来源:GameState.cs

示例7: Main

            public static void Main()
            {
                Context context = new Context();
                    context.State = new NormalState();
                    Random r = new Random(37);
                    for (int i = 0; i <= 25; i++) {

                        int command = r.Next(3);
                        Console.Write(context.Request(command) + " ");
                    }
                    Console.WriteLine();
            }
开发者ID:zlanusic,项目名称:OOM_DesignPatterns,代码行数:12,代码来源:State.cs


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